<div dir="ltr">Hi Ivan,<div><br></div><div>Thanks for pointing out Clang plugins as a viable alternative for my proposal.  We had considered writing the tools as a plugin but decided against it - due to some rough edges with Android's build system.</div><div><br></div><div>For now, we decided to carry build rules for the proposed library in downstream.  I've updated my change (<a href="https://reviews.llvm.org/D50359" rel="noreferrer" target="_blank">https://reviews.llvm.org/D50359</a>) to make it more general, and will leave it open in case there's more interest to revive it in the future.</div><div><br></div><div>Thanks,</div><div>-Pirama</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 6, 2018 at 11:28 PM Ivan Donchevskii <<a href="mailto:ivan.donchevskii@qt.io" target="_blank">ivan.donchevskii@qt.io</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div id="m_5523803754402993032m_1068521902158843053divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi!</p>
<p style="margin-top:0;margin-bottom:0">I think I meant <span style="font-size:12pt">CLANG_PLUGIN_SUPPORT flag which enables </span><span style="font-size:12pt;color:rgb(0,103,124)">export_executable_symbols</span><span style="font-size:12pt">(clang)
 in <span>tools\clang\tools\driver\CMakeLists.txt</span></span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size:12pt"><span>Probably in combination with </span></span><span style="font-size:12pt">LLVM_EXPORT_SYMBOLS_FOR_PLUGINS.</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size:12pt"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size:12pt">Ivan</span></p>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_5523803754402993032m_1068521902158843053divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Pirama Arumuga Nainar <<a href="mailto:pirama@google.com" target="_blank">pirama@google.com</a>><br>
<b>Sent:</b> Monday, August 6, 2018 10:53:29 PM<br>
<b>To:</b> Ivan Donchevskii; cfe-dev list<br>
<b>Cc:</b> Tzu-hsiang Chien; Stephen Hines<br>
<b>Subject:</b> Re: [cfe-dev] libclang shared library that exports all symbols</font>
<div> </div>
</div>

<div>
<div dir="ltr"><br>
<br>
<div class="m_5523803754402993032m_1068521902158843053x_gmail_quote">
<div dir="ltr">On Fri, Aug 3, 2018 at 1:37 AM Ivan Donchevskii <<a href="mailto:ivan.donchevskii@qt.io" target="_blank">ivan.donchevskii@qt.io</a>> wrote:<br>
</div>
<blockquote class="m_5523803754402993032m_1068521902158843053x_gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div id="m_5523803754402993032m_1068521902158843053x_gmail-m_-4495702918448391807m_-7398561474145650899divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0px;margin-bottom:0px">Hi!<br>
Why do you need to mix C++ symbols with what libclang exports?</p>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>My reasoning was that the C/C++ difference was already imposed by the headers included by a libclang.so user.  But I also see why limiting the exported symbols can catch user errors.</div>
<div> </div>
<blockquote class="m_5523803754402993032m_1068521902158843053x_gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div id="m_5523803754402993032m_1068521902158843053x_gmail-m_-4495702918448391807m_-7398561474145650899divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0px;margin-bottom:0px">Doesn't it make sense to have separate clang.so instead? I also think there's already a possibility to build such library by providing some LLVM flags.</p>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>I think you mean LLVM_ENABLE_SHARED?  That builds each individual library (libclangAST, libclangDriver etc) as shared libraries, rather than producing a single shared library.  I am not aware of any other option that can help.</div>
<div><br>
</div>
<div>To clarify my proposal, I've uploaded a patch (<a href="https://reviews.llvm.org/D50359" target="_blank">https://reviews.llvm.org/D50359</a>) that adds this new library.  The library is named libclang-cxx in that patch - which I think is slightly more informative than
 libclang-full.</div>
<div><br>
</div>
<div>Please add comments in the patch or to this discussions.</div>
<div><br>
</div>
<blockquote class="m_5523803754402993032m_1068521902158843053x_gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div id="m_5523803754402993032m_1068521902158843053x_gmail-m_-4495702918448391807m_-7398561474145650899divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">Kind regards,</p>
<p style="margin-top:0px;margin-bottom:0px">Ivan</p>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_5523803754402993032m_1068521902158843053x_gmail-m_-4495702918448391807m_-7398561474145650899divRplyFwdMsg" dir="ltr">
<font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> cfe-dev <<a href="mailto:cfe-dev-bounces@lists.llvm.org" target="_blank">cfe-dev-bounces@lists.llvm.org</a>> on behalf of Pirama Arumuga Nainar via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>
<b>Sent:</b> Thursday, August 2, 2018 11:48:16 PM<br>
<b>To:</b> cfe-dev list<br>
<b>Cc:</b> Tzu-hsiang Chien<br>
<b>Subject:</b> Re: [cfe-dev] libclang shared library that exports all symbols</font>
<div> </div>
</div>
<div>
<div dir="ltr">Ping for any thoughts on this proposal...</div>
<br>
<div class="m_5523803754402993032m_1068521902158843053x_gmail-m_-4495702918448391807m_-7398561474145650899x_gmail_quote">
<div dir="ltr">On Thu, Jul 26, 2018 at 3:59 PM Pirama Arumuga Nainar <<a href="mailto:pirama@google.com" target="_blank">pirama@google.com</a>> wrote:<br>
</div>
<blockquote class="m_5523803754402993032m_1068521902158843053x_gmail-m_-4495702918448391807m_-7398561474145650899x_gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">libclang.so exports only the symbols needed by the C API.  This is in contrast to libLLVM.so that exports all symbols from the LLVM static libraries.  Would it be useful to provide a libclang shared library that exports all symbols for use by
 tools that use Clang's (admittedly non-backwards-compatible) C++ API?
<div><br>
</div>
<div>We can either:</div>
<div>1. Add a new shared library (libclang_full.so?) that is built based on a CMake option.</div>
<div>2. Export all symbols from the current libclang.so.  We'd have to also include a few additional libraries such as libClangAnalysis.  Tools using the C API are still restricted to the stable interface if they use the clang-c headers.</div>
<div><br>
</div>
<div>Motivation:</div>
<div>There are a few Clang-based tools used by Android's build system (1, 2) that use the C++ API.  They are built using Android build rules but need to link against Android's Clang toolchain that's built with CMake.  We don't want to include the libclang static
 libraries with the toolchain for space considerations, and also to avoid exposing Clang's build internals (internal library dependences and changes to them) to downstream tools.</div>
<div><br>
</div>
<div>Do other Clang/LLVM toolchain maintainers face similar issues and have solutions that are applicable here?</div>
<div><br>
</div>
<div>[1] <a href="https://android.googlesource.com/platform/development/+/master/vndk/tools/header-checker/" target="_blank">https://android.googlesource.com/platform/development/+/master/vndk/tools/header-checker/</a></div>
<div>[2] <a href="https://android.googlesource.com/platform/development/+/master/vndk/tools/vtable-dumper/" target="_blank">https://android.googlesource.com/platform/development/+/master/vndk/tools/vtable-dumper/</a></div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>

</blockquote></div>