https://sourceware.org/bugzilla/show_bug.cgi?id=24600
--- Comment #4 from Fangrui Song <i at maskray dot me> --- (In reply to Florian Weimer from comment #3) > With .a archives, BFD ld binds symbol references to the same archive even if > they are available from other archives earlier on the command line. Should > this behavior apply to --start-lib/--end-lib as well? The following example demonstrates this scenario where GNU ld and LLD exhibit different behavior. The linker first extracts b.a(b0.o) to resolve the undefined foo. GNU ld proceeds to extract b.a(b1.o) to resolve the dup symbol LLD instead extracts a.a(a.o). Notably, the --warn-backrefs flag fails to detect this behavioral difference as a potential issue. >From a practical standpoint, both approaches work equally well. # RUN: rm -rf %t && split-file %s %t && cd %t # RUN: as main.s -o main.o # RUN: as a.s -o a.o # RUN: as b0.s -o b0.o # RUN: as b1.s -o b1.o # RUN: ar rc a.a a.o # RUN: ar rc b.a b0.o b1.o # bind to ret # RUN: ld.bfd main.o a.a b.a # RUN: gold main.o --start-lib a.o --end-lib --start-lib b0.o b1.o --end-lib # bind to hlt # RUN: ld.lld --fatal-warnings --warn-backrefs main.o a.a b.a # RUN: ld.lld main.o --start-lib a.o --end-lib --start-lib b0.o b1.o --end-lib #--- main.s .globl _start _start: call foo #--- a.s .globl dup; dup: hlt #--- b0.s .globl foo; foo: call dup #--- b1.s .globl dup; dup: ret -- You are receiving this mail because: You are on the CC list for the bug.