This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: RFC: Add a new relocation to x86-64/i386 psABIs
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: IA32 System V Application Binary Interface <ia32-abi at googlegroups dot com>, "x86-64-abi at googlegroups dot com" <x86-64-abi at googlegroups dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Binutils <binutils at sourceware dot org>
- Date: Mon, 18 May 2015 08:05:05 -0700
- Subject: Re: RFC: Add a new relocation to x86-64/i386 psABIs
- Authentication-results: sourceware.org; auth=none
- References: <20150518124042 dot GA16768 at gmail dot com> <alpine dot LSU dot 2 dot 20 dot 1505181509310 dot 27315 at wotan dot suse dot de>
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.