[PATCH v2 1/2] ld: write resolved path to included file to dependency-file

Jan Beulich jbeulich@suse.com
Mon Sep 18 13:28:49 GMT 2023


On 16.09.2023 12:36, Thomas Weißschuh wrote:
> 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 <thomas@t-8ch.de>

Looks okay to me, with (nit) ...

> --- a/ld/ldfile.c
> +++ b/ld/ldfile.c
> @@ -528,8 +528,10 @@ try_open (const char *name, bool *sysrooted)
>  
>    result = fopen (name, "r");
>  
> -  if (result != NULL)
> +  if (result != NULL) {

... style corrected here:

  if (result != NULL)
    {
      *sysrooted = is_sysrooted_pathname (name);
      track_dependency_files (name);
    }

Jan


More information about the Binutils mailing list