diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2017-09-12 16:30:28 +0000 |
---|---|---|
committer | H.J. Lu <hjl@gcc.gnu.org> | 2017-09-12 09:30:28 -0700 |
commit | b4fed89078efeb11da212091421a9f4718f625cc (patch) | |
tree | 991254b7281354b7923b50ba07c1114a2364c58f /gcc/common.opt | |
parent | ff76f0b5f6e6a4144fabb9ae984a9ee9dcaa2d08 (diff) | |
download | gcc-b4fed89078efeb11da212091421a9f4718f625cc.zip gcc-b4fed89078efeb11da212091421a9f4718f625cc.tar.gz gcc-b4fed89078efeb11da212091421a9f4718f625cc.tar.bz2 |
Add -static-pie to GCC driver to create static PIE
This patch adds -static-pie to GCC driver to create static PIE. A static
position independent executable (PIE) is similar to static executable,
but can be loaded at any address without a dynamic linker. All linker
input files must be compiled with -fpie or -fPIE and linker must support
--no-dynamic-linker to avoid linking with dynamic linker. "-z text" is
also needed to prevent dynamic relocations in read-only segments.
PR driver/81498
* common.opt (-static-pie): New alias.
(shared): Negate static-pie.
(-no-pie): Update help text.
(-pie): Likewise.
(static-pie): New option.
* config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Add
-static-pie support.
(GNU_USER_TARGET_ENDFILE_SPEC): Likewise.
(LINK_EH_SPEC): Likewise.
(LINK_GCC_C_SEQUENCE_SPEC): Likewise.
* config/i386/gnu-user.h (GNU_USER_TARGET_LINK_SPEC): Likewise.
* config/i386/gnu-user64.h (GNU_USER_TARGET_LINK_SPEC): Likewise.
* gcc.c (LINK_COMMAND_SPEC): Likewise.
(init_gcc_specs): Likewise.
(init_spec): Likewise.
(display_help): Update help message for -pie.
* doc/invoke.texi: Update -pie, -no-pie and -static. Document
-static-pie.
From-SVN: r252034
Diffstat (limited to 'gcc/common.opt')
-rw-r--r-- | gcc/common.opt | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/common.opt b/gcc/common.opt index 0873fb9..1581ca8 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -352,6 +352,9 @@ Common Alias(pedantic-errors) -pie Driver Alias(pie) +-static-pie +Driver Alias(static-pie) + -pipe Driver Alias(pipe) @@ -3065,7 +3068,7 @@ x Driver Joined Separate shared -Driver RejectNegative Negative(pie) +Driver RejectNegative Negative(static-pie) Create a shared library. shared-libgcc @@ -3111,11 +3114,15 @@ Driver no-pie Driver RejectNegative Negative(shared) -Don't create a position independent executable. +Don't create a dynamically linked position independent executable. pie Driver RejectNegative Negative(no-pie) -Create a position independent executable. +Create a dynamically linked position independent executable. + +static-pie +Driver RejectNegative Negative(pie) +Create a static position independent executable. z Driver Joined Separate |