From: Joseph Myers <joseph@codesourcery.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
Magnus Granberg <zorry@gentoo.org>,
GCC Patches <gcc-patches@gcc.gnu.org>, <danielmicay@gmail.com>
Subject: Re: [PATCH]: New configure options that make the compiler use -fPIE and -pie as default option
Date: Mon, 12 Jan 2015 23:53:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.10.1501122347110.26937@digraph.polyomino.org.uk> (raw)
In-Reply-To: <20150112161023.GA6392@gmail.com>
On Mon, 12 Jan 2015, H.J. Lu wrote:
> +if test x$enable_default_pie = xyes; then
> + AC_MSG_CHECKING(if $target supports default PIE)
> + enable_default_pie=no
> + case $target in
> + i?86*-*-linux* | x86_64*-*-linux*)
> + saved_LDFLAGS="$LDFLAGS"
> + saved_CFLAGS="$CFLAGS"
> + CFLAGS="$CFLAGS -fPIE"
> + LDFLAGS="$LDFLAGS -fPIE -pie"
> + AC_TRY_LINK(,,[enable_default_pie=yes],)
> + LDFLAGS="$saved_LDFLAGS"
> + CFLAGS="$saved_CFLAGS"
> + ;;
> + *)
> + ;;
> + esac
There should not be any such hardcoding of targets here without concrete
evidence that the targets for which this sets enable_default_pie=no really
cannot support PIE. In particular, there is no reason at all for this to
be architecture-specific; all GNU/Linux architectures should support PIE.
I believe AC_TRY_LINK here will test for the host, whereas what you want
to know is what's supported for the target (but it's not possible to run
link tests for the target at this point; the compiler for the target
hasn't even been built).
So: just presume that if the user passes --enable-default-pie then they
know what they are doing, and don't try to override their choice.
> diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
> index c9e3bf1..89fc305 100644
> --- a/gcc/doc/install.texi
> +++ b/gcc/doc/install.texi
> @@ -1583,6 +1583,10 @@ not be built.
> Specify that the run-time libraries for stack smashing protection
> should not be built.
>
> +@item --enable-default-pie
> +Turn on @option{-fPIE} and @option{-pie} by default if supported.
> +Currently supported targets are i?86-*-linux* and x86-64-*-linux*.
The "if supported" and target list can then be removed here.
--
Joseph S. Myers
joseph@codesourcery.com
next prev parent reply other threads:[~2015-01-12 23:50 UTC|newest]
Thread overview: 20+ 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
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 [this message]
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
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=alpine.DEB.2.10.1501122347110.26937@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=danielmicay@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
--cc=richard.guenther@gmail.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).