[PATCH] D158911: [BOLT] Support input binaries that use R_X86_GOTPC64
Rafael Auler via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 25 16:30:20 PDT 2023
rafauler created this revision.
rafauler added a reviewer: bolt.
Herald added subscribers: treapster, ayermolo, pengfei.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a project: All.
rafauler requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D158911
Files:
bolt/include/bolt/Core/Relocation.h
bolt/lib/Core/Relocation.cpp
bolt/lib/Target/X86/X86MCPlusBuilder.cpp
bolt/lib/Target/X86/X86MCSymbolizer.cpp
bolt/lib/Target/X86/X86MCSymbolizer.h
bolt/test/runtime/X86/gotoff-large-code-model.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158911.553666.patch
Type: text/x-patch
Size: 6211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230825/308f08cf/attachment.bin>
More information about the llvm-commits
mailing list