[parisc-linux] Re: [RFC] Emit OPD reloc for all global symbols and then some.

Carlos O'Donell carlos@systemhalted.org
Mon Jun 20 21:29:00 GMT 2005


On Mon, Jun 20, 2005 at 01:40:56PM -0700, H. J. Lu wrote:
> On Mon, Jun 20, 2005 at 04:26:25PM -0400, John David Anglin wrote:
> > > > Under hppa-linux:
> > > > ------------------
> > > > We want to generate a PLABEL32 (OPD reloc) against all global symbols,
> > > > and then some. For example it should be possible for an application to
> > > > call dlsym asking for the address of main, and when compared to main it
> > > > should match.
> > > > 
> > > 
> > > Does it work on Linux/ia32? If not, why should it work on Linux/hppa?
> > 
> > The linux manpage for dlsym indicates that symbols in the main
> > program can be looked up with dlsym:
> > 
> >      If filename is a NULL pointer, then the returned handle is
> >      for the main program.  When given to dlsym(), this  handle
> >      causes a search for a symbol in the main program, followed
> >      by all shared libraries loaded  at  program  startup,  and
> >      then all shared libraries loaded by dlopen() with the flag
> >      RTLD_GLOBAL.
> > 
> > So, if it doesn't work, that would seem to be a bug in Linux/ia32.
> 
> It works if the global symbol is exported. But not all global symbols
> in main are exported by default. You can use --export-dynamic to export
> all global symbols.

Regardless of wether or not I export all global symbols in main, I must
still emit OPD relocs in the executable for all dynamic symbols. In the
past the OPD reloc was "fudged" and pointed at the PLT, and this is not
a satisfactory situation. I want ld.so.1 to generate the OPD so we no
longer need gcc to emit the __cffc helper function for comparisons.

I owe you a big thank you for writing the generic function
descriptor code in glibc, since hppa is also using that code :)

c.



More information about the Binutils mailing list