Basically, as soon as you have a version script with a { local: *; } wildcard, the symbols from other versions are *not* exported in executables built for back-linking.
Attached is a tarball with a simple test case for the issue. Right now running make shows the following output. The issue being obviously that there is no `VER_2 sym_ver2` in the executable linked with a version script using local wildcards, OTOH a shared object obviously has the expected results. Using explicit versioning from the C source using internal symbols (e.g. internal_sym_ver{1,2}) with asm(".symver internal_sym_ver2,sym_ver2@@VER_2") fails in the same way. ===================================================== $ make gcc -rdynamic -DMAIN -Wl,--version-script=local.ver -O2 -Wall -Wextra -o exe test.c gcc -rdynamic -DMAIN -Wl,--version-script=nolocal.ver -O2 -Wall -Wextra -o exe-no test.c gcc -shared -fPIC -Wl,--version-script=local.ver -O2 -Wall -Wextra -o lib.so test.c gcc -shared -fPIC -Wl,--version-script=nolocal.ver -O2 -Wall -Wextra -o lib-no.so test.c objdump -T exe exe-no exe: file format elf64-x86-64 DYNAMIC SYMBOL TABLE: 0000000000000000 w D *UND* 0000000000000000 __gmon_start__ 0000000000000000 DF *UND* 00000000000001c2 GLIBC_2.2.5 __libc_start_main 0000000000000000 g DO *ABS* 0000000000000000 VER_1 VER_1 0000000000000000 g DO *ABS* 0000000000000000 VER_2 VER_2 0000000000400570 g DF .text 0000000000000002 VER_1 sym_ver1 exe-no: file format elf64-x86-64 DYNAMIC SYMBOL TABLE: 0000000000000000 w D *UND* 0000000000000000 __gmon_start__ 0000000000000000 DF *UND* 00000000000001c2 GLIBC_2.2.5 __libc_start_main 0000000000000000 g DO *ABS* 0000000000000000 VER_1 VER_1 0000000000000000 g DO *ABS* 0000000000000000 VER_2 VER_2 00000000004005a0 g DF .text 0000000000000002 VER_1 sym_ver1 00000000004005b0 g DF .text 0000000000000002 VER_2 sym_ver2 objdump -T lib.so lib-no.so lib.so: file format elf64-x86-64 DYNAMIC SYMBOL TABLE: 0000000000000418 l d .init 0000000000000000 .init 0000000000000000 w D *UND* 0000000000000000 __gmon_start__ 0000000000000000 w D *UND* 0000000000000000 _Jv_RegisterClasses 0000000000000000 w DF *UND* 00000000000000c5 GLIBC_2.2.5 __cxa_finalize 0000000000000000 g DO *ABS* 0000000000000000 VER_1 VER_1 0000000000000000 g DO *ABS* 0000000000000000 VER_2 VER_2 0000000000000530 g DF .text 0000000000000002 VER_1 sym_ver1 0000000000000540 g DF .text 0000000000000002 VER_2 sym_ver2 lib-no.so: file format elf64-x86-64 DYNAMIC SYMBOL TABLE: 00000000000004f0 l d .init 0000000000000000 .init 0000000000000000 w D *UND* 0000000000000000 __gmon_start__ 0000000000000000 w D *UND* 0000000000000000 _Jv_RegisterClasses 0000000000000000 w DF *UND* 00000000000000c5 GLIBC_2.2.5 __cxa_finalize 0000000000200910 g D *ABS* 0000000000000000 Base _end 0000000000000000 g DO *ABS* 0000000000000000 VER_1 VER_1 0000000000200900 g D *ABS* 0000000000000000 Base _edata 0000000000000000 g DO *ABS* 0000000000000000 VER_2 VER_2 0000000000200900 g D *ABS* 0000000000000000 Base __bss_start 0000000000000610 g DF .text 0000000000000002 VER_1 sym_ver1 00000000000004f0 g DF .init 0000000000000000 Base _init 0000000000000668 g DF .fini 0000000000000000 Base _fini 0000000000000620 g DF .text 0000000000000002 VER_2 sym_ver2 ===================================================== ld --version GNU ld (GNU Binutils for Debian) 2.18.0.20080103 -- Summary: local wildcard breaks versioning scripts for -rdynamic executables Product: binutils Version: 2.18 Status: NEW Severity: normal Priority: P2 Component: ld AssignedTo: unassigned at sources dot redhat dot com ReportedBy: madcoder at debian dot org CC: bug-binutils at gnu dot org http://sourceware.org/bugzilla/show_bug.cgi?id=6022 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils