[PATCH] Add -static-pie to GCC driver to create static PIE

H.J. Lu hjl.tools@gmail.com
Thu Aug 24 21:04:00 GMT 2017


On Wed, Aug 9, 2017 at 3:39 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Aug 8, 2017 at 10:36 PM, Richard Biener
> <richard.guenther@gmail.com> wrote:
>> On August 9, 2017 12:18:41 AM GMT+02:00, "H.J. Lu" <hongjiu.lu@intel.com> 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?
>>
>> What's wrong with -static -pie?
>>
>
> -static -pie behaved differently depending on if --enable-default-pie
> was used:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81523
>
> I just checked in a patch to make -static always  override -pie.
>

Hi Joseph,

Can you take a look at this patch?  I am enclosing it here.

Thanks.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-static-pie-to-GCC-driver-to-create-static-PIE.patch
Type: text/x-patch
Size: 10105 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170824/41ff483b/attachment.bin>


More information about the Gcc-patches mailing list