Hi Ian, Yes, setting the environment LD_DYNAMIC_WEAK did work. Now I get another question about weak symbols of glibc. I find there are some symbols with the same names existing both in libc and in libpthread. All these symbols are weak. I guess the libpthread provides multi-threading safe functions rather than libc provides single-threading versions. But since all these symbols are weak, how the dynamic loader choose the symbol in libpthread if libpthread is linked against the application? $nm -D libpthread.so.0 | grep '\<sendto\>' 00010d54 W sendto $nm -D libc-2.8.so | grep '\<sendto\>' 000e0704 W sendto PRC Mar 18,2011 2011/3/18, Ian Lance Taylor <iant@xxxxxxxxxx>: > 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 >