[clang] [Clang-REPL] Fix crash during `__run_exit_handlers` with dynamic libraries. (PR #117475)

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 25 22:50:07 PST 2024


vgvassilev wrote:

> I came across the following setup:
> 
> ```c++
> // REQUIRES: host-supports-jit
> 
> // RUN: rm -rf %t
> // RUN: mkdir -p %t
> //
> // RUN: split-file %s %t
> //
> // RUN: %clang++ -std=c++20 -fPIC -c %t/vec.cpp -o %t/vec.o
> // RUN: %clang++ -shared %t/vec.o -o %t/vec.dylib
> //
> // RUN: cat %t/Test.cpp | DYLD_LIBRARY_PATH=%t:$DYLD_LIBRARY_PATH clang-repl
> 
> //--- vec.cpp
> #include <vector>
> 
> //--- Test.cpp
> %lib vec.dylib
> #include <vector>
> std::vector<int> v;
> %quit
> ```

Hm, okay, would that work on linux? If so, then I guess we can follow that pattern.

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


More information about the cfe-commits mailing list