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: elf_link_check_versioned_symbol


On Fri, Jun 21, 2002 at 04:10:22PM +0930, Alan Modra wrote:
> Hi H.J.,
>   I've tidied up one of your binutils patches that hasn't been
> applied to sourceware, and I'd like you to check that the changes
> are OK.  The main functional difference I made is that
> elf_link_check_versioned_symbol now counts the number of matching
> versioned symbols, as ld.so does.
> 

The change is wrong. Here is a testcase. Now I got

# make
gcc -B./    -c -o foo.o foo.c
gcc: file path prefix `./' never used
gcc -B./ -fPIC -c b.c
gcc: file path prefix `./' never used
gcc -B./ -fPIC -c a.c
gcc: file path prefix `./' never used
gcc -B./ -fPIC -c c.c
gcc: file path prefix `./' never used
gcc -B./ -shared -o lib-c.so c.o
gcc: file path prefix `./' never used
gcc -B./ -shared -o lib-a.so a.o lib-c.so
gcc: file path prefix `./' never used
gcc -B./ -shared -o lib-b.so b.o `pwd`/lib-a.so
gcc: file path prefix `./' never used
gcc -B./ -o foo foo.o -Wl,-rpath,. lib-b.so
gcc: file path prefix `./' never used
gcc -B./ -fPIC -c c1.c
gcc: file path prefix `./' never used
gcc -B./ -Wl,-soname,lib-c.so -Wl,--version-script=c.map -shared -o lib-c1.so
c1
.o
gcc: file path prefix `./' never used
gcc -B./ -fPIC -c c2.c
gcc: file path prefix `./' never used
gcc -B./ -Wl,-soname,lib-c.so -Wl,--version-script=c.map -shared -o lib-c2.so
c2
.o
gcc: file path prefix `./' never used
./foo
bar
cp lib-c1.so lib-c.so
gcc -B./ -o default foo.o -Wl,-rpath,. lib-b.so
gcc: file path prefix `./' never used
./foo
bar VERS.0
cp lib-c2.so lib-c.so
gcc -B./ -o default foo.o -Wl,-rpath,. lib-b.so
/home/hjl/bugs/gas/needed.3/lib-a.so: undefined reference to `bar'
collect2: ld returned 1 exit status
gcc: file path prefix `./' never used

You missed:

              if ((verstab[symidx] & 0x7fff) 
                  >= ((flags & DL_LOOKUP_RETURN_NEWEST) ? 2 : 3)) 

An unversioned reference can be resolved by the oldest version. The
rest of code is ok although I prefer to keep the error message instead
of abort () just in case. If you want, I can submit a new working
patch.


H.J.

Attachment: bug.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]