This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] powerpc64: prevent '__PIC__ redefined' messages
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. This patch is based on one against
> > > the 3.2 branch (not in CVS) from Alan Modra.
> > >
> > > Tested on powerpc64-linux with a cross compiler (c,c++,f77) and
> > > 64-bit bootstrap. Those used to get hundreds of warnings about __PIC__
> > > being redefined; those are now gone, and test results had no change.
> > >
> > > OK for the mainline and the 3.3 branch?
> >
> > We're trying to move in the other direction, that is not use specs and
> > do use builtin_define. Could you instead turn the __PIC__ definition
> > in CPP_SYSV_SPEC into a builtin_define in rs6000_cpu_cpp_builtins?
> > There is no need to conditionalise it on operating system, it will do
> > AIX no harm.
> >
> > (This sort of problem is the reason why we want to use builtin_define.
> > Handling defaults in specs is a lot of work and very error-prone.)
>
> 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?
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".
> The only place it's ever examined only checks to
> see whether it is defined, not what value it has, and it checks for
> either __PIC__ or __pic__.
I disbelieve that you've audited every piece of code that is compiled
for powerpc ELF.
> Would it be OK to just change the existing specs to merely define
> __PIC__ and __pic__, rather than give them values?
No.
> You changed the spec for -fPIC last June;
I didn't change the spec itself, I deleted the lines below and so
moved the closing quote up.
> is there a reason the values are needed?
Compatibilty with existing code, and to distinguish -fpic and -fPIC.
--
- Geoffrey Keating <geoffk@geoffk.org>