[llvm] r285413 - [lli] Pass command line arguments in to the orc-lazy JIT.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 31 09:34:31 PDT 2016


On Fri, Oct 28, 2016 at 9:52 AM, Lang Hames via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: lhames
> Date: Fri Oct 28 11:52:34 2016
> New Revision: 285413
>
> URL: http://llvm.org/viewvc/llvm-project?rev=285413&view=rev
> Log:
> [lli] Pass command line arguments in to the orc-lazy JIT.
>
> This brings the LLI orc-lazy JIT's behavior more closely in-line with LLI's
> mcjit bahavior.
>
> Modified:
>     llvm/trunk/tools/lli/OrcLazyJIT.cpp
>     llvm/trunk/tools/lli/OrcLazyJIT.h
>     llvm/trunk/tools/lli/lli.cpp
>
> Modified: llvm/trunk/tools/lli/OrcLazyJIT.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/OrcLazyJIT.cpp?rev=285413&r1=285412&r2=285413&view=diff
> ==============================================================================
> --- llvm/trunk/tools/lli/OrcLazyJIT.cpp (original)
> +++ llvm/trunk/tools/lli/OrcLazyJIT.cpp Fri Oct 28 11:52:34 2016
> @@ -104,8 +104,8 @@ static PtrTy fromTargetAddress(JITTarget
>    return reinterpret_cast<PtrTy>(static_cast<uintptr_t>(Addr));
>  }
>
> -int llvm::runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms, int ArgC,
> -                        char* ArgV[]) {
> +int llvm::runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms,
> +                        const std::vector<std::string> &Args) {
>    // Add the program's symbols into the JIT's search space.
>    if (sys::DynamicLibrary::LoadLibraryPermanently(nullptr)) {
>      errs() << "Error loading program symbols.\n";
> @@ -152,7 +152,10 @@ int llvm::runOrcLazyJIT(std::vector<std:
>    }
>
>    typedef int (*MainFnPtr)(int, char*[]);
> +  std::vector<const char *> ArgV;
> +  for (auto &Arg : Args)
> +    ArgV.push_back(Arg.c_str());
>    auto Main = fromTargetAddress<MainFnPtr>(MainSym.getAddress());
> -  return Main(ArgC, ArgV);
> +  return Main(ArgV.size(), (char**)ArgV.data());
>  }

Hi Lang, gcc6.1 complained about a `const` qualifier being stripped.
No bots failed because we haven't such a configuration, but I care a
bit because I build with gcc7 (trunk) and -Werror.
I checked in a fix as r285592. Please let me know if it doesn't make
sense to you.

Thanks!

--
Davide


More information about the llvm-commits mailing list