[llvm] 945c2e6 - [Orc] Fix process-symbols setup in LLJITBuilder for out-of-process case (#76244)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 1 10:08:08 PST 2024


Author: Stefan Gränitz
Date: 2024-01-01T19:08:04+01:00
New Revision: 945c2e6d92337fe4682227fb7c6ee165fd0d9384

URL: https://github.com/llvm/llvm-project/commit/945c2e6d92337fe4682227fb7c6ee165fd0d9384
DIFF: https://github.com/llvm/llvm-project/commit/945c2e6d92337fe4682227fb7c6ee165fd0d9384.diff

LOG: [Orc] Fix process-symbols setup in LLJITBuilder for out-of-process case (#76244)

For out-of-process support the DynamicLibrarySearchGenerator must go
through EPC, otherwise we lookup symbols from the host and not the
target process.

Added: 
    

Modified: 
    llvm/lib/ExecutionEngine/Orc/LLJIT.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index a19e170298106b..e259c393d07e03 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -768,11 +768,11 @@ Error LLJITBuilderState::prepareForConstruction() {
   // create a default one.
   if (!SetupProcessSymbolsJITDylib && LinkProcessSymbolsByDefault) {
     LLVM_DEBUG(dbgs() << "Creating default Process JD setup function\n");
-    SetupProcessSymbolsJITDylib = [this](LLJIT &J) -> Expected<JITDylibSP> {
+    SetupProcessSymbolsJITDylib = [](LLJIT &J) -> Expected<JITDylibSP> {
       auto &JD =
           J.getExecutionSession().createBareJITDylib("<Process Symbols>");
-      auto G = orc::DynamicLibrarySearchGenerator::GetForCurrentProcess(
-          DL->getGlobalPrefix());
+      auto G = EPCDynamicLibrarySearchGenerator::GetForTargetProcess(
+          J.getExecutionSession());
       if (!G)
         return G.takeError();
       JD.addGenerator(std::move(*G));


        


More information about the llvm-commits mailing list