[PATCH] New option --enable-pie-programs

Siddhesh Poyarekar siddhesh@sourceware.org
Wed Nov 17 08:50:36 GMT 2021


On 11/17/21 14:09, Florian Weimer wrote:
> * Siddhesh Poyarekar:
> 
>> On 11/16/21 19:28, Florian Weimer wrote:
>>> * Siddhesh Poyarekar:
>>>
>>>> Add a new option --enable-pie-programs to build tests and binaries as
>>>> PIE.  This allows building all dynamic programs in glibc (e.g.
>>>> iconvconfig, getconf, etc.) as PIE on architectures that do not have
>>>> -static-pie.
>>> Please integrate this in some way with libc_cv_cc_pie_default and
>>> libc_cv_pie_default.  Probably --enable-pie-programs should default to
>>> yes if the toolchain defauls to PIE.
>>
>> AFAICT, libc_cv_cc_pie_default is only to set -fno-pie for non-PIE
>> linking with a toolchain that defaults to pie.  PIE linking otherwise
>> is controlled accross the board with libc_cv_pie_default, which
>> includes build-pie-default, static-pie and now pie-programs.
>>
>> So I reckon it is integrated; the new pie-programs variable is only to
>> set CFLAGS to -fPIC.
> 
> --enable-pie-programs=no with a default-PIE toolchain still produces PIE
> programs, right?

Yes, it should.  $libc_cv_pie_default is overwritten only in case of 
--enable-pie-programs=yes, otherwise it is left alone, much like 
--enable-static-pie.

Siddhesh


More information about the Libc-alpha mailing list