This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: static lib drops objects with side-effects


On Tue, Feb 11, 2003 at 12:04:50AM -0800, Zack Weinberg wrote:
> This reminds me that I have wanted for some time to complain about the
> converse behavior: if you are using shared objects and you put say -lm
> on the link line, a NEEDED entry for libm.so will appear in the linked
> object even if libm.so doesn't satisfy undefined symbol references.  I
> consider this to be wrong, because people tend to throw libraries onto
> their link lines just because they exist, assuming that ld will ignore
> them if they don't provide any useful symbols.

We could do that, I guess, by having elf_link_add_object_symbols
notice when a symbol from a shared lib satisfies a reference from a
regular object.  Hmm, might be a little tricky, given that objects can
be specified after shared libs.  We can't rearrange the link order to
place shared libs last since archives might be specified after shared
libs, and we generally don't want to pull objects out of an archive if
a reference can be satisfied by a shared lib.  size_dynamic_sections
might be a better place to analyse symbols.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]