[clang] [clang-repl] Handle mllvm args for clang-repl before calling executeAction (PR #197133)

Anutosh Bhat via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 6 22:07:50 PDT 2026


anutosh491 wrote:

> -- DoublerPlugin ignored -- Loadable modules not supported on this platform.
CMake Error at unittests/Support/DynamicLibrary/CMakeLists.txt:36 (add_library):
  ADD_LIBRARY called with MODULE option but the target platform does not
  support dynamic linking.
Call Stack (most recent call first):
  unittests/Support/DynamicLibrary/CMakeLists.txt:72 (dynlib_add_module)
  
> It looks like your skating around the fact the LLVM_ENABLE_PIC=ON setting causes an issue for the Emscripten build llvm>22.

Both these things will be fixed if we move to emscripten 6x

- 6.0.6 introduces support for shared builds through emscripten (so the MODULE option would be covered)
- We need PIC (`-fpic`) ... it's not that which causes the problem. The problem is caused through 
```
if(LLVM_ENABLE_PIC)
  add_llvm_library(LTO SHARED ...)
endif()
```
And we were failing to build LTO in a shared way ! But again moving to emscripten 6x would fix this naturally 

Check here : https://github.com/emscripten-forge/recipes/pull/6579


>  Your first steps says its building the native tblgen, but you have -DLLVM_TARGETS_TO_BUILD="WebAssembly" so it clearly isn't the native tblgen.

`-DLLVM_TARGETS_TO_BUILD="WebAssembly"` does not decide whether llvm-tblgen runs natively or as WebAssembly. It selects which LLVM code-generation backends are included/generated !! 

Here's some proof  :)
```
anutosh491 at Anutoshs-MacBook-Air recipes % file /private/tmp/clang-repl-native-tools.3jnRz8/bin/llvm-tblgen
file /private/tmp/clang-repl-native-tools.3jnRz8/bin/clang-tblgen
/private/tmp/clang-repl-native-tools.3jnRz8/bin/llvm-tblgen: Mach-O 64-bit executable arm64
/private/tmp/clang-repl-native-tools.3jnRz8/bin/clang-tblgen: Mach-O 64-bit executable arm64
```


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


More information about the cfe-commits mailing list