This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: is -fPIC safe for executable programs, or must -fPIE be used?
- From: Jeffrey Walton <noloader at gmail dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Britton Kerin <britton dot kerin at gmail dot com>, "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Thu, 24 Mar 2016 15:43:46 -0400
- Subject: Re: is -fPIC safe for executable programs, or must -fPIE be used?
- Authentication-results: sourceware.org; auth=none
- References: <CAC4O8c-FrGrpKUQptyYzZpu8Zr9afmyWaRHTFLRLDMyA9QZtaw at mail dot gmail dot com> <CAH8yC8kqVP-hwtWm4TXcg9b0brm4UvH8Wq4xBGZyAoEb2E11-w at mail dot gmail dot com> <56F4434A dot 3060706 at redhat dot com>
- Reply-to: noloader at gmail dot com
On Thu, Mar 24, 2016 at 3:43 PM, Jeff Law <law@redhat.com> wrote:
> On 03/24/2016 01:21 PM, Jeffrey Walton wrote:
>>
>> One of the GCC devs explained why its OK a few years ago, but I can't
>> find the bug report with the explanation. I just use -fPIC all the
>> time unless its i686 because the GOT pointer basically reserves EBX.
>> On i686 it becomes a tradeoff because you lose a register, so you may
>> not want -fPIC/-fPIE at all.
>
> Actually EBX is no longer reserved on i686 when generating PIC code. I
> believe that code went into gcc-5.
Oh nice, thanks for that.
Jeff