This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: PATCH: Optimize protected call for i386


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


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