[PATCH] D108280: [JITLink] Optimize GOTPCRELX Relocations

luxufan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 18 01:44:00 PDT 2021


StephenFan created this revision.
StephenFan added a reviewer: lhames.
Herald added subscribers: pengfei, hiraditya.
StephenFan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch optimize the GOTPCRELX Reloations, which is described in X86-64 psabi chapter B.2. And Not all optimization of this chapter is implemented.

1. Convert call and jmp has been implemented
2. Convert mov, but the optimization that when the symbol is defined in the lower 32-bit address space, memory operand in `mov` can be convertted into immediate operand has not been implemented.
3. Conver Test and Binop has not been implemented.

The new test file named ELF_got_plt_optimizations.s has been added, and I moved some test cases about optimization of got/plt from ELF_x86_64_small_pic_relocations.s to the new test file.

By referencing the lld, so, the optimization `Convert call and jmp` is not same as what psabi says, and I have explained it in the comment.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108280

Files:
  llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86_64.h
  llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
  llvm/lib/ExecutionEngine/JITLink/x86_64.cpp
  llvm/test/ExecutionEngine/JITLink/X86/ELF_got_plt_optimize.s
  llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_common.s
  llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_small_pic_relocations.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108280.367145.patch
Type: text/x-patch
Size: 12567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210818/1ff5b865/attachment.bin>


More information about the llvm-commits mailing list