diff options
-rw-r--r-- | llvm/include/llvm/ExecutionEngine/Orc/Core.h | 8 | ||||
-rw-r--r-- | llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h | 11 | ||||
-rw-r--r-- | llvm/tools/lli/lli.cpp | 6 |
3 files changed, 23 insertions, 2 deletions
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Core.h b/llvm/include/llvm/ExecutionEngine/Orc/Core.h index 58bd957500c..d39271ada00 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Core.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Core.h @@ -681,6 +681,10 @@ private: void emit(const SymbolFlagsMap &Emitted); + // Removes the given symbols from the symbol table, returning the set of + // pending queries. + AsynchronousSymbolQuery removeSymbols(const SymbolNameSet &Symbols); + void notifyFailed(const SymbolNameSet &FailedSymbols); ExecutionSession &ES; @@ -731,6 +735,10 @@ public: JITDylib *getJITDylibByName(StringRef Name); /// Add a new JITDylib to this ExecutionSession. + /// + /// The JITDylib Name is required to be unique. Clients should verify that + /// names are not being re-used (e.g. by calling getJITDylibByName) if names + /// are based on user input. JITDylib &createJITDylib(std::string Name, bool AddToMainDylibSearchOrder = true); diff --git a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h index 3104de5e463..b54c7d882e2 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h @@ -51,7 +51,18 @@ public: /// Returns a reference to the JITDylib representing the JIT'd main program. JITDylib &getMainJITDylib() { return Main; } + /// Returns the JITDylib with the given name, or nullptr if no JITDylib with + /// that name exists. + JITDylib *getJITDylibByName(StringRef Name) { + return ES->getJITDylibByName(Name); + } + /// Create a new JITDylib with the given name and return a reference to it. + /// + /// JITDylib names must be unique. If the given name is derived from user + /// input or elsewhere in the environment then the client should check + /// (e.g. by calling getJITDylibByName) that the given name is not already in + /// use. JITDylib &createJITDylib(std::string Name) { return ES->createJITDylib(std::move(Name)); } diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index a44b7437f70..fb6cf6ff915 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/tools/lli/lli.cpp @@ -821,8 +821,10 @@ int runOrcLazyJIT(const char *ProgName) { IdxToDylib[0] = &J->getMainJITDylib(); for (auto JDItr = JITDylibs.begin(), JDEnd = JITDylibs.end(); JDItr != JDEnd; ++JDItr) { - IdxToDylib[JITDylibs.getPosition(JDItr - JITDylibs.begin())] = - &J->createJITDylib(*JDItr); + orc::JITDylib *JD = J->getJITDylibByName(*JDItr); + if (!JD) + JD = &J->createJITDylib(*JDItr); + IdxToDylib[JITDylibs.getPosition(JDItr - JITDylibs.begin())] = JD; } for (auto EMItr = ExtraModules.begin(), EMEnd = ExtraModules.end(); |