[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/16452] ELF executable with weak reference linked with ld causes
From: |
ldv at altlinux dot org |
Subject: |
[Bug ld/16452] ELF executable with weak reference linked with ld causes assertion in ld.so |
Date: |
Thu, 16 Jan 2014 01:48:08 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=16452
Dmitry V. Levin <ldv at altlinux dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ldv at altlinux dot org
See Also| |https://sourceware.org/bugz
| |illa/show_bug.cgi?id=16457
--- Comment #1 from Dmitry V. Levin <ldv at altlinux dot org> ---
Even more simple test case for this issue:
$ cat libf.c
int f(void){return 0;}
$ cat libf.map
FOO{global:f;};
$ gcc -shared -Wl,-soname,libf.so,--version-script,libf.map -Wall -Werror -fPIC
-o libf.so libf.c
$ gcc -shared -Wl,--no-as-needed,-soname,liba.so -o liba.so -L. -lf
$ cat e.c
int f(void) __attribute__((weak));
int main(void){return f?f():0;}
$ gcc -Wall -Werror -o e e.c -Wl,--no-as-needed,--rpath,. -L. -la
$ gcc -shared -Wl,-soname,liba.so -o liba.so -Wall -Werror -fPIC libf.c
$ ./e
Inconsistency detected by ld.so: dl-version.c: 224: _dl_check_map_versions:
Assertion `needed != ((void *)0)' failed!
This happens because the executable has no DT_NEEDED entry for the library that
defines the versioned symbol, but at the same time the executable has an entry
for that symbol and library in .gnu.version_r section, so, when dynamic linker
sees this unversioned symbol (provided by another library), assertion is
triggered.
--
You are receiving this mail because:
You are on the CC list for the bug.