public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <thomas@t-8ch.de>
To: binutils@sourceware.org
Cc: "Thomas Weißschuh" <thomas@t-8ch.de>
Subject: [PATCH] ld: write full path to included file to dependency-file
Date: Thu, 14 Sep 2023 08:42:27 +0200	[thread overview]
Message-ID: <20230914064235.275964-1-thomas@t-8ch.de> (raw)

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


             reply	other threads:[~2023-09-14  6:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14  6:42 Thomas Weißschuh [this message]
2023-09-16  8:20 ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230914064235.275964-1-thomas@t-8ch.de \
    --to=thomas@t-8ch.de \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).