This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug driver/81498] Support creating static PIE
- From: "hjl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 12 Sep 2017 16:31:00 +0000
- Subject: [Bug driver/81498] Support creating static PIE
- Auto-submitted: auto-generated
- References: <bug-81498-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81498
--- Comment #1 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Tue Sep 12 16:30:28 2017
New Revision: 252034
URL: https://gcc.gnu.org/viewcvs?rev=252034&root=gcc&view=rev
Log:
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.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/common.opt
trunk/gcc/config/gnu-user.h
trunk/gcc/config/i386/gnu-user.h
trunk/gcc/config/i386/gnu-user64.h
trunk/gcc/doc/invoke.texi
trunk/gcc/gcc.c