This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: gcc corrections for better pie support
- From: "Peter S. Mazinger" <ps dot m at gmx dot net>
- To: Richard Sandiford <rsandifo at redhat dot com>
- Cc: Thiemo Seufer <ica2_ts at csv dot ica dot uni-stuttgart dot de>,Zack Weinberg <zack at codesourcery dot com>, <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 10 Nov 2004 13:55:23 +0100 (CET)
- Subject: Re: gcc corrections for better pie support
On Wed, 10 Nov 2004, Richard Sandiford wrote:
> "Peter S. Mazinger" <ps.m@gmx.net> writes:
> > On Wed, 10 Nov 2004, Richard Sandiford wrote:
> >> Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de> 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.
true for all archs
>
> FWIW (in case this is what you're suggesting) I think making uclibc
> targets generate PIE by default would be a mistake.
No, I don't suggest that, it would be too troublesome to have it like that
(many text relocations on other archs where PIC is not default)
>
> 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
> TARGET_OS_CPP_BUILTINS definition with TARGET_ABICALLS.
what to do w/ lines 52-54, MASK_ABICALLS (comment and define)
Peter
>
> - Make the assembler spec pass -KPIC unless -mno-abicalls is used.
>
> Richard
>
>
--
Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2