Issue 235470
Summary [clang] Unable to build with ClangIR with LLVM_LINK_LLVM_DYLIB for mingw targets
Labels platform:windows, ClangIR
Assignees
Reporter mstorsjo
    Since dfd756d1b830ff810644d19ed1eb7ff5f08a8585, ClangIR (`CLANG_ENABLE_CIR`) is enabled by default.

Previously, it was possible to build for mingw targets with `LLVM_LINK_LLVM_DYLIB` enabled, which builds `libclang-cpp.dll` and links `clang.exe` against it. (These mingw builds don't use the explicit dllexport annotations, but just exports all symbols, except for symbols that explicitly have been marked as hidden - such as symbols in llvm/lib/Targets and similar; building this way has worked for a number of years so far.)

After enabling ClangIR, building with `LLVM_LINK_LLVM_DYLIB` fails with errors like this:
```
ld.lld: error: too many exported symbols (got 94721, max 65535)
```

I hit this in my nightly builds of llvm-mingw at e.g. https://github.com/mstorsjo/llvm-mingw/actions/runs/39713632610/job/119673602900.

Without ClangIR, the number of exported symbols from `libclang-cpp.dll` is around 43k - i.e. a decent margin left until the limit of 64k symbols - but enabling ClangIR adds another 51k symbols, pushing it way past the limit of 64k symbols.

For llvm-mingw, I disabled ClangIR for now in https://github.com/mstorsjo/llvm-mingw/commit/14a17396dfc53d01e82f9125c4da86203aa40a9f.

If we want to build clang with dylibs for Windows, with ClangIR, we probably need to split out one more separate dylib - e.g. building the MLIR parts as one dylib.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to