This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PING][PATCH][1-3] New configure options that make the compiler use -fPIE and -pie as default option
- From: Magnus Granberg <zorry at gentoo dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 09 Jan 2015 21:12:45 +0100
- Subject: Re: [PING][PATCH][1-3] New configure options that make the compiler use -fPIE and -pie as default option
- Authentication-results: sourceware.org; auth=none
- References: <4827012 dot p4mTkPPu1h at laptop1 dot gw dot ume dot nu> <alpine dot DEB dot 2 dot 10 dot 1501091739140 dot 8154 at digraph dot polyomino dot org dot uk> <54B0172E dot 50600 at gmail dot com>
fredag 09 januari 2015 13.00.14 skrev Daniel Micay:
> On 09/01/15 12:49 PM, Joseph Myers wrote:
> > On Fri, 9 Jan 2015, Daniel Micay wrote:
> >>> --with-specs="%{pie|fpic|fPIC|fpie|fPIE|fno-pic|fno-PIC|fno-pie|fno-PIE|
> >>> shared|static|nostdlib|nodefaultlibs|nostartfiles:;:-fPIE -pie}"
> >>>
> >>> at configure time (using CONFIGURE_SPECS).
DRIVER_SELF_SPECS is checkt before CONFIGURE_SPECS. On mips it will have added
-mno-shared before it check CONFIGURE_SPECS. I want to support more targets
later on. Can move the spec to elfos.h.
> >>>
> >>> I have no idea if the above is really the proper spec to use - why
> >>> do you include static, nostdlib, nodefaultlibs and nostartfiles
> >>> for example? Similar, if I say
> >>
> >> PIE isn't supported for static executables by binutils, etc. so it
> >> does need to exclude that. The checks for nostdlib, nodefaultlibs
> >
> > Well - that would indicate excluding -pie if one of the link-time options
> > conflicting with it is used, -fPIE if one of the compile-time options
> > conflicting with it is used. That way, "gcc -static file.c" would still
> > have the same effect as "gcc -c file.c; gcc -static file.o" (building a
> > PIE object, linking it into a non-PIE static executable), which makes
> > logical sense to me (although there may be no great benefit either way).
>
> Sure, I agree. It should have separate lists of exceptions for both of
> these.
I can separete it to compile and linke sections and remove the nostdlib,
nodefaultlibs and nostartfiles. But how do we not pass -pie to the linker when
we don't pass static or shared and don't link it with -pie? For only the gold
linker support -no-pie.
/Magnus G.