[PATCH] powerpc64: prevent '__PIC__ redefined' messages

Janis Johnson janis187@us.ibm.com
Tue Jan 14 17:23:00 GMT 2003


On Mon, Jan 13, 2003 at 05:36:58PM -0800, Geoff Keating wrote:
> Janis Johnson <janis187@us.ibm.com> writes:
> 
> > On Fri, Jan 10, 2003 at 03:16:10PM -0800, Geoff Keating wrote:
> > > Janis Johnson <janis187@us.ibm.com> writes:
> > > 
> > > > GCC always generates PIC code for powerpc64-linux.  __PIC__ is always
> > > > defined, and the options -fPIC and -fpic define it again, causing
> > > > warnings about the redefinition.
[snip]
> > > 
> > Geoff,
> > 
> > config/rs6000/linux64.h already has "builtin_define ("__PIC__");".  The
> > problem is that the specs in sysv4.h redefine it to 1 or 2 if -fpic or
> > -fPIC is specified.
> 
> Yes.  Is that 'undefined/1/2' not what you want?  Why not?

Never mind, I now see how it can be done the way you suggested while
avoiding redefinitions when -fpic and -fPIC are used.

> If you're thinking that all code for powerpc64 is position
> independent, note that __PIC__ doesn't mean that.  It means "this is a
> shared library".

__PIC__ is defined by default in linux64.h; should it continue to be
defined by default?  I was only planning to avoid the redefinition.

> I disbelieve that you've audited every piece of code that is compiled
> for powerpc ELF.

Yeah, major brain fart, which was also the cause of the rest of my
ramblings.  I had only looked in the GCC sources, forgetting that
predefined symbols are, of course, available to be used elsewhere.

Are the meaning and uses of __PIC__ and __pic__ documented somewhere?
I looked in the _64-bit_PowerPC_ELF_ABI_Supplement_, but don't have
the general PowerPC ABI.

Janis



More information about the Gcc-patches mailing list