aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/lli/lli.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/lli/lli.cpp')
-rw-r--r--llvm/tools/lli/lli.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index c322b4f..875ec1b 100644
--- a/llvm/tools/lli/lli.cpp
+++ b/llvm/tools/lli/lli.cpp
@@ -1084,11 +1084,15 @@ int runOrcJIT(const char *ProgName) {
// If this is a Mingw or Cygwin executor then we need to alias __main to
// orc_rt_int_void_return_0.
- if (J->getTargetTriple().isOSCygMing())
- ExitOnErr(J->getProcessSymbolsJITDylib()->define(
+ if (J->getTargetTriple().isOSCygMing()) {
+ auto &WorkaroundJD = J->getProcessSymbolsJITDylib()
+ ? *J->getProcessSymbolsJITDylib()
+ : J->getMainJITDylib();
+ ExitOnErr(WorkaroundJD.define(
orc::absoluteSymbols({{J->mangleAndIntern("__main"),
{orc::ExecutorAddr::fromPtr(mingw_noop_main),
JITSymbolFlags::Exported}}})));
+ }
// Regular modules are greedy: They materialize as a whole and trigger
// materialization for all required symbols recursively. Lazy modules go