[PATCH] ld: don't use SAME_INODE for the duplicate-script check on hosts without inodes

Cole Munz Munzzyy1@proton.me
Tue Aug 18 06:30:59 GMT 2026


On Tue, Aug 18, 2026 at 03:30:44PM +0930, Alan Modra wrote:
> That says there is a bug in SAME_INODE, and in upstream gnulib too.
> I will apply the following.

Agreed, and that is the right layer for it. I tested the two macros side by
side:

  two different files on D: (st_ino 0, st_dev 3)
     old -> 1   treats them as the same file
     new -> 0   correct
  two different files on drive 0 (st_ino 0, st_dev 0)
     old -> 0   new -> 0
  same file, real inode info
     old -> 1   new -> 1   still detects real duplicates
  different files, real inode info
     old -> 0   new -> 0

So it removes the false positive without weakening the case where inodes
work.

One consequence worth a decision. Once SAME_INODE is false whenever st_ino
is 0, ld's PR 24576 check goes inert on native Windows, so someone who does
pass the same script twice there gets no diagnostic at all. My patch kept
that check alive on such hosts by falling back to a name comparison when
stat gives nothing usable.

Either is defensible. Drop my ld patch and let PR 24576 only cover hosts
with real inodes, or take same-inode.h plus the name fallback and keep the
diagnostic everywhere. I have no preference, I just did not want the check
to go quiet as a side effect rather than as a choice.

Cole



More information about the Binutils mailing list