Safe Identical Code Folding for X86-64.

John Reiser jreiser@bitwagon.com
Fri Jan 22 01:16:00 GMT 2010


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.

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