public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Magnus Granberg <zorry@gentoo.org>,
	"Joseph S. Myers" <joseph@codesourcery.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>, danielmicay@gmail.com
Subject: Re: [PING][PATCH][1-3] New configure options that make the compiler use -fPIE and -pie as default option
Date: Fri, 09 Jan 2015 13:04:00 -0000	[thread overview]
Message-ID: <CAFiYyc36p_JMOHbbDPOYJisRw1cL3gakAHmc1DJLGiS3vD9oUQ@mail.gmail.com> (raw)
In-Reply-To: <1625902.vd5h90ZESU@laptop1.gw.ume.nu>

On Tue, Dec 30, 2014 at 10:23 PM, Magnus Granberg <zorry@gentoo.org> wrote:
> fredag 14 november 2014 23.31.48 skrev  Magnus Granberg:
>> måndag 10 november 2014 21.26.39 skrev  Magnus Granberg:
>> > >   Rainer
>> >
>> > Thanks Rainer for the nits and comments.
>> > Have updated the patches and Changelogs.
>> > But i still use PIE_DRIVER_SELF_SPECS, do you have a ide where move it so
>> > i don't need to duplicate that stuff or how to do it?
>> >
>> > Magnus G
>> >
>> > 2014-11-10  Magnus Granberg  <zorry@gentoo.org>
>> >
>> >     /gcc
>> >     * config/gnu-user.h (PIE_DRIVER_SELF_SPECS) and
>> >     (GNU_DRIVER_SELF_SPECS): Define.
>> >     * config/i386/gnu-user-common.h (DRIVER_SELF_SPECS): Define
>> >     * configure.ac: Add new option.
>> >     * configure, config.in: Rebuild.
>> >     * Makefile.in (ALL_CFLAGS) and (ALL_CXXFLAGS): Disable PIE.
>> >     * doc/install.texi: New configure option.
>> >     * doc/invoke.texi: Add note to PIE.
>> >     * doc/sourcebuild.texi: New effective target.
>> >     gcc/testsuite
>> >     * gcc/default-pie.c: New test
>> >     * gcc.dg/tree-ssa/ssa-store-ccp-3.c: Skip if default_pie
>> >     * g++.dg/other/anon5.C: Skip if default_pie
>> >     * lib/target-supports.exp (check_effective_target_default_pie):
>> >     New proc.
>> >     /libgcc
>> >     * Makefile.in (CRTSTUFF_CFLAGS): Disable PIE.
>>
>> Can this be included for GCC 5 ?
>>
>> /Magnus G.
> One more ping on this. The patches where sent before stage 1 closed but i
> did't get any feed back from it
> Have updete the patchses for gcc 5.0 20141228 snapshot.
> Bootstrapped and tested on x86_64-unknown-linux-gnu (Gentoo)
> /Magnus

Looking at the actual implementation I wonder why it's not similar
to how darwin gets at it default (not sure how it does).  Also
looking at how DRIVER_SELF_SPECS is used I wonder if the
functionality can be enabled with a simple

--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).

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

 gcc -pie -c t.c

we will end up with a non-PIE object, and linking with -fPIE will
end up with a DYN_EXEC object.

I believe you want to treat link and compile arguments separately
(and adjust the link spec for linking).  I also would have said that
elfos.h is more appropriate than gnu-user.h, but ...

That said, the patch looks more like a hack (and see above how
to achieve the same without a patch(?)), not like a proper implementation
of a PIE default.

Joseph may have an idea where the proper place for a spec-wise
default PIE is.

Thanks,
Richard.

> 2014-12-30  Magnus Granberg  <zorry@gentoo.org>
>
> /gcc
>         * config/gnu-user.h (PIE_DRIVER_SELF_SPECS): Define.
>         * config/i386/gnu-user-common.h (DRIVER_SELF_SPECS): Define and
>         add PIE_DRIVER_SELF_SPECS.
>         * configure.ac: Add new option.
>         * configure, config.in: Rebuild.
>         * Makefile.in (ALL_CFLAGS) and (ALL_CXXFLAGS): Disable PIE.
>         * doc/install.texi: New configure option.
>         * doc/invoke.texi: Add note to PIE.
>         * doc/sourcebuild.texi: New effective target.
> gcc/testsuite
>         * gcc/default-pie.c: New test
>         * gcc.dg/tree-ssa/ssa-store-ccp-3.c: Skip if default_pie
>         * g++.dg/other/anon5.C: Skip if default_pie
>         * lib/target-supports.exp (check_effective_target_default_pie):
>         New proc.
> /libgcc
>         * Makefile.in (CRTSTUFF_CFLAGS): Disable PIE.
>

  parent reply	other threads:[~2015-01-09 12:58 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-31 20:32 [PATCH][1-3] " Magnus Granberg
2014-08-01  8:52 ` Rainer Orth
2014-08-31 15:49   ` Gerald Pfeifer
2014-11-10 20:33   ` Magnus Granberg
2014-11-14 23:19     ` Magnus Granberg
2014-12-30 22:04       ` [PING][PATCH][1-3] " Magnus Granberg
2015-01-09  4:31         ` Allan McRae
2015-01-09 13:04         ` Richard Biener [this message]
2015-01-09 14:17           ` Daniel Micay
2015-01-09 17:57             ` Joseph Myers
2015-01-09 18:03               ` Daniel Micay
2015-01-09 20:40                 ` Magnus Granberg
2015-01-10  2:32                   ` H.J. Lu
2015-01-10 17:06                     ` H.J. Lu
2015-01-12 16:18           ` [PATCH]: " H.J. Lu
2015-01-12 23:53             ` Joseph Myers
2015-01-13  0:31               ` H.J. Lu
2015-01-13 13:10               ` H.J. Lu
2015-01-14  0:03                 ` H.J. Lu
2015-01-09 10:48     ` [PATCH][1-3] " Marcus Meissner
2015-01-11 10:21 [PING][PATCH][1-3] " Daniel Micay
2015-01-11 11:37 ` Daniel Micay
2015-01-11 12:39   ` H.J. Lu
2015-01-11 14:02     ` Magnus Granberg
2015-01-11 15:13       ` Magnus Granberg
2015-01-11 19:27         ` H.J. Lu
2015-01-11 19:29           ` H.J. Lu
2015-01-11 21:55             ` Magnus Granberg
2015-01-11 23:54               ` H.J. Lu
2015-01-11 17:47       ` H.J. Lu
2015-01-11 15:21     ` Daniel Micay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFiYyc36p_JMOHbbDPOYJisRw1cL3gakAHmc1DJLGiS3vD9oUQ@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=danielmicay@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=zorry@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).