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 Sat, Jun 22, 2002 at 08:11:47PM +0930, Alan Modra wrote:
> On Fri, Jun 21, 2002 at 09:40:23AM -0700, H . J . Lu wrote:
> > 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.
> 
> The code you use in your binutils doesn't check for multiple
> VERSYM_HIDDEN symbols.  That seems wrong to me, since as far as I can
> see, ld.so will do so in certain cases.
> 
> I didn't exactly miss that code in elf/do-lookup.h;  I looked at it
> and chose to use the comparison against 2.  On looking again, I see
> that ld.so doesn't set DL_LOOKUP_RETURN_NEWEST, so the right thing to
> do is return success on finding a version 2 sym, and count syms with
> versions >= 3.  That will make both your testcases work, and match
> ld.so behaviour.
> 

Your change is still wrong. Here is a new testcase:

...
cp lib-c3.so lib-c.so
gcc -B./ -o default foo.o -Wl,-rpath,. lib-b.so
gcc: file path prefix `./' never used
./foo
./foo: relocation error: /home/hjl/bugs/gas/needed.3/lib-a.so: undefined
symbol: bar

The versions >= 3 case is handled elsewhere in elflink.h. ld.so won't
match a VERSYM_HIDDEN symbol with an unversioned reference unless the
version is 2. As for num_versions == 1, it is for none-VERSYM_HIDDEN
symol. elflink.h handles it already.

As I said, the rest of code is ok.


H.J.

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]