forked from OSchip/llvm-project
parent
3f9568e921
commit
2ed4dc9f27
|
@ -601,10 +601,15 @@ ClangExpressionParser::PrepareForExecution (lldb::addr_t &func_allocation_addr,
|
||||||
}
|
}
|
||||||
llvm::Triple triple(module_ap->getTargetTriple());
|
llvm::Triple triple(module_ap->getTargetTriple());
|
||||||
llvm::Function *function = module_ap->getFunction (function_name.c_str());
|
llvm::Function *function = module_ap->getFunction (function_name.c_str());
|
||||||
|
llvm::Reloc::Model relocModel;
|
||||||
|
if (triple.isOSBinFormatELF())
|
||||||
|
relocModel = llvm::Reloc::Static;
|
||||||
|
else
|
||||||
|
relocModel = llvm::Reloc::PIC_;
|
||||||
EngineBuilder builder(module_ap.release());
|
EngineBuilder builder(module_ap.release());
|
||||||
builder.setEngineKind(EngineKind::JIT)
|
builder.setEngineKind(EngineKind::JIT)
|
||||||
.setErrorStr(&error_string)
|
.setErrorStr(&error_string)
|
||||||
.setRelocationModel(llvm::Reloc::PIC_)
|
.setRelocationModel(relocModel)
|
||||||
.setJITMemoryManager(jit_memory_manager)
|
.setJITMemoryManager(jit_memory_manager)
|
||||||
.setOptLevel(CodeGenOpt::Less)
|
.setOptLevel(CodeGenOpt::Less)
|
||||||
.setAllocateGVsWithCode(true)
|
.setAllocateGVsWithCode(true)
|
||||||
|
|
|
@ -294,6 +294,8 @@ RecordingMemoryManager::ReportAllocations (llvm::ExecutionEngine &engine)
|
||||||
|
|
||||||
engine.mapSectionAddress((void*)ai->m_local_start, ai->m_remote_start);
|
engine.mapSectionAddress((void*)ai->m_local_start, ai->m_remote_start);
|
||||||
}
|
}
|
||||||
|
// Trigger re-application of relocations.
|
||||||
|
engine.finalizeObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
Loading…
Reference in New Issue