From ee88a8767af356c6c1e1d839e3d3057d7beff627 Mon Sep 17 00:00:00 2001 From: Daniil Avdeev Date: Fri, 2 Aug 2024 09:41:27 +0000 Subject: [PATCH] [lldb][RISCV] PIC for RISCV64 MCJIT Function calls support in LLDB expressions for RISCV: 3 of 6 This patch allows to access .rodata section from lldb expressions (like string literals). --- lldb/source/Expression/IRExecutionUnit.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp index f220704423627d..31402020dc4eff 100644 --- a/lldb/source/Expression/IRExecutionUnit.cpp +++ b/lldb/source/Expression/IRExecutionUnit.cpp @@ -281,8 +281,9 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr, builder.setEngineKind(llvm::EngineKind::JIT) .setErrorStr(&error_string) - .setRelocationModel(triple.isOSBinFormatMachO() ? llvm::Reloc::PIC_ - : llvm::Reloc::Static) + .setRelocationModel((triple.isOSBinFormatMachO() || triple.isRISCV64()) + ? llvm::Reloc::PIC_ + : llvm::Reloc::Static) .setMCJITMemoryManager(std::make_unique(*this)) .setOptLevel(llvm::CodeGenOptLevel::Less);