This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Avoid one unnecessary PLT slot in every GCC created shared library
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 15 Jan 2004 16:38:23 -0500
- Subject: Re: [PATCH] Avoid one unnecessary PLT slot in every GCC created shared library
- References: <20040115191800.GI6413@sunsite.ms.mff.cuni.cz> <20040115213145.GA21414@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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