[llvm] 1df20fa - [JITLink] Fix -Wparentheses warning in R_RISCV_SUB6 case.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 15 07:16:34 PDT 2022
Author: Simon Pilgrim
Date: 2022-03-15T14:13:28Z
New Revision: 1df20fa8f5aea8c59995f13f30d3212aa75ccdbc
URL: https://github.com/llvm/llvm-project/commit/1df20fa8f5aea8c59995f13f30d3212aa75ccdbc
DIFF: https://github.com/llvm/llvm-project/commit/1df20fa8f5aea8c59995f13f30d3212aa75ccdbc.diff
LOG: [JITLink] Fix -Wparentheses warning in R_RISCV_SUB6 case.
Perform the mask inside parentheses before applying the offset
Added:
Modified:
llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
index 1397daa8c2a0f..e772ae834e29b 100644
--- a/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
@@ -367,8 +367,8 @@ class ELFJITLinker_riscv : public JITLinker<ELFJITLinker_riscv> {
}
case R_RISCV_SUB6: {
int64_t Value =
- *(reinterpret_cast<const uint8_t *>(FixupAddress.getValue())) &
- 0x3f - E.getTarget().getAddress().getValue() - E.getAddend();
+ *(reinterpret_cast<const uint8_t *>(FixupAddress.getValue())) & 0x3f;
+ Value -= E.getTarget().getAddress().getValue() - E.getAddend();
*FixupPtr = (*FixupPtr & 0xc0) | (static_cast<uint8_t>(Value) & 0x3f);
break;
}
More information about the llvm-commits
mailing list