OSDN Git Service

[lli] Fix ArgV setup bug when running in -jit-kind=orc-lazy mode.
authorLang Hames <lhames@gmail.com>
Thu, 27 Sep 2018 19:27:19 +0000 (19:27 +0000)
committerLang Hames <lhames@gmail.com>
Thu, 27 Sep 2018 19:27:19 +0000 (19:27 +0000)
ArgV[ArgC] should be null.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343255 91177308-0d34-0410-b5e6-96231b3b80d8

tools/lli/lli.cpp

index 49d5db1..4977ccc 100644 (file)
@@ -851,9 +851,12 @@ int runOrcLazyJIT(const char *ProgName) {
   std::vector<const char *> ArgV;
   for (auto &Arg : Args)
     ArgV.push_back(Arg.c_str());
+  ArgV.push_back(nullptr);
+
+  int ArgC = ArgV.size() - 1;
   auto Main =
       reinterpret_cast<MainFnPtr>(static_cast<uintptr_t>(MainSym.getAddress()));
-  auto Result = Main(ArgV.size(), (const char **)ArgV.data());
+  auto Result = Main(ArgC, (const char **)ArgV.data());
 
   // Wait for -entry-point threads.
   for (auto &AltEntryThread : AltEntryThreads)