From patchwork Thu Sep 14 06:42:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 139350 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp153216vqi; Wed, 13 Sep 2023 23:42:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFP17nOe4e12Cvof6fOaxMClnSzi73Th40xbxzRC8eY62TS2QRX6sMMLdnXlBH3IsSPlMEV X-Received: by 2002:a19:790d:0:b0:500:a789:cff2 with SMTP id u13-20020a19790d000000b00500a789cff2mr3090387lfc.19.1694673773486; Wed, 13 Sep 2023 23:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694673773; cv=none; d=google.com; s=arc-20160816; b=xP7aUEqQdmoAuehKNZyjGsxGsMEZcUuMYmh9Gfp9E94F+ePovA523mVTegTxKWEftQ Jzs7lBiDqVhU4Rg8DqAPhecyt6TRTyptuq5rFKgEGd9tEZEuf0QTuTw3EswUXEUCIXOp byv9tUqWHTtZhDvW4HuQrC76u1RZRP2QWsP2BCjXuPLQAkbSNc9wKP+fFEViNvD8kDlx 1WrVSs8BUmjq24vsMwCi66fcuT2UrwhS8Saed+sZtF4WkaClqEXa02YfOURRis6BYXH5 yWuGJDAJwKgGd0DEFptgLly8hGed7JdMiLOIisw5uh6IGGePAAG/xfhTgizqGurC8L9h fKIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=ORKd3IIXeV2NMLgNggjTrRdVm0a9At+ucsduryqunnY=; fh=pJtl12lZAnlB4oxcXBofzfzuuJQjxejLxhCnzyMl72Y=; b=nciac1L7HMVbcvxUuV7yPsuLPvP+WYCfF2CpoDeWLICuADGKvS5YNgEMRKyq04jfoa YKY8a6CGWAQnEUFFJOG1YvBHNqBbDzeghAqOpfWHXQK6z5kGw27leUBIYPvAQukqaOaV FY/3a4AIJ1JV8H/WLvcgFU2d8HoD3GM0+i3owxb/nm92obPBwJ6PjMPxXskKgvM1zLSL Q0DIEdwj/s+Z+i56GQscoRru9yfU2ilyMMV0GmlvhItb5Sxw2dr8qDjXB66+esfLR/eE dFzB71D4ARcmCVJgwsOyriTUFfA3u6oLVv3ux4Upyqyx7BhHvEoInTrYG+8IPQinXYTx R67Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=CQKWYKDS; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id w7-20020a50fa87000000b0052c18a8212dsi736630edr.533.2023.09.13.23.42.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 23:42:53 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=CQKWYKDS; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EC7F43857B9B for ; Thu, 14 Sep 2023 06:42:50 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by sourceware.org (Postfix) with ESMTPS id 92FE23858D20 for ; Thu, 14 Sep 2023 06:42:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 92FE23858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=t-8ch.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=t-8ch.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=t-8ch.de; s=mail; t=1694673764; bh=dR088wBowUlq1dKqHzIxw/tm3edw6vi8vcZQxgq84K0=; h=From:To:Cc:Subject:Date:From; b=CQKWYKDSPex5amAR9MGYfOGQltxiGSWc8aZiGBmVKl96IR89jtN3u0Q15WH6NPb4K zBam+/A6oVYiB9+GCI9M4V7JViWVCKyrnSLg5Qb2QLyaB6Ggn9DpOxuk5gXG/N9+nj zPyBvkkAtNVUv7mmjEemW2UVHAdPuT+O8pLW7Oxg= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= To: binutils@sourceware.org Cc: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Subject: [PATCH] ld: write full path to included file to dependency-file Date: Thu, 14 Sep 2023 08:42:27 +0200 Message-ID: <20230914064235.275964-1-thomas@t-8ch.de> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776994246358558348 X-GMAIL-MSGID: 1776994246358558348 In ldfile_open_command_file_1() name written to the dependency files is the name as specified passed to the "INCLUDE" directive. This is before include-path processing so the tracked dependency location is most likely wrong. Instead track the opened file at the point where the full path is actually available, in ldfile_find_command_file(). --- ld/ldfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) base-commit: 95ebc6fdec5780bf59685739cdd55cd41d0f55ac diff --git a/ld/ldfile.c b/ld/ldfile.c index b8fd4e5d8e0a..56b221c25d68 100644 --- a/ld/ldfile.c +++ b/ld/ldfile.c @@ -643,6 +643,8 @@ ldfile_find_command_file (const char *name, { path = concat (search->name, slash, name, (const char *) NULL); result = try_open (path, sysrooted); + if (result) + track_dependency_files (path); free (path); if (result) break; @@ -711,8 +713,6 @@ ldfile_open_command_file_1 (const char *name, enum script_open_style open_how) return; } - track_dependency_files (name); - lex_push_file (ldlex_input_stack, name, sysrooted); lineno = 1;