[all-commits] [llvm/llvm-project] a9095f: [JITLink] Optimize GOTPCRELX Relocations

luxufan via All-commits all-commits at lists.llvm.org
Wed Aug 18 19:30:47 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a9095f005fdae510fc262f13431c710e3217a0d0
      https://github.com/llvm/llvm-project/commit/a9095f005fdae510fc262f13431c710e3217a0d0
  Author: luxufan <932494295 at qq.com>
  Date:   2021-08-19 (Thu, 19 Aug 2021)

  Changed paths:
    M llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86_64.h
    M llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
    M llvm/lib/ExecutionEngine/JITLink/x86_64.cpp
    M llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_common.s
    A llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_got_plt_optimizations.s
    M llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_small_pic_relocations.s

  Log Message:
  -----------
  [JITLink] Optimize GOTPCRELX Relocations

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.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D108280




More information about the All-commits mailing list