This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -static-pie and -static -pie
- From: Cory Fields <lists at coryfields dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 30 Jan 2018 14:07:28 -0500
- Subject: Re: -static-pie and -static -pie
- Authentication-results: sourceware.org; auth=none
- References: <CAApLimiqPc0BFqy28jDQXJH-A_cMzuJ9yD=ceeFM=gP0wnrysQ@mail.gmail.com> <CAMe9rOoB8k49qFW91mBOysjJ2XfvaYV4xLxVtv78CKZGAeptiQ@mail.gmail.com>
- Reply-to: lists at coryfields dot com
On Tue, Jan 30, 2018 at 1:35 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Jan 30, 2018 at 10:26 AM, Cory Fields <lists@coryfields.com> wrote:
>> Hi list
>>
>> I'm playing with -static-pie and musl, which seems to be in good shape
>> for 8.0.0. Nice work :)
>>
>> However, the fact that "gcc -static -pie" and "gcc -static-pie"
>> produce different results is very unexpected. I understand the case
>> for the new link-type, but merging the options when possible would be
>> a huge benefit to existing buildsystems that already cope with both
>> individually.
>>
>> My use-case:
>> I'd like to build with --enable-default-pie, and by adding "-static"
>
> Why not adding "-static-pie" instead of "-static"?
>
>> to my builds, produce static-pie binaries. But at the moment, that
>> attempts to add an interp section.
>>
>> So my question is, if no conflicting options are found, why not hoist
>> "-static -pie" to "-static-pie" ?
>>
>> Regards,
>> Cory
>
>
>
> --
> H.J.
My build system, and plenty of others I'm sure, already handle -static
and -pie. Having that understood to mean "static-pie" would mean that
the combination would now just work.
Asking a different way, if I request -static and -pie, without -nopie,
quietly creating non-pie binary seems like a bug. Is there a reason
_not_ to interpret it as -static-pie in that case?