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 D63CA3858C78 for ; Mon, 18 Sep 2023 19:42:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D63CA3858C78 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=1695066149; bh=u1Qmerz9yMceu2/dLF9DpI+Z5C1uONgl7XB927lxp9c=; h=From:To:Cc:Subject:Date:From; b=MQMsexKge6iYzYb7WRVwMXlPs40HpI0sXRd4IL3AD/DWpOA3ocvUmksGxXAVnWiYl XQzB3u/8LJV+/petxdcgzCI+DSfZbn7wKkT8FXbC6wheQWiuhuKhBV8wTv6O4FHwoD OCrF9bvH9dDCub6vbHjHzAqZ3vUchAU+vb6ynOs4= From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= To: binutils@sourceware.org Cc: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Jan Beulich , Alan Modra Subject: [PATCH v3] ld: write resolved path to included file to dependency-file Date: Mon, 18 Sep 2023 21:42:23 +0200 Message-ID: <20230918194226.1200853-1-thomas@t-8ch.de> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.4 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 resolved path is actually available, in try_open(). Signed-off-by: Thomas Weißschuh --- v2: https://sourceware.org/pipermail/binutils/2023-September/129503.html v2 -> v3: * drop "write absolute paths to dependencies" * fix code style in conditional v1: https://sourceware.org/pipermail/binutils/2023-September/129475.html v1 -> v2: * push call to track_dependencies() into try_open() to catch all dependencies * sign-off commits * write absolute paths to dependencies ld/ldfile.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ld/ldfile.c b/ld/ldfile.c index b8fd4e5d8e0a..d73e251402c8 100644 --- a/ld/ldfile.c +++ b/ld/ldfile.c @@ -529,7 +529,10 @@ try_open (const char *name, bool *sysrooted) result = fopen (name, "r"); if (result != NULL) - *sysrooted = is_sysrooted_pathname (name); + { + *sysrooted = is_sysrooted_pathname (name); + track_dependency_files (name); + } if (verbose) { @@ -711,8 +714,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