[clang] [Clang-REPL] Fix crash during `__run_exit_handlers` with dynamic libraries. (PR #117475)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 24 02:41:09 PST 2024
https://github.com/SahilPatidar created https://github.com/llvm/llvm-project/pull/117475
Apply the fix suggested by Lang Hames to address a crash in Clang-REPL that occurs during the execution of `__run_exit_handlers` when using dynamic libraries.
>From 559a2d05e0a3518cf59cd828bcf41a6de10a4e76 Mon Sep 17 00:00:00 2001
From: SahilPatidar <patidarsahil2001 at gmail.com>
Date: Sun, 24 Nov 2024 15:19:50 +0530
Subject: [PATCH] [Clang-REPL] Fix crash during `__run_exit_handlers` with
dynamic libraries
---
clang/lib/Interpreter/Interpreter.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp
index 5dc67f6375098f..71299f7176e2fe 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -719,7 +719,9 @@ llvm::Error Interpreter::LoadDynamicLibrary(const char *name) {
if (auto DLSG = llvm::orc::DynamicLibrarySearchGenerator::Load(
name, DL.getGlobalPrefix()))
- EE->getMainJITDylib().addGenerator(std::move(*DLSG));
+ // FIXME: Eventually we should put each library in its own JITDylib and
+ // turn off process symbols by default.
+ EE->getProcessSymbolsJITDylib()->addGenerator(std::move(*DLSG));
else
return DLSG.takeError();
More information about the cfe-commits
mailing list