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]

Re: How should the GNU linker treat weak references?


Alan Modra <amodra@bigpond.net.au> writes:

> If the libfoo.so
> foo should override foo.o foo even in this case, then ld needs to emit
> dynamic relocations for all references to weak syms.

I think it's probable that ld must emit dynamic relocations for all
references to weak symbols (assuming some shared libraries are
involved in the link).  That is, any undefined reference which is
satisfied by a weak symbol should have a dynamic reloc.  If we don't
do that, then if the dynamic linker brings in a shared library with a
strong definition, the dynamic linker will link some references to the
strong definition while the program linker will have left some
references linked to the weak definition.

What are the drawbacks if we do that?  If the symbol is a variable
rather than a function, we may wind up with dynamic relocs in the text
segment of the main program, which would be highly undesirable.  Hmmm.

What does the Solaris linker do?

Ian


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