Bug 882 - Version script doesn't work on executable
Summary: Version script doesn't work on executable
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-27 17:48 UTC by H.J. Lu
Modified: 2005-05-05 17:44 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
A testcase (541 bytes, application/octet-stream)
2005-04-27 17:49 UTC, H.J. Lu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2005-04-27 17:48:10 UTC
We can't use a version script to hide global symbols in executables.
Comment 1 H.J. Lu 2005-04-27 17:49:50 UTC
Created attachment 467 [details]
A testcase

[hjl@gnu version23]$ make CC=gcc
gcc    -c -o main.o main.c
gcc -fPIC   -c -o foo.o foo.c
gcc -o libfoo.so -shared foo.o
gcc -o foo main.o libfoo.so -Wl,-rpath,.,--version-script,main.v
./foo
main: bard_d: 0
main: bard_d: 0
main: bard_d: 0

I am expecting:

[hjl@gnu version23]$ make
gcc -B./    -c -o main.o main.c
gcc -B./ -fPIC	 -c -o foo.o foo.c
gcc -B./ -o libfoo.so -shared foo.o
gcc -B./ -o foo main.o libfoo.so -Wl,-rpath,.,--version-script,main.v
./foo
main: bard_d: 0
DSO: bard_d: -1
main: bard_d: 0
Comment 2 H.J. Lu 2005-05-05 17:44:49 UTC
Fixed with:

http://sourceware.org/ml/binutils/2005-04/msg00822.html