RFC: Add a new relocation to x86-64/i386 psABIs

Michael Matz matz@suse.de
Mon May 18 13:29:00 GMT 2015


Hi,

On Mon, 18 May 2015, H.J. Lu wrote:

> To avoid indirect branch to internal functions, I am proposing to add a
> new relocation, R_X86_64_RELAX_GOTPCREL, to x86-64 psABI:
> 
> 1. When branching to an external function, foo, compiler may generate
> 	call/jmp *foo@GOTRELAX(%rip)
>    which generates R_X86_64_RELAX_GOTPCREL relocation, instead of
> 	call/jmp foo[@PLT]
> 2. When function foo is locally defined, linker converts
> 	call/jmp *foo@GOTRELAX(%rip)
>    to
> 	nop call/jmp foo

For the jmp case the nop can also be added after it, to not even disturb 
the insn decoder.  For calls as well of course, but there it might be 
better to have it before the call.


Ciao,
Michael.



More information about the Gcc-patches mailing list