[all-commits] [llvm/llvm-project] 853e12: [BOLT] Support input binaries that use R_X86_GOTPC64
Rafael Auler via All-commits
all-commits at lists.llvm.org
Mon Oct 2 23:13:11 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 853e126ce32ac899e6be5d18c632a1814797ca79
https://github.com/llvm/llvm-project/commit/853e126ce32ac899e6be5d18c632a1814797ca79
Author: Rafael Auler <rafaelauler at fb.com>
Date: 2023-10-02 (Mon, 02 Oct 2023)
Changed paths:
M bolt/include/bolt/Core/BinaryContext.h
M bolt/include/bolt/Core/Relocation.h
M bolt/lib/Core/BinaryContext.cpp
M bolt/lib/Core/Relocation.cpp
M bolt/lib/Rewrite/JITLinkLinker.cpp
M bolt/lib/Rewrite/RewriteInstance.cpp
M bolt/lib/Target/X86/X86MCPlusBuilder.cpp
M bolt/lib/Target/X86/X86MCSymbolizer.cpp
M bolt/lib/Target/X86/X86MCSymbolizer.h
A bolt/test/runtime/X86/gotoff-large-code-model-2.s
A bolt/test/runtime/X86/gotoff-large-code-model.s
Log Message:
-----------
[BOLT] Support input binaries that use R_X86_GOTPC64
In large code model, the address of GOT is calculated by the
static linker via R_X86_GOTPC64 reloc applied against a MOVABSQ
instruction. In the final binary, it can be disassembled as a regular
immediate, but because such immediate is the result of PC-relative
pointer arithmetic, we need to parse this relocation and update this
calculation whenever we move code, otherwise we break the code trying
to read GOT.
A test case showing how GOT is accessed was provided.
Reviewed By: #bolt, maksfb
Differential Revision: https://reviews.llvm.org/D158911
More information about the All-commits
mailing list