This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] PowerPC select_section / unique_section


On Mon, Sep 02, 2002 at 08:57:31PM -0400, David Edelsohn wrote:
> 	To fix the need for GCC to know that it is compiling in PIC mode,
> the linuxppc64 and AIX targets can:
> 
> 1) allow flag_pic to be set on the commandline (creating an artificial
> distinction between PIC and non-PIC object files), or

This is the one we want.  In our case -fpic doesn't mean "position
independent code", as we're always that sort of PIC.  Instead it just
means create code for shared library linking semantics.  Note that
-fpic means both PIC code _and_ shared library code generation on
other targets.  Which is perhaps unfortunate as they are really two
separate issues.

> 2) uniformly set flag_pic (creating problems because of the other uses of
> flag_pic in the compiler), or

No, because then you lose optimization opportunities, as rth pointed
out.

> 3) set and unset flag_pic around calls to the select section and
> default_binds_local_p functions, or
> 
> 4) modify the default select section and default_binds_local_p functions
> to accept a "pic" argument (and override targetm.binds_local_p for
> PowerPC).
> 
> 	I prefer option 4 to allow finer-grained control, allow greater
> compiler optimization opportunities, and use better programming practice.

3) and 4) don't address how gcc should be told to generate code for
shared libraries.  You seem to be assuming some flag other than -fpic
would be used.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]