This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -static-pie and -static -pie
On Wed, Jan 31, 2018 at 7:56 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Jan 31, 2018 at 7:44 AM, Cory Fields <lists@coryfields.com> wrote:
>> After looking at this for quite a while, I'm afraid I'm unsure how to proceed.
>>
>> As of now, static and static-pie are mutually exclusive. So given the
>> GNU_USER_TARGET_STARTFILE_SPEC you pasted
>> earlier, "static" matches before "static-pie", causing the wrong start files.
>>
>> It seems to me that the static-pie target complicates things more than
>> matching against static+pie individually.
>>
>> If I convert -static + -pie to -static-pie, then "static" won't be
>> matched in specs, where maybe it otherwise should. Same for -pie.
>>
>> Would you prefer to swallow -static and -pie and pass along only
>> -static-pie? Or forward them all along, and fix the specs which look
>
> Yes. When you see both -static and -pie. regardless of their relative
> order on command-line, you
>
> 1. Remove -static and -pie.
> 2. Add -static-pie.
>
This assumes that -static -pie and -pie -static do not produce the working
executable. If they do, you can't change them.
--
H.J.