Skip to content

Commit e25187e

Browse files
committed
[lldb][RISCV] RISC-V large code model in lldb expressions
Function calls support in LLDB expressions for RISCV: 3 of 5 This patch sets large code model in MCJIT settings for RISC-V 64-bit targets that allows to make assembly jumps at any 64bit address. This is needed, because resulted jitted code may contain more that +-2GB jumps, that are not available in RISC-V with medium code model.
1 parent 994fdb1 commit e25187e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lldb/source/Expression/IRExecutionUnit.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,12 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
277277
.setMCJITMemoryManager(std::make_unique<MemoryManager>(*this))
278278
.setOptLevel(llvm::CodeGenOptLevel::Less);
279279

280+
// Resulted jitted code can be placed too far from the code in the binary
281+
// and thus can contain more than +-2GB jumps, that are not available
282+
// in RISC-V without large code model.
283+
if (triple.isRISCV64())
284+
builder.setCodeModel(llvm::CodeModel::Large);
285+
280286
llvm::StringRef mArch;
281287
llvm::StringRef mCPU;
282288
llvm::SmallVector<std::string, 0> mAttrs;

0 commit comments

Comments
 (0)