[PATCH] D146618: [ExecutionEngine] Fix R_AARCH64_ABS{16, 32} assertion
Denis Revunov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 22 03:10:48 PDT 2023
treapster created this revision.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
treapster requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Previous version of assertion effectively prevented negative Result values because it didn't cast to int64_t. Fix it by adding the cast.
https://reviews.llvm.org/D146618
Files:
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
Index: llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
===================================================================
--- llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -426,13 +426,15 @@
break;
case ELF::R_AARCH64_ABS16: {
uint64_t Result = Value + Addend;
- assert(static_cast<int64_t>(Result) >= INT16_MIN && Result < UINT16_MAX);
+ assert(static_cast<int64_t>(Result) >= INT16_MIN &&
+ static_cast<int64_t>(Result) < UINT16_MAX);
write(isBE, TargetPtr, static_cast<uint16_t>(Result & 0xffffU));
break;
}
case ELF::R_AARCH64_ABS32: {
uint64_t Result = Value + Addend;
- assert(static_cast<int64_t>(Result) >= INT32_MIN && Result < UINT32_MAX);
+ assert(static_cast<int64_t>(Result) >= INT32_MIN &&
+ static_cast<int64_t>(Result) < UINT32_MAX);
write(isBE, TargetPtr, static_cast<uint32_t>(Result & 0xffffffffU));
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146618.507293.patch
Type: text/x-patch
Size: 989 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230322/278e7a39/attachment.bin>
More information about the llvm-commits
mailing list