[PATCH] D15779: [ELF] - Implemented optimization for R_X86_64_GOTPCREL relocation.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 06:18:05 PST 2016


On 19 January 2016 at 08:56, George Rimar <grimar at accesssoftek.com> wrote:
> grimar added a comment.
>
> In http://reviews.llvm.org/D15779#329436, @rafael wrote:
>
>> Do you also intend to also implement the other optimizations listed in the ABI?
>
>
> I have plan to implement all those which listed in "B.2 Optimize GOTPCRELX Relocations":
> call *foo at GOTPCREL(%rip) -> nop call foo
> call *foo at GOTPCREL(%rip) -> call foo nop
> jmp *foo at GOTPCREL(%rip) -> jmp foo nop
> mov foo at GOTPCREL(%rip), %reg -> lea foo(%rip), %reg (this patch implements it)

Note that you do need the GOTPCRELX relocation for these.

There is a discussion about it in
https://sourceware.org/ml/binutils/2016-01/msg00182.html, but the
summary is that without additional info from the assembler you cannot
know what the relocation points to.

> I leaved bits specially here. I think for patches that emit binary data it is reasonable to check it.
> For example the same instruction can be encoded in a different way. This one patch changes one byte and so I would like to check binary output as well as instructions generated.

Fair enough. I will take another look.


More information about the llvm-commits mailing list