[llvm-dev] Supporting LLVM_BUILD_LLVM_DYLIB on Windows

Michael Kruse via llvm-dev
Thu, 09 Sep 2021 02:20:40 -0000

+1

I would even go as far to make libLLVM.dll (and libClang.dll?) the
only (supported) configuration on Windows. The reason is that we
currently cannot properly support plugins on Windows because these
plugins need to know from which file to import symbols from.
llvm_add_library has a PLUGIN_TOOL parameter to set this, but
consequently the plugin can only be used with that tool (typically
opt.exe), but to have a plugin for another executable like clang.exe,
one would need another plugin binary and yet another one different one
for clang-cl.exe etc. Having a canonical libLLVM.so for all
tools+clang would finally allow us to support plugins one Windows(*).

Also note previous discussion on this, e.g. [1]. [2] already suggests
to introduce component-specific headers, from where
dllimport/dllexport could be controlled.

Michael

(*) IMHO, the plugin system is currently broken under Linux as well.
The plugin may need to link against symbols which simply do not exist
in the target executable because the tool itself does not need them
and have not been added by the linker.
[1] https://lists.llvm.org/pipermail/llvm-dev/2021-June/150860.html
[2] https://lists.llvm.org/pipermail/llvm-dev/2021-June/151187.html