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

Stefan Gränitz via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 22 07:04:02 PST 2023


https://github.com/weliveindetail created https://github.com/llvm/llvm-project/pull/76244

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

>From fb866e95c7a49f4763947624395422d5c38bebef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>
Date: Fri, 22 Dec 2023 15:46:05 +0100
Subject: [PATCH] [Orc] Fix process-symbols setup in LLJITBuilder for
 out-of-process case

---
 llvm/lib/ExecutionEngine/Orc/LLJIT.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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