[PATCH]: Fix PR middle-end/6123, cleanup defining __pic__/__PIC__

Alan Modra amodra@bigpond.net.au
Fri Apr 9 20:06:00 GMT 2004


On Wed, Apr 07, 2004 at 03:03:51AM -0400, Jakub Jelinek wrote:
> ./nptl/sysdeps/pthread/bits/libc-lock.h:#ifdef __PIC__
> ./linuxthreads/sysdeps/pthread/bits/libc-lock.h:# if defined __PIC__ || (defined _LIBC && defined SHARED)
> and these don't pessimize the code when pic, but optimize (without that
> a weak function pointer is loaded from GOT and then going through PLT slot
> if non-NULL, with it it is loaded from GOT and an indirect jump is made
> through it).

Right.  I didn't really analyze the code well enough.  We're not missing
an optimization as I thought, just unnecessarily copying a function
pointer to a temp (which hopefully will be optimized away) in the
non-shared case.  Nevertheless, the test of __PIC__ in these two places
is really about optimizing code for a shared library.

The other place I found __PIC__ in glibc is in ppc64 specific code,
where it does precisely nothing.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Gcc-patches mailing list