Safe Identical Code Folding for X86-64.

Sriraman Tallam tmsriram@google.com
Fri Jan 22 01:43:00 GMT 2010


On Thu, Jan 21, 2010 at 5:16 PM, John Reiser <jreiser@bitwagon.com> wrote:
> On 01/21/2010 04:51 PM, Sriraman Tallam wrote:
>
>>      I am implementing a safe ICF option for gold ... for AMD X86-64. ...
>
>> Case (i) : For position dependent code (non-PIC),  there is no
>> problem. A function call is always a PC relative relocation and a
>> function pointer is a direct relocation.
>
> That depends on the compiler.  I have a compiler that uses no relocation
> at all for a CALL if the target is visible in the same compilation unit.
> The displacement is computed at compile time, and used as a constant.
> Also, in some cases a function pointer can be created by %rip-relative
> LEA using a constant displacement with no relocation at all.

If bar calls foo and does not use a relocation for foo and uses a
displacement instead, it is somehow guaranteed that foo and bar will
be linked with that displacement. That, in effect, it rules out any
kind of folding, not just safe, right ?

>
> Is the proposed ICF for gcc only?  What are the assumptions
> about the properties of compiler-generated code?
>
> --
>



More information about the Binutils mailing list