[cfe-dev] Running LLVMHello Pass from Clang(-cl)
Gaier, Bjoern via cfe-dev
cfe-dev at lists.llvm.org
Tue Nov 10 01:13:10 PST 2020
Hello everyone,
I build and run the LLVM (and clang) under Windows. I wanted to dive into the LLVM passes because I see a huge benefit in them for our project. So I made sure to configurate CMAKE with "CLANG_PLUGIN_SUPPORT", "LLVM_ENABLE_PLUGINS" and "LLVM_EXPORT_SYMBOLS_FOR_PLUGINS".
Except one project, everything build fine and I was able to execute "opt.exe" with the LLVMHello.dll - everything worked as expected!
However, then I tried using the DLL with Clang-Cl because this would be the way how to integrate it to our system. So I used:
clang-cl.exe -Xclang -load -Xclang LLVMHello.dll Test.cpp
However, this failed with:
clang-cl: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 12.0.0
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: D:\Program Files\LLVM_orc_removal\bin
clang-cl: note: diagnostic msg: Error generating preprocessed source(s).
If I remove the loading of LLVMHello.dll it works correctly again. I feel like, that LLVMHello.dll is not finding all the symbols needed. So I linked LLVMHello.dll with "clang.lib" instead of "opt.lib" - but with no success.
I also read that there are ways to include those passes directly into the source code of Clang, but I hoped to use this dynamic approach instead.
Any comments, ideas or something about this?
Kind greetings
Björn
Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Takashi Nagano, Junichi Tajika, Ergin Cansiz.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20201110/ac9a0ca7/attachment-0001.html>
More information about the cfe-dev
mailing list