<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=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Segoe UI";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.xmsonormal, li.xmsonormal, div.xmsonormal
        {mso-style-name:x_msonormal;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">What’s happening here is that the PE/COFF file format used by windows has a maximum of (2^16)-1 entries in the<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">export table, but the clang executable contains way more than that many symbols. The export_symbols.py script,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">which is run automatically when you use
</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON,
</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">is supposed to handle<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">this by using some heuristics to exclude symbols that wouldn’t be able to be imported anyway, but it looks like<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">it isn’t working correctly here for some reason.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Unfortunately I currently don’t have any spare time to help you with this. Building a release build, if you’re currently<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">doing a debug build, may help as the debug build has far more symbols.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">John<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Callum Laird [mailto:callum-laird98@hotmail.co.uk]
<br>
<b>Sent:</b> 18 July 2019 11:44<br>
<b>To:</b> John Brawn<br>
<b>Subject:</b> Re: Clang plugin help<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black">Hi John,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black">Thanks very much for your help. I tried using your method, but I'm having some difficulties. After a long time, the build (LLVM.sln) eventually failed, with the following error
 messages:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div>
<p style="margin-top:7.5pt;background:white"><span style="font-size:10.5pt;font-family:"Segoe UI","sans-serif";color:#1F497D">errors:</span><span style="font-size:10.5pt;font-family:"Segoe UI","sans-serif";color:#091E42"><o:p></o:p></span></p>
<p style="margin-top:7.5pt;background:white"><span style="font-size:10.5pt;font-family:"Segoe UI","sans-serif";color:#1F497D">Severity Code Description Project File Line Suppression State<br>
Error LNK1189 library limit of 65535 objects exceeded clang C:\Users\longspatula\llvm-project\build\tools\clang\tools\driver\LINK 1 <br>
Error LNK1104 cannot open file '..\..\..\..\Debug\lib\clang.lib' AnnotateFunctions C:\Users\longspatula\llvm-project\build\tools\clang\examples\AnnotateFunctions\LINK 1 <br>
Error LNK1104 cannot open file '..\..\..\..\Debug\lib\clang.lib' PrintFunctionNames C:\Users\longspatula\llvm-project\build\tools\clang\examples\PrintFunctionNames\LINK 1 <br>
Error MSB6006 "link.exe" exited with code 1104. PrintFunctionNames C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets 725 <br>
Error LNK1189 library limit of 65535 objects exceeded clang-interpreter C:\Users\longspatula\llvm-project\build\tools\clang\examples\clang-interpreter\LINK 1 </span><span style="font-size:10.5pt;font-family:"Segoe UI","sans-serif";color:#091E42"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black">If it's an issue with the size of the build, is there a good way to build only some of the libraries? I am only after those related to clang plugins.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black">Thanks again for your help,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black">Callum<o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black"> John Brawn <John.Brawn@arm.com><br>
<b>Sent:</b> 17 July 2019 12:28<br>
<b>To:</b> Callum Laird<br>
<b>Cc:</b> cfe-dev@lists.llvm.org; nd<br>
<b>Subject:</b> RE: Clang plugin help</span> <o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">If you’re using cmake and Visual Studios on Windows, then you need to:</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">* Add -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON to the cmake command. Due to</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">     the way dynamic linking works on Windows the symbols that the plugin needs have to</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">     be explicitly exported from clang, and this isn’t done by default. (Using
</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">     -DBUILD_SHARED_LIBS=ON would be a better solution, but last I checked it didn’t</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">     work with Visual Studio.)</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">* For the example plugins to build you need to make sure you run cmake with</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">    -DCLANG_BUILD_EXAMPLES=ON, as it’s off by default.</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">With that the example plugins should build as part of the default target when running</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">make. If you see in the cmake output the message “Loadable modules not supported on</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">this platform” then that means that something has caused plugins to be disabled.</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">John</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="xmsonormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> cfe-dev [mailto:cfe-dev-bounces@lists.llvm.org]
<b>On Behalf Of </b>Callum Laird via cfe-dev<br>
<b>Sent:</b> 16 July 2019 09:26<br>
<b>To:</b> cfe-dev@lists.llvm.org<br>
<b>Subject:</b> [cfe-dev] Clang plugin help</span><o:p></o:p></p>
</div>
</div>
<p class="xmsonormal"> <o:p></o:p></p>
<div>
<p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">Hi all,</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">I’ve been trying to get a Clang plugin working for a couple of weeks now on Windows/Visual Studio 2019, and I’m struggling quite a lot. So far, I’ve followed the instructions on
 the clang/llvm getting started page, and I’ve got the Clang complier working for C code in visual studio. I then tried to build one of the example plugins provided (such as PrintFunctionNames) using cmake and later make, but I’m having trouble knowing which
 file I’m supposed to use and I can’t find much in the way of resources/documentation online for windows stuff. Any and all help would be appreciated.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">Thanks!</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">Callum</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:"Calibri","sans-serif";color:black"> </span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>