<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 7, 2017 at 7:50 AM, Martin J. O'Riordan <span dir="ltr"><<a href="mailto:martin.oriordan@movidius.com" target="_blank">martin.oriordan@movidius.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-IE" link="blue" vlink="purple"><div class="m_4187888411821587873WordSection1"><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:black">Hi Eric,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:black">In the email I sent on the 27<sup>th</sup> April (“[LibC++] Bug in implementation of 'std::shared_ptr'”), the problem I was seeing was:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:black">  o  LibC++ library built with -DLIBCXX_ENABLE_RTTI=ON and -D_LIBCPP_BUILD_STATIC.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:black">  o  User code compiled with ‘-fno-rtti -D_LIBCPP_BUILD_STATIC’.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:black">Having ‘_LIBCPP_BUILD_STATIC’ defined by both the library builder and the library user was where it broke.  I removed ‘-D_LIBCPP_BUILD_STATIC’ from the user and it worked.  But I wasn’t building the static library with RTTI disabled because it is stated as an unsupported configuration.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:black">So are you advising that with the proposed fix, that I should revert to defining ‘_LIBCPP_BUILD_STATIC’ as the user?</span></p></div></div></blockquote><div><br></div><div>`_LIBCPP_BUILD_STATIC` has been removed entirely by the change. It fixes your bug by making the vtable consistent across all configurations.</div><div><br></div><div> /Eric</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-IE" link="blue" vlink="purple"><div class="m_4187888411821587873WordSection1"><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:black"><u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:black">Thanks,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:black">            MartinO<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#943634"><u></u> <u></u></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"> Eric Fiselier [mailto:<a href="mailto:eric@efcs.ca" target="_blank">eric@efcs.ca</a>] <br><b>Sent:</b> 04 May 2017 00:43<br><b>To:</b> clang developer list <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br><b>Cc:</b> Marshall Clow <<a href="mailto:mclow.lists@gmail.com" target="_blank">mclow.lists@gmail.com</a>>; Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>>; Ed Maste <<a href="mailto:emaste@freebsd.org" target="_blank">emaste@freebsd.org</a>>; Martin J. O'Riordan <<a href="mailto:martin.oriordan@movidius.com" target="_blank">martin.oriordan@movidius.com</a>><wbr>; Anton Korobeynikov <<a href="mailto:anton@korobeynikov.info" target="_blank">anton@korobeynikov.info</a>><br><b>Subject:</b> [RFC] Possible ABI break for libc++ built with -fno-rtti and -D_LIBCPP_BUILD_STATIC<u></u><u></u></span></p><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">Hi All,<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Libc++ currently has an ABI incompatibility when built as a static library with no RTTI. Specifically some std::shared_ptr internals have different vtable layouts in this configuration.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I would like to fix this by making the vtable definition consistent across all configurations, but that requires breaking the ABI of a very rare configuration of libc++. I suspect all users of this configuration can take the ABI break immediately, but I would like to confirm this before proceeding.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">The configuration in question is a static libc++ library built with -DLIBCXX_ENABLE_RTTI=OFF and -D_LIBCPP_BUILD_STATIC,<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Is anybody using this configuration and can't take an ABI break?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Note that `_LIBCPP_BUILD_STATIC` must be manually defined by the user at both when building and using libc++, and it is not supported by the CMake build system. This should mean that almost nobody is defining it.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">The proposed changes can be found here: <a href="https://reviews.llvm.org/D32838" target="_blank">https://reviews.llvm.<wbr>org/D32838</a><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">/Eric<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></div></div></blockquote></div><br></div></div>