Bug#591405: gcc-4.4/g++-4.4: link failure with -Wl, -no-add-needed: "invalid DSO for symbol `pthread_cancel@@GLIBC_2.0' definition"
reassign 591405 binutils
found 591405 2.20.1-12
fixed 591405 2.20.51.20100710-2
tag 591405 upstream
retitle ld: -no-add-needed breaks linking with weak symbols
thanks
On Fri, Aug 06, 2010 at 08:11:46PM +0400, Kirill Smelkov wrote:
> After upgrading binutils to 2.20.51.20100710-2 from experimental, the
> problem goes away:
>
> $ g++ -v 2>&1 | grep "gcc version"
> gcc version 4.4.4 (Debian 4.4.4-7)
> $ ld -v
> GNU ld (GNU Binutils for Debian) 2.20.51-system.20100710
> $ make
> g++ -Wl,-no-add-needed -shared -o lpthread.so -lpthread
> g++ -Wl,-no-add-needed -o deb591405 deb591405.cpp lpthread.so
> $ LD_LIBRARY_PATH=`pwd` ./deb591405
> I hope Debian bug #591405 has been fixed!
>
>
> So in fact this seems to be linker issue.
So it's ld issue, and it fails for 2.20.1-12 and works for
2.20.51.20100710-2, so I took upstream repo and bisected it and found
that commit after which it works is
commit f52ff3cba39902ccfea13e49267d6f14dfc1f6f6
Author: Nick Clifton <nickc@redhat.com>
Date: Thu Jan 21 14:54:40 2010 +0000
* elflink.c (elf_link_add_object_symbols): Look up name of
undefined symbol both before and after versioning has been
applied. Do not bother with symbols that are weakly undefined.
Will try to backport...
Reply to: