http://sourceware.org/bugzilla/show_bug.cgi?id=16452
Bug ID: 16452 Summary: ELF executable with weak reference linked with ld causes assertion in ld.so Product: binutils Version: 2.25 (HEAD) Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: brnguyen at nvidia dot com Created attachment 7357 --> http://sourceware.org/bugzilla/attachment.cgi?id=7357&action=edit Reproduction test case The attached reproduction test case builds two DSOs, one linked against pthreads, and one not linked against pthreads, which implement the same interface. It also builds a test application which is linked against the DSO that uses pthreads. To reproduce the bug, the DSO that does not use pthreads is copied over the DSO that uses pthreads, and the test application is run. Using an ld built from commit 08d0cad39e31083cb8a885703604f7b20d359849, this triggers the following assertion on ld.so built from commit 2f10c4d6901e7a4c4ad294cc5bb8ece6547f4f62 as well as ld.so from glibc 2.15-0ubuntu10.5-ppa1 on my Ubuntu 12.04 LTS system: Inconsistency detected by ld.so: dl-version.c: 224: _dl_check_map_versions: Assertion `needed != ((void *)0)' failed! This may be related to bugs #15149 and #12549. Also relevant is Debian bug #728529. This appears to be a regression in ld (though there may be a bug in ld.so as well). I bisected binutils using this reproduction test case to try to narrow down the commit(s) responsible for this regression. Interestingly, ld fails to link the test executable in a commit range between ToT master and binutils_2.22, with the following error messages: /home/brnguyen/build/binutils//ld/ld: /tmp/cc3K1rHK.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5' /home/brnguyen/build/binutils//ld/ld: note: 'pthread_create@@GLIBC_2.2.5' is defined in DSO //lib/x86_64-linux-gnu/libpthread.so.0 so try adding it to the linker command line It appears this link error was introduced by commit b64fb44af4f416fbbbda3de03fcfff61d80c841c ("Also track weak references") and later removed by commit 879707c642925947e156b7ae2169b89f844532cd ("Exclude weak refs when considering whether an --as-needed library is needed"), at which point ld produces an executable which triggers the assertion. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils