From e7d432fd67c88d3c70be82ff0d424dd8993afb58 Mon Sep 17 00:00:00 2001 From: Jonas Hahnfeld Date: Sun, 1 Jan 2023 19:07:32 +0100 Subject: [PATCH] [JITLink][RISCV] Improve R_RISCV_JAL Only take the lower 12 bits of RawInstr. Differential Revision: https://reviews.llvm.org/D140820 --- llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp index f60953f..3fcc45e 100644 --- a/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp @@ -224,7 +224,8 @@ private: uint32_t Imm11 = extractBits(Value, 11, 1) << 20; uint32_t Imm19_12 = extractBits(Value, 12, 8) << 12; uint32_t RawInstr = *(little32_t *)FixupPtr; - *(little32_t *)FixupPtr = RawInstr | Imm20 | Imm10_1 | Imm11 | Imm19_12; + *(little32_t *)FixupPtr = + (RawInstr & 0xFFF) | Imm20 | Imm10_1 | Imm11 | Imm19_12; break; } case R_RISCV_CALL: { -- 2.7.4