<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=utf-8"><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;}
@font-face
{font-family:"Book Antiqua";
panose-1:2 4 6 2 5 3 5 3 3 4;}
/* 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;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Book Antiqua",serif;
color:#943634;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@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-IE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'>Thanks Erica and Marshall for trying this out and giving me some data points. The changes to LibC++ look incremental, but whatever is going on it is having a catastrophic impact on my implementation. I have a suspicion that our lack of support for weak extern linkage may be a factor.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'> MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Marshall Clow [mailto:mclow.lists@gmail.com] <br><b>Sent:</b> 12 October 2015 17:36<br><b>To:</b> Eric Fiselier <eric@efcs.ca>; Martin J. O'Riordan <martin.oriordan@movidius.com>; Marshall Clow <mclow.lists@gmail.com>; Evgenii Stepanov <eugeni.stepanov@gmail.com>; cfe-dev@lists.llvm.org<br><b>Subject:</b> Re: [cfe-dev] Big program size increase with LibC++ v3.7 versus v3.6<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><div><div><p class=MsoNormal>On Sun, Oct 11, 2015 at 3:36 PM, Eric Fiselier <<a href="mailto:eric@efcs.ca" target="_blank">eric@efcs.ca</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><div><p class=MsoNormal>I tried building and testing libc++ 3.6 on Linux but I couldn't easily reproduce. I built the 3.6 sources (using the ToT buildsystem) with -DCMAKE_BUILD_TYPE=RELEASE -DLIBCXX_ENABLE_SHARED=OFF -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON and then built the egrep test exactly like the test-suite normally would. I did the same with the current ToT. <o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><div><div><div><p class=MsoNormal>I did see a 10% size of the egrep test but nothing like 2x or 3x.<o:p></o:p></p></div></div></div></div></div></blockquote><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>That's what I'm seeing on Mac OS X as well<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>98K for 3.6, 106K for 3.7. (both built with -O3)<o:p></o:p></p></div><div><p class=MsoNormal>320K for both 3.6 and 3.7 when built without -O3<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>-- Marshall<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><div><div><div><div><p class=MsoNormal>On Sun, Oct 11, 2015 at 3:40 PM, Eric Fiselier <<a href="mailto:eric@efcs.ca" target="_blank">eric@efcs.ca</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><div><p class=MsoNormal>Off the top of my head I can't think of any one change that would cause this. CCing Marshall Clow to see if he knows. I'm also CC'ing Evgenii because he knows a lot about the visibility and inlining of libc++'s symbols.<o:p></o:p></p><div><div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Originally I thought it might be related to the external instantiations of std::basic_string,<o:p></o:p></p></div><div><p class=MsoNormal>but nothing should have changed between 3.6 and 3.7 in that regard. <o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>> Are there any ways of building the library with minimal or no locale support?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>No and I don't think libc++ should add one. We already support way to much<o:p></o:p></p></div><div><p class=MsoNormal>feature sub-setting. <o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#888888'><o:p> </o:p></span></p></div><div><div><p class=MsoNormal><span style='color:#888888'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:#888888'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:#888888'>/Eric<o:p></o:p></span></p></div><div><div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Sun, Oct 11, 2015 at 6:34 AM, Martin J. O'Riordan via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><p class=MsoNormal>Hi CFE Devs,<br><br>I have recently completed upgrading our CLang/LLVM based compiler from v3.6<br>to v3.7, but I was noticing some significant regressions in the LibC++<br>test-suite. Something has changed that is resulting in the code-size being<br>about 3X larger and the data size being about 2.7X larger.<br><br>Initially I suspected the compiler was at fault, so I did a series of builds<br>and comparisons to narrow down where the problem changes occurred. I'll<br>take one test as an example:<br><br> projects/libcxx/test/std/re/re.alg/re.alg.search/egrep.pass.cpp<br><br>With the v3.6 compiler and the v3.6 LibC++ library, this test was resulting<br>in a program with 122,916 Bytes of code and 6,240 Bytes of data. With the<br>v3.7 compiler and the v3.7 LibC++ this became 366,708 and 16,680<br>respectively! I don't know how this compares with other targets, so I can<br>only discuss our SHAVE program size.<br><br>At first I thought that perhaps we had broken something in LLVM, inlining<br>for example, so I tried the following:<br><br> Use the v3.7 compiler to run the tests, but with the v3.6 built LibC++<br> library and v3.6 LibC++ headers. This brought the figures to 127,940<br> and 6,240 respectively; much closer to the original.<br><br>But this still didn't rule out a fault in the compiler. So I tried the<br>following:<br><br> Use the v3.7 compiler to build the v3.6 LibC++ library, and again run<br> the tests using this library and the v3.6 LibC++ headers. This time I<br> got 127,940 and 6,288 Bytes respectively; very close to the v3.<br> compiler figures which would indicate that the compiler itself has not<br> caused this regression.<br><br>So I am wondering what has happened in the sources for LibC++ v3.7 that<br>could cause this?<br><br>What appears to be happening, is that the library is pulling in many more<br>symbols (hundreds) from the libraries even though they are never actually<br>executed, and a lot of these are related to 'char_traits' and<br>wide-characters; especially in the streams and stream iterators. I haven't<br>previously delved into the sources for the LibC++ library as my primary<br>focus is on the compiler (backend mainly), so I don't have enough experience<br>of the implementation of LibC++ to determine why this is. Examining the<br>header changes doesn't reveal any obvious smoking gun, though I did notice<br>that there are some significant 'traits' related changes to '<streambuf>'.<br><br>Our platform is for embedded deployment, so I we don't need rich locale<br>support (C locale is fine), nor Unicode or wide-characters. But I don't see<br>any configuration options in the sources for LibC++ that allows these to be<br>tuned for embedded systems. Are there any ways of building the library with<br>minimal or no locale support?<br><br>We build LibC++ as a static library with RTTI enabled, but with threads and<br>exception handling disabled ('__SINGLE_THREAD__', '_LIBCPP_NO_EXCEPTIONS',<br>'_LIBCPP_BUILD_STATIC', '_LIBCPP_HAS_NO_THREADS' and<br>'_LIBCPP_HAS_NO_MONOTONIC_CLOCK' are all defined).<br><br>For LibC we are using Newlib v2.2.0, and our assembler does not support weak<br>externals which might be relevant, but we do support ODR linkage and garbage<br>collection in the linker (all data & functions in discrete sections).<br><br>Is anybody else experiencing this kind of size increase in C++ programs<br>since migrating to v3.7? I have 507 LibC++ v3.7 test-cases which have<br>similarly increased versus the v3.6 version, mostly in the area of iterators<br>and streams.<br><br>Thanks,<br><br> MartinO - Movidius Ltd.<br><br><br>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><o:p></o:p></p></blockquote></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></div></div></div></div></div></blockquote></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></blockquote></div></div></div></div></body></html>