This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Mon, Dec 30, 2002 at 08:28:37PM +0100, Jakub Jelinek wrote: > > Do you have a testcase for that? > > Of course: > > cat > lib.c <<EOF > int y = 12; > asm (".symver y, x@VERS_1"); > extern int x; > void foo (void) > { > x = 24; > } > EOF > cat > lib.map <<EOF > VERS_1 { > global: x; foo; > local: *; > }; > EOF > gcc -shared -O2 -fpic -o lib.so lib.c -Wl,-version-script,lib.map > > This is basically what you tried in your today's errno.c patch. > The purpose of the code is > a) to make x unavailable for newly linked programs > b) for already linked binaries which have R_*_COPY relocs against > x@VERS_1, modify the variable in binary's .dynbss, not actually > y in the shared library It works for me. Here is a testcase: # make /usr/gcc-3.2/bin/gcc -fPIC -c loser.c /usr/gcc-3.2/bin/gcc -shared -o loser.so loser.o -Wl,--version-script=loser.v /usr/gcc-3.2/bin/gcc -o foo loser.so foo.c -Wl,-rpath,. ./foo 12 12 24 20 20 24 /usr/gcc-3.2/bin/gcc -shared -o loser.so loser.c -DNEW -Wl,--version-script=loser.v ./foo 12 12 24 20 20 24 /usr/gcc-3.2/bin/gcc loser.so foo.c -Wl,-rpath,. /tmp/ccErEs1j.o(.text+0x11): In function `main': : undefined reference to `x' /tmp/ccErEs1j.o(.text+0x3b): In function `main': : undefined reference to `x' /tmp/ccErEs1j.o(.text+0x51): In function `main': : undefined reference to `x' /tmp/ccErEs1j.o(.text+0x5a): In function `main': : undefined reference to `x' /tmp/ccErEs1j.o(.text+0x84): In function `main': : undefined reference to `x' collect2: ld returned 1 exit status make: *** [all] Error 1 Did I miss something? H.J.
Attachment:
b.tar.gz
Description: GNU Zip compressed data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |