[all-commits] [llvm/llvm-project] e4b6e6: [JITLink][ELF][x86-64] Add support for R_X86_64_GO...

lhames via All-commits all-commits at lists.llvm.org
Sun Apr 16 18:45:15 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e4b6e686b70529db2c6424bd4094545836fdcd99
      https://github.com/llvm/llvm-project/commit/e4b6e686b70529db2c6424bd4094545836fdcd99
  Author: Lang Hames <lhames at gmail.com>
  Date:   2023-04-17 (Mon, 17 Apr 2023)

  Changed paths:
    M llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
    A llvm/test/ExecutionEngine/JITLink/x86-64/ELF_R_X86_64_GOTPC32.s
    M llvm/tools/llvm-jitlink/llvm-jitlink-elf.cpp

  Log Message:
  -----------
  [JITLink][ELF][x86-64] Add support for R_X86_64_GOTPC32 relocation.

Adds support for the R_X86_64_GOTPC32 relocation, which is a 32-bit delta to
the global offset table.

Since the delta to the GOT doesn't actually require any GOT entries to exist
this commit adds an extra fallback path to the getOrCreateGOTSymbol function:
If the symbol is in the extenal symbols list but no entry exists then the
symbol is turned into an absolute symbol pointing to an arbitrary address in
the current graph's allocation (accessing this address via the symbol would be
illegal, but any access should have triggered creation of a GOT entry which
would prevent this fallback path from being taken in the first place).

This commit also updates the llvm-jitlink tool to scrape the addresses of the
absolute symbols in the graph so that the testcase can see the now-absolute
_GLOBAL_OFFSET_TABLE_ symbol.




More information about the All-commits mailing list