This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [RFC] Emit OPD reloc for all global symbols and then some.
- From: "H. J. Lu" <hjl at lucon dot org>
- To: John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>
- Cc: carlos at systemhalted dot org, binutils at sources dot redhat dot com,tausq at debian dot org, dave dot anglin at nrc-cnrc dot gc dot ca,parisc-linux at lists dot parisc-linux dot org
- Date: Mon, 20 Jun 2005 13:40:56 -0700
- Subject: Re: [RFC] Emit OPD reloc for all global symbols and then some.
- References: <20050620191501.GA31614@lucon.org> <200506202026.j5KKQPb7007471@hiauly1.hia.nrc.ca>
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.
H.J.