[PATCH v2] ld: Use stat to check if linker script appears multiple times
Jan Beulich
jbeulich@suse.com
Tue Aug 12 07:00:16 GMT 2025
On 11.08.2025 23:25, H.J. Lu wrote:
> Use stat, instead of strcmp, to check if the same linker script file
> appears multiple times for
>
> $ ld -L... -T ././/script.t -T script.t ...
>
> Although ././/script.t and script.t access the same file, but their
> filenames are different. strcmp won't work here.
>
> Copy ../gnulib/import/same-inode.h to ld since the gnulib directory
> isn't included in the binutils tarball.
>
> PR ld/24576
> * ldfile.c: Include "same-inode.h".
> (ldfile_find_command_file): Change the second argument from bool
> to enum script_open_style. Check if the same linker script file
> appears multiple times by using stat, instead using strcmp.
> (ldfile_open_command_file_1): Don't check if the same linker
> script file appears multiple times here.
> * same-inode.h: New file. Copied from
> ../gnulib/import/same-inode.h.
Wouldn't this better go in include/, and then also be used by at least
fdmatch(), maybe also getpwd()?
Jan
More information about the Binutils
mailing list