Get rid of weak symbols in static objects

Momchil Velikov velco@fadata.bg
Wed Nov 26 15:38:00 GMT 2003


>>>>> "Ian" == Ian Lance Taylor <ian@wasabisystems.com> writes:

Ian> Momchil Velikov <velco@fadata.bg> writes:
>> >>>>> "Alan" == Alan Modra <amodra@bigpond.net.au> writes:
>> 
Alan> On Wed, Nov 26, 2003 at 12:22:34PM +0200, Momchil Velikov wrote:
>> >> * elflink.h (elf_link_output_extsym): Do not output weak symbols
>> >> in statically linked objects.
>> 
Alan> Also not OK.  What is wrong with leaving the symbols as they are
Alan> currently? 
>> 
>> I find useful to maintain the following invariant:
>> 
>> "Statically linked executables do not contain undefined symbols
>> (unless --noinhibit-exec is given)."

Ian> Why is that useful?

  It roughly useful by the same reasons dead code elimination is
useful.  Besides the generally good idea of being permissive in what
you accept, but strict in what you output.

>> From my point of view a weak undefined symbol which never sees a
Ian> definition really is undefined.  The linker resolves it as though it
Ian> has the value zero, but the linker never defines it in the usual
Ian> sense.

  IMHO, it defines them exactly in the usual sense -- having a value
to perform relocations with.

~velco



More information about the Binutils mailing list