We recently moved from GNU ld to LLVM ld and
comes across the scenario like archive.a has the objects file with same strong symbol “foo” in two object files like strong1.o (in data) and strong2.o(in bss)
and archive processing goes like
ref1.o (has some defs and requires strong symbol name like “bar”(undefined))
strong1.o(Has the “foo” definition adds the foo lazy definition to symbol) and not sure why ld.lld picks it from archive …at this point …we don’t have any reference to “foo” or any other definitions of strong1.o.
ref2.o (Refers sym like “foo” and so its reference binds to strong1.o(foo))
strong2.o (has definition for “foo” and “bar”) and ld.lld error out with here multiple definitions for “foo” .
In GNU ld case , it pick the list like ref1.o then ref2.o and strong2.o and linkage goes without error .
We can refactor the our archive in this case to work by having one strong symbol “foo” in archive or we have any way to back out this lazy definition sym resolution within archive in ld.lld ?
Thank you