Re: Weak symbols not overriden

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pan ruochen <panruochen@xxxxxxxxx> writes:

> I found weak symbols wouldn't be overriden by the strong symbols with
> same names.

This case, involving shared libraries, actually has nothing to do with
either gcc or the binutils.  It's the dynamic linker that matters here,
and that is part of the C library.  You didn't say, but I'm guessing
that you are using GNU/Linux and glibc.  By default, the glibc dynamic
linker uses the first definition it finds even if it is weak.  That is
because overriding a weak symbol is rare, and would require the dynamic
linker to search all the remaining shared libraries.

You can get the behaviour you want by defining the environment variable
LD_DYNAMIC_WEAK.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux