This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add -static-pie to GCC driver to create static PIE
- From: Joseph Myers <joseph at codesourcery dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 28 Aug 2017 16:10:55 +0000
- Subject: Re: [PATCH] Add -static-pie to GCC driver to create static PIE
- Authentication-results: sourceware.org; auth=none
- References: <20170808221841.GA16793@gmail.com>
On Tue, 8 Aug 2017, H.J. Lu wrote:
> 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.
>
> OK for trunk?
I think the documentation for various options needs updating to clarify
exactly what they mean. (And potentially help text, which for driver
options is in gcc.c:display_help with the common.opt text being ignored in
that case.)
-static is no longer just "prevents linking with the shared libraries" as
the documentation says, given it's also overriding (explicit or
configure-time default) -pie. -pie is no longer just "Produce a position
independent executable", it's producing a *dynamically linked* PIE.
> +@item -static-pie
> +@opindex static-pie
> +Produce a static position independent executable on targets that support
> +it. A static position independent executable is similar to static
> +executable, but can be loaded at any address without a dynamic linker.
"to a static executable".
--
Joseph S. Myers
joseph@codesourcery.com