[all-commits] [llvm/llvm-project] 21562c: [JITLink][ELF][x86-64] Adjust addends for R_X86_64...

lhames via All-commits all-commits at lists.llvm.org
Sun Dec 5 01:38:16 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 21562c03ed17ce288a0de095e0f2ae4f452d3359
      https://github.com/llvm/llvm-project/commit/21562c03ed17ce288a0de095e0f2ae4f452d3359
  Author: Lang Hames <lhames at gmail.com>
  Date:   2021-12-05 (Sun, 05 Dec 2021)

  Changed paths:
    M llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
    M llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_small_pic_relocations.s

  Log Message:
  -----------
  [JITLink][ELF][x86-64] Adjust addends for R_X86_64_PLT32 relocations.

R_X86_64_PLT32 explicitly represents the '-4' PC-adjustment in the relocation's
addend, but JITLink's x86_64::Branch32PCRel includes the PC-adjustment
implicitly. We have been zeroing the addend to account for the difference, but
this breaks for branches to non-zero offsets past labels. This patch updates the
relocation parsing code to unconditionally adjust the offset by '+4' instead.
For branches directly to labels the result is still 0, for branches to offsets
past labels the result is the correct addend for x86_64::Branch32PCRel.




More information about the All-commits mailing list