This is the mail archive of the 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: gcc corrections for better pie support

"Peter S. Mazinger" <> writes:
> On Wed, 10 Nov 2004, Richard Sandiford wrote:
>> Thiemo Seufer <> writes:
>> > Richard Sandiford wrote:
>> >> So the current handling of __PIC__ is inconsistent.  What does it mean
>> >> for mips*-linux-gnu targets?  Does it mean:
>> >> 
>> >>    (1) That position independent code has been explicitly selected?
>> >>        If so, then flag_pie || flag_shlib seems like the right condition.
>> >> 
>> >>    (2) That abicalls code is selected?  If so, then the current specs are
>> >>        wrong, because "gcc -fno-pic" generates abicalls code.
>> >> 
>> >> But I suppose the current definition is closest to (2).  If (2) is indeed
>> >> what we want, then another alternative would be to guard the __PIC__
>> >> definition in linux.h with TARGET_ABICALLS.
>> >
>> > Currently in use on MIPS linux are:
>> >  - PIC + abicalls for the whole userland. __PIC__ is always expected to
>> >    be defined. Executables are always PIC. This is the toolchain default.
>> Executables are created from position-independent objects, but the
>> executables themselves are not PIC.  They have a fixed load address
>> and are not relocatable.  Hence...
> This is not quite true, I have access to a mips box running uclibc and I 
> can build PIE executables, these are relocatable (I know though that such 
> test can't be done on glibc, because it fails w/ undefs)

I was talking specifically about the default here, not what happens when
you use -fpie or -fPIE (note the highlighted context).  It _is_ true that
mips*-linux-gnu does not create position-independent executables by default.

FWIW (in case this is what you're suggesting) I think making uclibc
targets generate PIE by default would be a mistake.

Anyway (and thanks to Thiemo for his reply), it looks like we're getting
close agreement on the __PIC__=abicalls thing.  Going back to your patch,
I think the summary is:

  - Remove the __PIC__ handling from spec strings and guard the

  - Make the assembler spec pass -KPIC unless -mno-abicalls is used.


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