Extract an archive member to satisfy a DSO undef

Alan Modra amodra@gmail.com
Sat Aug 14 07:31:52 GMT 2021

My history of computing is quite rusty, but I believe static archives
predated shared libraries.  Given that, and the fact that when linking
against -lfoo a user does not necessarily know whether libfoo.a or
libfoo.so exists, I would say reasonable linker behaviour for shared
libraries should as closely as possible mimic that for static

Since linking "some.o -lfoo -lbar" with a typical unix linker will
extract archive elements from libbar.a to satisfy an undefined
reference from an archive element extracted from libfoo.a, I would
expect libfoo.so undefined symbols to similarly cause elements to be
extracted from libbar.a.  Anything else is surprising.

Alan Modra
Australia Development Lab, IBM

More information about the Binutils mailing list