From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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=20Wei=C3=9Fschuh?= To: binutils@sourceware.org Cc: =?UTF-8?q?Thomas=20Wei=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 Content-Transfer-Encoding: 8bit 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 List-Id: 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(-) 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; base-commit: 95ebc6fdec5780bf59685739cdd55cd41d0f55ac -- 2.42.0