RFC: Add a new relocation to x86-64/i386 psABIs
H.J. Lu
hjl.tools@gmail.com
Mon May 18 15:05:00 GMT 2015
On Mon, May 18, 2015 at 6:13 AM, Michael Matz <matz@suse.de> wrote:
> 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
Yes, we should convert it to
nop call foo/jmp foo nop
I implemented it on users/hjl/relax branch in binutils git repo.
> the insn decoder. For calls as well of course, but there it might be
> better to have it before the call.
>
I think a nop prefix is better on call. We won't mandate "nop call foo"
in psABI and linker is free to use either a nop prefix or a nop suffix.
Should we move forward with it?
Thanks.
--
H.J.
More information about the Binutils
mailing list