[Bug ld/6022] New: local wildcard breaks versioning scripts for -rdynamic executables

2008-04-02 Thread madcoder at debian dot org
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


[Bug ld/6022] local wildcard breaks versioning scripts for -rdynamic executables

2008-04-02 Thread madcoder at debian dot org

--- Additional Comments From madcoder at debian dot org  2008-04-02 10:20 
---
Created an attachment (id=2344)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2344&action=view)
tarball with a makefile, a simple source, and two version scripts


-- 


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


[Bug ld/6022] local wildcard breaks versioning scripts for -rdynamic executables

2008-04-02 Thread madcoder at debian dot org

--- Additional Comments From madcoder at debian dot org  2008-04-02 10:28 
---
Further fiddling with the issue shows that local: * works properly if you put 
it in the _last_ version section of the version script. E.g. a script like:

-8<
VER_1 {
global:
sym_ver1;
};
VER_2 {
global:
sym_ver1;
local:
*;
} VER_1;
->8

or even:

-8<
VER_1 {
global:
sym_ver1;
};
VER_2 {
global:
sym_ver1;
} VER_1;
PRIVATE {
local:
*;
};
->8

product the expected results. If you put PRIVATE { local: *; }; first, it 
breaks.

-- 


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