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]

Re: PACTH: Fix duplicated version (Re: A symbol version bug?)


On Sat, Jul 13, 2002 at 07:56:44PM -0700, H. J. Lu wrote:
> On Fri, Jul 12, 2002 at 10:43:33PM -0700, H. J. Lu wrote:
> > On Fri, Jul 12, 2002 at 08:51:03PM -0700, H. J. Lu wrote:
> > > I got
> > > 
> > > # make
> > > cc -fPIC -c c1.c
> > > cc -fPIC -c c2.c
> > > ld --version-script=c.map -shared -o lib-c1.so c1.o c2.o
> > > objdump --dynamic-sym lib-c1.so| grep bar
> > > 00000264 g    DF .text  0000000a  VERS.0      bar
> > > 00000258 g    DF .text  0000000a (VERS.0)     bar
> > > 
> > > I am expecting
> > > 
> > 
> > Corretion. I am expecting a fatal error.
> > 
> 
> Here is the patch. Now I got
> 
> /export/build/gnu/binutils-debug/build-full-i686-linux/ld/ld-new -soname
> lib-c.so --version-script=c.map -shared -o lib-c1.so c1.o c2.o
> /export/build/gnu/binutils-debug/build-full-i686-linux/ld/ld-new: foo (c2.o):
> duplicated versioned symbol: foo@VERS.0 (c1.o)
> /export/build/gnu/binutils-debug/build-full-i686-linux/ld/ld-new: failed to set
> dynamic section sizes: Bad value
> 

Second thought. I think it should work. Here is the new patch and a
testcase. Now I got:

# make
cc    -c -o foo.o foo.c
cc    -c -o c0.o c0.c
cc -Wl,-soname,lib-c.so -shared -o lib-c.so c0.o
cc -o foo -Wl,-rpath,. foo.o lib-c.so
cc -fPIC -c c1.c
cc -fPIC -c c2.c
/export/build/gnu/binutils-debug/build-full-i686-linux/ld/ld-new -soname
lib-c.so --version-script=c.map -shared -o lib-c1.so c1.o c2.o
/export/build/gnu/binutils-debug/build-full-i686-linux/ld/ld-new -soname lib-c.so --version-script=c.map -shared -o lib-c2.so c2.o c1.o
objdump --dynamic-sym lib-c1.so | grep VER
00000280 g    DF .text  00000021 (VERS.0)     foo
00000000 g    DO *ABS*  00000000  VERS.0      VERS.0
0000025c g    DF .text  00000021 (VERS.0)     bar
objdump --dynamic-sym lib-c2.so | grep VER
0000028c g    DF .text  00000021 (VERS.0)     foo
00000000 g    DO *ABS*  00000000  VERS.0      VERS.0
00000268 g    DF .text  00000021 (VERS.0)     bar
./foo
bar: 0
foo: 0
cp lib-c1.so lib-c.so
./foo
bar: 1
foo: 2
cp lib-c2.so lib-c.so
./foo
bar: 1
foo: 2

Jack, please try this to see if gcc 2.95.4 works without any glibc
changes.


H.J.

Attachment: bug.tar.gz
Description: GNU Zip compressed data

Attachment: bfd-version-dup.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]