This is the mail archive of the gcc-patches@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] Avoid one unnecessary PLT slot in every GCC created shared library


On Thu, Jan 15, 2004 at 01:31:45PM -0800, Richard Henderson wrote:
> On Thu, Jan 15, 2004 at 08:18:00PM +0100, Jakub Jelinek wrote:
> > At least on IA32/AMD64 I've checked
> > that GCC doesn't de-optimize this back to a PLT call.
> 
> It doesn't?  It's supposed to...

For weak function it is not an optimization IMHO.
But I was surprised that
int baz (void)
{
  extern void foo (void);
  void (*pfoo) (void) = foo;
  pfoo ();
  return 0;
}
leaves with -O2 -fpic on IA32:
...
call    *foo@GOT(%ebx)
...

> > 	* crtstuff.c (frame_dummy, __do_global_ctors_1): Call
> > 	_Jv_RegisterClasses through a function pointer.
> 
> I guess it's ok anyway.

Or should I add __asm ("" : "+r" (register_classes));
to make sure it is really never converted back into PLT call?

	Jakub


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