Author: compnerd Date: Wed May 22 16:23:39 2019 New Revision: 361443 URL: http://llvm.org/viewvc/llvm-project?rev=361443&view=rev Log: Expression: correct relocation model for Windows
The Windows Code Generation model cannot generation code with the PIC relocation model - all code is implicitly position independent due to the DLL load slide that occurs if it is not loaded at the preferred base address. Invert the condition and inline the single use of the variable. This should also aid the WASM target. This significantly improves the state of the (swift) repl on Windows (and should aid in expression evaluation on Windows). Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=361443&r1=361442&r2=361443&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original) +++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Wed May 22 16:23:39 2019 @@ -258,23 +258,17 @@ void IRExecutionUnit::GetRunnableInfo(St log->Printf("Module being sent to JIT: \n%s", s.c_str()); } - llvm::Triple triple(m_module->getTargetTriple()); - llvm::Reloc::Model relocModel; - - if (triple.isOSBinFormatELF()) { - relocModel = llvm::Reloc::Static; - } else { - relocModel = llvm::Reloc::PIC_; - } - m_module_up->getContext().setInlineAsmDiagnosticHandler(ReportInlineAsmError, &error); llvm::EngineBuilder builder(std::move(m_module_up)); + llvm::Triple triple(m_module->getTargetTriple()); builder.setEngineKind(llvm::EngineKind::JIT) .setErrorStr(&error_string) - .setRelocationModel(relocModel) + .setRelocationModel(triple.isOSBinFormatMachO() + ? llvm::Reloc::PIC_ + : llvm::Reloc::Static) .setMCJITMemoryManager( std::unique_ptr<MemoryManager>(new MemoryManager(*this))) .setOptLevel(llvm::CodeGenOpt::Less); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits