This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Optimize protected call for i386
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 15 May 2003 08:32:53 +0930
- Subject: Re: PATCH: Optimize protected call for i386
- References: <20030513013909.GQ2166@bubble.sa.bigpond.net.au> <20030512184927.A14308@lucon.org> <20030513015330.GR2166@bubble.sa.bigpond.net.au> <20030512185613.A14533@lucon.org> <20030513020400.GS2166@bubble.sa.bigpond.net.au> <20030512192302.A14731@lucon.org> <20030513135912.GA966@bubble.sa.bigpond.net.au> <20030513142716.A20059@lucon.org> <20030514085453.GA957@bubble.sa.bigpond.net.au> <20030514074940.A2376@lucon.org>
On Wed, May 14, 2003 at 07:49:40AM -0700, H. J. Lu wrote:
> On Wed, May 14, 2003 at 06:24:53PM +0930, Alan Modra wrote:
> > On Tue, May 13, 2003 at 02:27:16PM -0700, H. J. Lu wrote:
> > > How about this patch? It added a new relocation type R_386_PC32_DATA
> > > to distinguish PC relative data reference from PC relative branch.
> >
> > I think it's going to a lot of work just to support non-PIC shared
> > libs. I don't think it's worth bothering really.
>
> The current gcc won't use PIC for calls to protected functions. It
> expects linker will resolve it directly.
I see. I think this is wrong. gcc needs to emit the normal PIC call,
ie. "call foo@PLT" so the the linker can set up a plt entry if
needed. A plt entry is needed for protected symbols so that function
pointer comparisons work, since the x86 ABI uses the .plt entry for
the value of a function symbol referenced by a dynamic object.
Consider liba.so exporting a protected symbol foo. Will a function
pointer, value foo, passed to libb.so compare equal to &foo in
libb.so? What about a function pointer, value foo, passed from
libb.so back to liba.so?
--
Alan Modra
IBM OzLabs - Linux Technology Centre