-fPIC changes sizeof class

Andrew Haley aph@redhat.com
Mon Aug 10 15:40:00 GMT 2009


Alan M. Carroll wrote:
> At 04:05 AM 8/10/2009, Andrew Haley wrote:
>>> According to the documentation[1] this flag shouldn't have any
>>> effect at all because I am building for 64 bit Intel.
>> I can't find that reference.  Can you please quote the section to
>> which you are referring?
>
> http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Code-Gen-Options.html#Code-Gen-Options
>
> -fPIC

> If supported for the target machine, emit position-independent code,
> suitable for dynamic linking and avoiding any limit on the size of
> the global offset table. This option makes a difference on the m68k,
> PowerPC and SPARC.

It means that -fpic and ifPIC are different on 68k, ppc, and sparc.

PIC of some form, whether -fpic or -fPIC, is needed for DSOs on all
targets.

> Position-independent code requires special support, and therefore works only on certain machines.
>
> When this flag is set, the macros __pic__ and __PIC__ are defined to 2.
>
>> I can't see why the size of a class should change.
>
> Is the behavior sufficiently anomalous that it would be worth generating a smaller example?
>

Yes.

Andrew.



More information about the Gcc-help mailing list