<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-GB">Hello everyone,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">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”.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Except one project, everything build fine and I was able to execute “opt.exe” with the LLVMHello.dll – everything worked as expected!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">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:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">clang-cl.exe -Xclang -load -Xclang LLVMHello.dll Test.cpp<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">However, this failed with:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">clang-cl: error: clang frontend command failed due to signal (use -v to see invocation)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">clang version 12.0.0<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Target: x86_64-pc-windows-msvc<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Thread model: posix<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">InstalledDir: D:\Program Files\LLVM_orc_removal\bin<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">clang-cl: note: diagnostic msg: Error generating preprocessed source(s).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">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.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Any comments, ideas or something about this?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Kind greetings<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Björn<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
</div>
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.
</body>
</html>