[llvm] [llvm-jitlink] Explicit exports for builtin runtime functions in MinGW executables (PR #107375)

Stefan Gränitz via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 03:04:51 PDT 2024


weliveindetail wrote:

Background: Since MSVC limits the number of exported symbols (LNK1189) our CMake implementation silently skips auto-export: https://github.com/llvm/llvm-project/blob/release/19.x/llvm/cmake/modules/AddLLVM.cmake#L1357-L1359

Alternatively, we could [follow clang-repl](https://github.com/llvm/llvm-project/blob/release/19.x/clang/tools/clang-repl/CMakeLists.txt) and use `LLVM_EXPORT_SYMBOLS_FOR_PLUGINS`. I tested that and quickly ran into errors:
1. the [extract_symbols.py helper script](https://github.com/llvm/llvm-project/blob/release/19.x/llvm/utils/extract_symbols.py) couldn't deal with `zlib::zlib` style dependencies
2. apparently it collected symbols from lib files, that were dropped in the executable (causing the link to fail)

We might be able to fix that, however, clang-repl still needs to add explicit exports for specific symbols. Usually, we really need just a few anyway, so I'd opt for the solution in this patch. Except anyone has a good reason not to? :)

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


More information about the llvm-commits mailing list