This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


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

Re: Versioning mess proved!!!


> Cc: Franz.Sirl-kernel@lauterbach.com, philb@gnu.org, howarth@fuse.net,
>         libc-alpha@sourceware.cygnus.com, aj@suse.de
> Reply-To: drepper@cygnus.com (Ulrich Drepper)
> From: Ulrich Drepper <drepper@redhat.com>
> Date: 02 Oct 2000 12:49:41 -0700
> User-Agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Capitol Reef)
> 
> Geoff Keating <geoffk@cygnus.com> writes:
> 
> > Actually, weak symbols don't work at all in executables on x86,
> 
> Yes, the linker simply drops the relocations.  Note that this is the
> perfectly correct behavior unless you specify -rdynamic.  But even
> with -rdynamic the relocations are not there.
> 
> > which is probably why x86 doesn't see this problem.
> 
> Could be.  But this hack to add these additional tests in ld.so is
> still not correct.  I must say I still don't understand what the
> actual problem is.  Why do we see a crash?  If the symbol is available
> the GLOB_DAT relocation returns zero and the function shouldn't be
> called at all. 

(I assume you meant 'not available'.)

That is the problem.  The GLOB_DAT relocation is being pointed at the
PLT entry in the executable, even if the symbol is not defined
anywhere.

> Since you see a crash there must be a definition and
> the PLT usage fails (at least I think this is was fails).  But where
> does the PLT address point to?  Zero?  If yes, why are the GLOB and
> PLT relocation leading to different results?

That's what the code I quoted does.  When an application has a PLT
entry for a symbol, the symbol's value is the address of the PLT
entry.  This is to make function pointers the same between
applications and shared libraries.  This should not happen if the
symbol is weak and never defined anywhere, because the PLT entry will
not be at location 0.

-- 
- Geoffrey Keating <geoffk@cygnus.com>

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