[PATCH] D146618: [ExecutionEngine] Fix R_AARCH64_ABS{16, 32} assertion

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 06:54:39 PDT 2023


MaskRay requested changes to this revision.
MaskRay added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:429
     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);
----------------
The change is incorrect.

`R_AARCH64_ABS16` permits either signed or unsigned narrow values. See https://github.com/ARM-software/abi-aa/blob/main/aaelf64/aaelf64.rst

The original assert conditions had off-by-1 issues, which I just fixed in 7b58259481417bb22d144a9c12ee8f4fb0a046e0.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146618/new/

https://reviews.llvm.org/D146618



More information about the llvm-commits mailing list