<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Ah I see. I think r309474 should fix our problem.<div class=""><br class=""></div><div class="">Thanks for your quick response.<br class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 22, 2017, at 6:28 PM, Shoaib Meenai <<a href="mailto:smeenai@fb.com" class="">smeenai@fb.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">The point of the extern template was to prevent that operator from being defined in any other object files. The extern template wasn't taking effect because of its placement in the file, but I fixed that in r309474. Does your issue get resolved with that second change in place?<o:p class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="border-style: solid none none; border-top-width: 1pt; border-top-color: rgb(181, 196, 223); padding: 3pt 0in 0in;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><b class=""><span style="font-size: 12pt;" class="">From:<span class="Apple-converted-space"> </span></span></b><span style="font-size: 12pt;" class=""><<a href="mailto:ahatanaka@apple.com" class="">ahatanaka@apple.com</a>> on behalf of Akira Hatanaka <<a href="mailto:ahatanaka@apple.com" class="">ahatanaka@apple.com</a>><br class=""><b class="">Date:<span class="Apple-converted-space"> </span></b>Tuesday, August 22, 2017 at 6:21 PM<br class=""><b class="">To:<span class="Apple-converted-space"> </span></b>Shoaib Meenai <<a href="mailto:smeenai@fb.com" class="">smeenai@fb.com</a>><br class=""><b class="">Cc:<span class="Apple-converted-space"> </span></b>"<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a>" <<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a>><br class=""><b class="">Subject:<span class="Apple-converted-space"> </span></b>Re: [libcxx] r307966 - [libc++] Mark string operator+ _LIBCPP_FUNC_VIS<o:p class=""></o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">This change makes it impossible to change the visibility of operator+ with -fvisibility=hidden, which is not desirable on Darwin.<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">For example:<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">$ cat test.cpp<o:p class=""></o:p></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 8.5pt; font-family: Menlo, sans-serif;" class="">#include <string><o:p class=""></o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 8.5pt; font-family: Menlo, sans-serif;" class=""><o:p class=""> </o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 8.5pt; font-family: Menlo, sans-serif;" class="">using namespace std;<o:p class=""></o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 8.5pt; font-family: Menlo, sans-serif;" class=""><o:p class=""> </o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 8.5pt; font-family: Menlo, sans-serif;" class="">string foo1(string s) {<o:p class=""></o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 8.5pt; font-family: Menlo, sans-serif;" class="">  return "abc" + s;<o:p class=""></o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 8.5pt; font-family: Menlo, sans-serif;" class="">}<o:p class=""></o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><br class=""><br class=""><o:p class=""></o:p></div></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">$ clang++ test.cpp -fvisibility=hidden -c; nm -m -a test.o | grep <span style="font-size: 8.5pt; font-family: Menlo, sans-serif; background-color: white; background-position: initial initial; background-repeat: initial initial;" class="">__ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EEPKS6_RKS9_</span><o:p class=""></o:p></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; background-color: white;" class=""><span style="font-size: 8.5pt; font-family: Menlo, sans-serif;" class="">0000000000000030 (__TEXT,__text) weak external __ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EEPKS6_RKS9_<o:p class=""></o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div></div></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">The symbol used to be “weak private external”, but it is “weak external” now.<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div></div><div class=""><div class=""><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">On Jul 13, 2017, at 2:35 PM, Shoaib Meenai via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" style="color: purple; text-decoration: underline;" class="">cfe-commits@lists.llvm.org</a>> wrote:<o:p class=""></o:p></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Author: smeenai<br class="">Date: Thu Jul 13 14:35:52 2017<br class="">New Revision: 307966<br class=""><br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D307966-26view-3Drev&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=fSgXogPdeBdhqIn59AresTrI4a5SvxnrlrH4EXmRKw4&s=uHFcqiGZetyK3t7-YYvkubjoCERPfi_DGNp3ZwQn-_g&e=" style="color: purple; text-decoration: underline;" class="">http://llvm.org/viewvc/llvm-project?rev=307966&view=rev</a><br class="">Log:<br class="">[libc++] Mark string operator+ _LIBCPP_FUNC_VIS<br class=""><br class="">It has an extern template instantiation declaration in the headers and a<br class="">corresponding instantiation definition in the library, so we must mark<br class="">it with _LIBCPP_FUNC_VIS to make it available outside the library.<br class=""><br class="">This doesn't cause any ABI changes as-is since we don't build libc++<br class="">with hidden visibility (so the function is exported anyway). It's needed<br class="">for building libc++ with hidden visibility, however.<br class=""><br class="">Clarify the Windows behavior for extern function templates while I'm<br class="">here, since this exercises that behavior.<br class=""><br class="">Modified:<br class="">   libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst<br class="">   libcxx/trunk/include/string<br class=""><br class="">Modified: libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_libcxx_trunk_docs_DesignDocs_VisibilityMacros.rst-3Frev-3D307966-26r1-3D307965-26r2-3D307966-26view-3Ddiff&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=fSgXogPdeBdhqIn59AresTrI4a5SvxnrlrH4EXmRKw4&s=g6z9tFqcc6oS9s7ahnZSfMluaIqZ7wif_ft33mP7H18&e=" style="color: purple; text-decoration: underline;" class="">http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst?rev=307966&r1=307965&r2=307966&view=diff</a><br class="">==============================================================================<br class="">--- libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst (original)<br class="">+++ libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst Thu Jul 13 14:35:52 2017<br class="">@@ -98,7 +98,8 @@ Visibility Macros<br class="">  explicit instantiations themselves are marked as exported. Note that this<br class="">  applies *only* to extern *class* templates. Extern *function* templates obey<br class="">  regular import/export semantics, and applying `dllexport` directly to the<br class="">-  extern template declaration is the correct thing to do for them.<br class="">+  extern template declaration (i.e. using `_LIBCPP_FUNC_VIS`) is the correct<br class="">+  thing to do for them.<br class=""><br class="">**_LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS**<br class="">  Mark the member functions, typeinfo, and vtable of an explicit instantiation<br class=""><br class="">Modified: libcxx/trunk/include/string<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_libcxx_trunk_include_string-3Frev-3D307966-26r1-3D307965-26r2-3D307966-26view-3Ddiff&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=fSgXogPdeBdhqIn59AresTrI4a5SvxnrlrH4EXmRKw4&s=eoxEd6j-lxbIB3Nhf0bJFjtVvnXJq2lKJpLY_lTM8aY&e=" style="color: purple; text-decoration: underline;" class="">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=307966&r1=307965&r2=307966&view=diff</a><br class="">==============================================================================<br class="">--- libcxx/trunk/include/string (original)<br class="">+++ libcxx/trunk/include/string Thu Jul 13 14:35:52 2017<br class="">@@ -4006,7 +4006,7 @@ basic_string<_CharT, _Traits, _Allocator<br class=""><br class="">_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<char>)<br class="">_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<wchar_t>)<br class="">-_LIBCPP_EXTERN_TEMPLATE(string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&))<br class="">+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&))<br class=""><br class="">#if _LIBCPP_STD_VER > 11<span class="Apple-converted-space"> </span><br class="">// Literal suffixes for basic_string [basic.string.literals]<br class=""><br class=""><br class="">_______________________________________________<br class="">cfe-commits mailing list<br class=""><a href="mailto:cfe-commits@lists.llvm.org" style="color: purple; text-decoration: underline;" class="">cfe-commits@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><o:p class=""></o:p></div></div></div></blockquote></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div></div></div></div></blockquote></div><br class=""></div></div></body></html>