PING. On Fri, Mar 6, 2015 at 9:31 AM, H.J. Lu <hjl.to...@gmail.com> wrote: > PING. I am enclosing the patch here for review. > > On Wed, Feb 11, 2015 at 8:47 AM, H.J. Lu <hjl.to...@gmail.com> wrote: >> PING. >> >> On Wed, Jan 28, 2015 at 8:05 AM, H.J. Lu <hjl.to...@gmail.com> wrote: >>> PING. >>> >>> On Tue, Jan 13, 2015 at 3:25 PM, H.J. Lu <hjl.to...@gmail.com> wrote: >>>> On Tue, Jan 13, 2015 at 5:03 AM, H.J. Lu <hjl.to...@gmail.com> wrote: >>>>> On Mon, Jan 12, 2015 at 11:50:41PM +0000, Joseph Myers wrote: >>>>>> 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. >>>>>> >>>>> >>>>> Here is the updated patch. To support --enable-default-pie, each target >>>>> must update STARTFILE_SPEC to support PIE_SPEC and NO_PIE_SPEC. I can >>>>> provide STARTFILE_SPEC patch if needed. >>>>> >>>>> Thanks. >>>>> >>>>> >>>>> H.J. >>>>> --- >>>>> gcc/ >>>>> >>>>> 2015-01-12 Magnus Granberg <zo...@gentoo.org> >>>>> H.J. Lu <hongjiu...@intel.com> >>>>> >>>>> * Makefile.in (COMPILER): Add @NO_PIE_CFLAGS@. >>>>> (LINKER): Add @NO_PIE_FLAG@. >>>>> (libgcc.mvars): Set NO_PIE_CFLAGS to -fno-PIE for >>>>> --enable-default-pie. >>>>> * common.opt (fPIE): Initialize to -1. >>>>> (fpie): Likewise. >>>>> (static): Add "RejectNegative Negative(shared)". >>>>> (no-pie): New option. >>>>> (pie): Replace "Negative(shared)" with "Negative(no-pie)". >>>>> * configure.ac: Add --enable-default-pie. >>>>> (NO_PIE_CFLAGS): New. Check if -fno-PIE works. AC_SUBST. >>>>> (NO_PIE_FLAG): New. Check if -no-pie works. AC_SUBST. >>>>> * defaults.h (DEFAULT_FLAG_PIE): New. Default PIE to -fPIE. >>>>> * gcc.c (NO_PIE_SPEC): New. >>>>> (PIE_SPEC): Likewise. >>>>> (LD_PIE_SPEC): Likewise. >>>>> (LINK_PIE_SPEC): Handle -no-pie. Use PIE_SPEC and LD_PIE_SPEC. >>>>> * opts.c (DEFAULT_FLAG_PIE): New. Set to 0 if ENABLE_DEFAULT_PIE >>>>> is undefined. >>>>> (finish_options): Update opts->x_flag_pie if it is -1. >>>>> * config/gnu-user.h (FVTABLE_VERIFY_SPEC): New. >>>>> (GNU_USER_TARGET_STARTFILE_SPEC): Use FVTABLE_VERIFY_SPEC. Use >>>>> NO_PIE_SPEC and NO_PIE_SPEC if ENABLE_DEFAULT_PIE is defined. >>>>> (GNU_USER_TARGET_STARTFILE_SPEC): Use FVTABLE_VERIFY_SPEC. >>>>> * doc/install.texi: Document --enable-default-pie. >>>>> * doc/invoke.texi: Document -no-pie. >>>>> * config.in: Regenerated. >>>>> * configure: Likewise. >>>>> >>>>> gcc/ada/ >>>>> >>>>> 2015-01-12 H.J. Lu <hongjiu...@intel.com> >>>>> >>>>> * gcc-interface/Makefile.in (TOOLS_LIBS): Add @NO_PIE_FLAG@. >>>>> >>>>> libgcc/ >>>>> >>>>> 2015-01-12 H.J. Lu <hongjiu...@intel.com> >>>>> >>>>> * Makefile.in (CRTSTUFF_CFLAGS): Add $(NO_PIE_CFLAGS). >>>>> >>>> >>>> This is the updated patch. I fixed the -r regression. LTO tests >>>> pass now. >>>> >>>> -- >>>> H.J. >>> >>> >>> >>> -- >>> H.J. >> >> >> >> -- >> H.J. > > > > -- > H.J.
-- H.J.