Pass plugins introduced D61446 do not support dynamic linking on Windows, hence the option LLVM_${name_upper}_LINK_INTO_TOOLS can only work being set to "ON". Currently, it defaults to "OFF" such that such plugins are inoperable by default on Windows. Change the default for subprojects to follow LLVM_ENABLE_PROJECTS.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I don't really understand the mechanism on Windows. Hope @serge-sans-paille can confirm.
llvm/cmake/modules/AddLLVM.cmake | ||
---|---|---|
873–880 | The convention seems that there is no space before ( |
I like the idea but
- I'm unsure it's fine to have a different default for different platform (but that's arguable)
- This would link the *example* Bye plugin statically, which is not something we want (and that's critical).
One workaround would be to warn the user if the setting is set to OFF on Windows, or disable the test on Windows?
IMHO it is worse if the default settings don't even work. We also have such different default already, e.g. for LLVM_ENABLE_MODULE_DEBUGGING (enabled by default only on MacOS) and LLVM_ENABLE_PLUGINS.
- This would link the *example* Bye plugin statically, which is not something we want (and that's critical).
I agree. Ideally, we find a common solution for all example/tutorial code.
One workaround would be to warn the user if the setting is set to OFF on Windows
The OFF setting yields a broken build and as a consequence could even not used. It happens that the dll still builds/links but I wouldn't rely on that.
, or disable the test on Windows?
I dislike disabling tests/examples even though they are supposed to work.
Currently, loadable module give a warning "LLVMHello ignored -- Loadable modules not supported on this platform." We could do the same here with the message explaining how to enable it.
(Actually enabling LLVMHello on Windows requires setting more flags such as LLVM_ENABLE_PLUGINS and LLVM_EXPORT_SYMBOLS_FOR_PLUGINS)
On the other side, I would also like to see -DLLVM_ENABLE_PROJECT=polly to just work. Any ideas?
Currently, loadable module give a warning "LLVMHello ignored -- Loadable modules not supported on this platform." We could do the same here with the message explaining how to enable it.
On the other side, I would also like to see -DLLVM_ENABLE_PROJECT=polly to just work. Any ideas?
What if, in addition of the current diff, you'd just disable the Bye test on windows when compiled statically? With the proper comment, it looks like a good compromise as of now. Ican't think of any simple way to test static builds without introducing more cmake variables...
I talked with @hfinkel about this and think that we should distinct between example passes (static linking has to be enabled explicitly) and project (enabled using LLVM_ENABLE_PROJECT). I will update this diff by adding an option to add_llvm_pass_plugin.
@Meinersbur, thank you for taking the time to look at linkage on windows. Could you please give a concrete example of an issue that this patch resolves?
I am currently troubleshooting a breakage caused by D61446, and I am wondering if it might be related.
nit: *the plugin will link it statically by default if...*