[llvm] 51a41f2 - [JITLink][AArch64] Fix overflow range of Page21 fixup edge.
Sunho Kim via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 9 18:30:48 PDT 2022
Author: Sunho Kim
Date: 2022-06-10T10:30:19+09:00
New Revision: 51a41f23b62ce0afbf395a251d9662390b28440c
URL: https://github.com/llvm/llvm-project/commit/51a41f23b62ce0afbf395a251d9662390b28440c
DIFF: https://github.com/llvm/llvm-project/commit/51a41f23b62ce0afbf395a251d9662390b28440c.diff
LOG: [JITLink][AArch64] Fix overflow range of Page21 fixup edge.
Allowed range for Page21 relocation is -2^32 <= X < 2^32 in both ELF and MachO.
https://github.com/llvm/llvm-project/blob/09c2b7c35af8c4bad39f03e9f60df8bd07323028/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h#L210 (MachO)
ELF for the ARM ® 64-bit Architecture (AArch64) Table 4-9 (ELF)
Reviewed By: sgraenitz
Differential Revision: https://reviews.llvm.org/D126387
Added:
Modified:
llvm/lib/ExecutionEngine/JITLink/aarch64.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/JITLink/aarch64.cpp b/llvm/lib/ExecutionEngine/JITLink/aarch64.cpp
index a4878f38bb4bd..fb5429eed96e3 100644
--- a/llvm/lib/ExecutionEngine/JITLink/aarch64.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/aarch64.cpp
@@ -92,7 +92,7 @@ Error applyFixup(LinkGraph &G, Block &B, const Edge &E) {
FixupAddress.getValue() & ~static_cast<uint64_t>(4096 - 1);
int64_t PageDelta = TargetPage - PCPage;
- if (PageDelta < -(1 << 30) || PageDelta > ((1 << 30) - 1))
+ if (!isInt<33>(PageDelta))
return makeTargetOutOfRangeError(G, B, E);
uint32_t RawInstr = *(ulittle32_t *)FixupPtr;
More information about the llvm-commits
mailing list