PING^N: [PATCH] Add --enable-static-pie to build static PIE [BZ #19574]

H.J. Lu hjl.tools@gmail.com
Sun Nov 19 19:52:00 GMT 2017


On Sun, Nov 19, 2017 at 8:17 AM, H.J. Lu <hjl.tools@gmail.com> wrote:

>
>>> +'--enable-static-pie'
>>> +     Build static executables, including tests, as position independent
>>> +     executable (static PIE) which is similar to static executable, but
>>> +     can be loaded at any address without help from a dynamic linker.
>>> +     The resulting libc.a can be used with the GCC option, -static-pie,
>>> +     which is available with GCC 8 or above, to create static PIE. Only
>>> +     i686, x86-64 and x32 targets are verified to work.
>>
>> Drop the last sentence, it will be outdated soon.

Fixed.

>>> diff --git a/Makeconfig b/Makeconfig
>>
>> The reason for some of the changes are not obvious at all to me, and
>> the ChangeLog doesn't give an explanation either.
>
> Can you list them so that I can address them?

I added some comments to Makeconfig.   Do they answer your questions?

>>> new file mode 100644
>>> index 0000000000..aa9302602b
>>> --- /dev/null
>>> +++ b/elf/dl-reloc-static-pie.c
>>
>> Is there anything which inhibits compilation of this file ith the
>> stack protector?  I think this is necessary because
>> _dl_relocate_static_pie is called so early.
>
> Good point.  I will check.

_dl_relocate_static_pie must be compiled without stack
protector.   Since dl-reloc-static-pie.c is in elf, it is compiled
with -fno-stack-protector.

>>> +extern struct link_map * _dl_get_dl_main_map (void)
>>> +  __attribute__ ((visibility ("hidden")));
>>
>> This should go into a header file somewhere, so that the declaration
>> can be checked against the definition.
>
> I will see what I can do.

I moved it to sysdeps/generic/ldsodefs.h.

Here is the updated patch.

Any more comments?

Thanks.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-enable-static-pie-configure-option-to-build-stat.patch
Type: text/x-patch
Size: 42469 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20171119/50a6d380/attachment.bin>


More information about the Libc-alpha mailing list