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 jos...@codesourcery.com