This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][1-3] New configure option to enable Position independent executable as default.


On Wed, 13 Nov 2013 23:28:45 +0100
Magnus Granberg <zorry@gentoo.org> wrote:

> Hi
> This patchset will add a new configure options --enable-default-pie.
> With the new option enable will make it pass -fPIE and -pie from the gcc and 
> g++ frontend. Have only add the support for two targets but should work on
> more targes. In configure.ac we add the new option. We can't compile the 
> compiler or the crt stuff with -fPIE it will brake the PCH and the crtbegin
> and crtend files. The disabling is done in the Makefiles. The needed spec is
> added to DRIVER_SELF_SPECS. We disable all the profiling test for the linking
> will fail.Tested on x86_64 linux (Gentoo).
> 
> /Magnus Granberg

Hey Magnus.  Some nits:

> --- a/gcc/configure.ac	2013-09-25 18:10:35.000000000 +0200
> +++ b/gcc/configure.ac	2013-10-22 21:26:56.287602139 +0200
> @@ -5434,6 +5434,31 @@ if test x"${LINKER_HASH_STYLE}" != x; th
>                                           [The linker hash style])
>  fi
>  
> +# Check whether --enable-default-pie was given and target have the support.
> +AC_ARG_ENABLE(default-pie,
> +[AS_HELP_STRING([--enable-default-pie], [Enable Position independent executable as default.

Help strings begin with a lowercase letter and do not end with a period. "enable
Position Independent Executables by default".

> +                 If we have suppot for it when compiling and linking.
> +                 Linux targets supported i?86 and x86_64.])],

I would drop these lines.

> +enable_default_pie=$enableval,
> +enable_default_pie=no)
> +if test x$enable_default_pie = xyes; then
> +  AC_MSG_CHECKING(if $target support to default with -fPIE and link with -pie as default)

"if $target supports default PIE"

> +  enable_default_pie=no
> +  case $target in
> +    i?86*-*-linux* | x86_64*-*-linux*)
> +      enable_default_pie=yes
> +      ;;
> +    *)
> +      ;;
> +    esac
> +  AC_MSG_RESULT($enable_default_pie)
> +fi
> +if test x$enable_default_pie == xyes ; then
> +  AC_DEFINE(ENABLE_DEFAULT_PIE, 1,
> +      [Define if your target support default-pie and you have enable it.])

"supports default PIE and it is enabled."

> +fi
> +AC_SUBST([enable_default_pie])
> +
>  # Configure the subdirectories
>  # AC_CONFIG_SUBDIRS($subdirs)
>  
> --- a/gcc/doc/install.texi	2013-10-01 19:29:40.000000000 +0200
> +++ b/gcc/doc/install.texi	2013-11-09 15:40:20.831402110 +0100
> @@ -1421,6 +1421,11 @@ do a @samp{make -C gcc gnatlib_and_tools
>  Specify that the run-time libraries for stack smashing protection
>  should not be built.
>  
> +@item --enable-default-pie
> +We will turn on @option{-fPIE} and @option{-pie} as default when
> +compileing and linking if the support is there. We only support 
> +i?86-*-linux* and x86-64-*-linux* as target for now.

"Turn on @option{-fPIE} and @option{-pie} by default if supported.  
Currently supported targets are i?86-*-linux* and x86-64-*-linux*."

Also two spaces between sentences.

> --- a/gcc/doc/invoke.texi	2012-03-01 10:57:59.000000000 +0100
> +++ b/gcc/doc/invoke.texi	2012-07-30 00:57:03.766847851 +0200
> @@ -9457,6 +9480,12 @@ For predictable results, you must also s
>  that were used to generate code (@option{-fpie}, @option{-fPIE},
>  or model suboptions) when you specify this option.
>  
> +NOTE: With configure --enable-default-pie  this option is enabled by default 

Extra space (also in the hunk for fPIE).

> +for C, C++, ObjC, ObjC++, if none of @option{-fno-PIE}, @option{-fno-pie}, 
> +@option{-fPIC}, @option{-fpic}, @option{-fno-PIC}, @option{-fno-pic}, 
> +@option{-nostdlib}, @option{-nostartfiles}, @option{-shared}, 
> +@option{-nodefaultlibs}, nor @option{static} are found.

Looks like nodefaultlibs is missing from PIE_DRIVER_SELF_SPECS or this needs
to be updated.

Thanks!


-- 
Ryan Hill                        psn: dirtyepic_sk
   gcc-porting/toolchain/wxwidgets @ gentoo.org

47C3 6D62 4864 0E49 8E9E  7F92 ED38 BD49 957A 8463

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]