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] Add -static-pie to GCC driver to create static PIE


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


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