Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Clang-REPL] Fix crash during __run_exit_handlers with dynamic libraries. #117475

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SahilPatidar
Copy link
Contributor

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.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Nov 24, 2024
@llvmbot
Copy link
Member

llvmbot commented Nov 24, 2024

@llvm/pr-subscribers-clang

Author: None (SahilPatidar)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/117475.diff

1 Files Affected:

  • (modified) clang/lib/Interpreter/Interpreter.cpp (+3-1)
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();
 

@vgvassilev
Copy link
Contributor

It is worth adding a test here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants