[PATCH] D20622: [ELF] - Added support for jmp/call relaxations when R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX are used.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 09:32:24 PDT 2016


On 25 May 2016 at 12:29, George Rimar <grimar at accesssoftek.com> wrote:
> grimar added a comment.
>
> In http://reviews.llvm.org/D20622#439251, @rafael wrote:
>
>> > +      // Convert jmp *foo at GOTPCREL(%rip) to jmp foo nop.
>>
>>
>> Can't you use a prefix in here?
>
>
> Ah, I think I know ! ABI says:
> jmp *foo at GOTPCREL(%rip) can be relaxed to jmp foo nop
>
> For call it gives 2 ways:
> call foo nop
> nop call foo
>
> But for jump only one way allowed . Therefore we can't switch nop to something else,
> like adding instruction prefix without violation of ABI.

Actually, I think I get it:

A call returns, so if you write nop;call or call;nop, the nop will be
executed. Using a prefix is better.
A jmp doesn't return, so if you write jmp;nop, the nop is never executed.

Can you add that as a comment?

Cheers,
Rafael


More information about the llvm-commits mailing list