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: Michael Matz <matz at suse dot de>
- To: ia32-abi at googlegroups dot com
- Cc: x86-64-abi at googlegroups dot com, gcc-patches at gcc dot gnu dot org, binutils at sourceware dot org
- Date: Mon, 18 May 2015 15:13:05 +0200 (CEST)
- 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>
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.