[llvm] b6ef408 - [JITLink][ELF] PCRel32GOTLoad edge offset can be smaller three
Stefan Gränitz via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 24 08:01:27 PDT 2020
Author: Stefan Gränitz
Date: 2020-10-24T16:57:48+02:00
New Revision: b6ef40891c7fb076a2f4ea860f8ee4135ae72aae
URL: https://github.com/llvm/llvm-project/commit/b6ef40891c7fb076a2f4ea860f8ee4135ae72aae
DIFF: https://github.com/llvm/llvm-project/commit/b6ef40891c7fb076a2f4ea860f8ee4135ae72aae.diff
LOG: [JITLink][ELF] PCRel32GOTLoad edge offset can be smaller three
Offset is 2 for MOVL instruction in test ELF_x86-64_common. This should fix the test failures.
Differential Revision: https://reviews.llvm.org/D89795
Added:
Modified:
llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
index 821a7b3cc44e..fb931c3d85e9 100644
--- a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
@@ -127,12 +127,11 @@ static Error optimizeELF_x86_64_GOTAndStubs(LinkGraph &G) {
if (E.getKind() == PCRel32GOTLoad) {
// Replace GOT load with LEA only for MOVQ instructions.
constexpr uint8_t MOVQRIPRel[] = {0x48, 0x8b};
- if (strncmp(B->getContent().data() + E.getOffset() - 3,
+ if (E.getOffset() < 3 ||
+ strncmp(B->getContent().data() + E.getOffset() - 3,
reinterpret_cast<const char *>(MOVQRIPRel), 2) != 0)
continue;
- assert(E.getOffset() >= 3 && "GOT edge occurs too early in block");
-
auto &GOTBlock = E.getTarget().getBlock();
assert(GOTBlock.getSize() == G.getPointerSize() &&
"GOT entry block should be pointer sized");
More information about the llvm-commits
mailing list