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:
w D *UND* __gmon_start__
DF *UND* 01c2 GLIBC_2.2.5
__libc_start_main
gDO *ABS* VER_1 VER_1
gDO *ABS* VER_2 VER_2
00400570 gDF .text 0002 VER_1 sym_ver1
exe-no: file format elf64-x86-64
DYNAMIC SYMBOL TABLE:
w D *UND* __gmon_start__
DF *UND* 01c2 GLIBC_2.2.5
__libc_start_main
gDO *ABS* VER_1 VER_1
gDO *ABS* VER_2 VER_2
004005a0 gDF .text 0002 VER_1 sym_ver1
004005b0 gDF .text 0002 VER_2 sym_ver2
objdump -T lib.so lib-no.so
lib.so: file format elf64-x86-64
DYNAMIC SYMBOL TABLE:
0418 ld .init .init
w D *UND* __gmon_start__
w D *UND*
_Jv_RegisterClasses
w DF *UND* 00c5 GLIBC_2.2.5 __cxa_finalize
gDO *ABS* VER_1 VER_1
gDO *ABS* VER_2 VER_2
0530 gDF .text 0002 VER_1 sym_ver1
0540 gDF .text 0002 VER_2 sym_ver2
lib-no.so: file format elf64-x86-64
DYNAMIC SYMBOL TABLE:
04f0 ld .init .init
w D *UND* __gmon_start__
w D *UND*
_Jv_RegisterClasses
w DF *UND* 00c5 GLIBC_2.2.5 __cxa_finalize
00200910 gD *ABS* Base_end
gDO *ABS* VER_1 VER_1
00200900 gD *ABS* Base_edata
gDO *ABS* VER_2 VER_2
00200900 gD *ABS* Base__bss_start
0610 gDF .text 0002 VER_1 sym_ver1
04f0 gDF .init Base_init
0668 gDF .fini Base_fini
0620 gDF .text 0002 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