Ah I see. I think r309474 should fix our problem. Thanks for your quick response.
> On Aug 22, 2017, at 6:28 PM, Shoaib Meenai <smee...@fb.com> wrote: > > 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? > > From: <ahatan...@apple.com> on behalf of Akira Hatanaka <ahatan...@apple.com> > Date: Tuesday, August 22, 2017 at 6:21 PM > To: Shoaib Meenai <smee...@fb.com> > Cc: "cfe-commits@lists.llvm.org" <cfe-commits@lists.llvm.org> > Subject: Re: [libcxx] r307966 - [libc++] Mark string operator+ > _LIBCPP_FUNC_VIS > > This change makes it impossible to change the visibility of operator+ with > -fvisibility=hidden, which is not desirable on Darwin. > > For example: > > $ cat test.cpp > #include <string> > > using namespace std; > > string foo1(string s) { > return "abc" + s; > } > > > $ clang++ test.cpp -fvisibility=hidden -c; nm -m -a test.o | grep > __ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EEPKS6_RKS9_ > 0000000000000030 (__TEXT,__text) weak external > __ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EEPKS6_RKS9_ > > The symbol used to be “weak private external”, but it is “weak external” now. > > On Jul 13, 2017, at 2:35 PM, Shoaib Meenai via cfe-commits > <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>> wrote: > > Author: smeenai > Date: Thu Jul 13 14:35:52 2017 > New Revision: 307966 > > URL: http://llvm.org/viewvc/llvm-project?rev=307966&view=rev > <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=> > Log: > [libc++] Mark string operator+ _LIBCPP_FUNC_VIS > > It has an extern template instantiation declaration in the headers and a > corresponding instantiation definition in the library, so we must mark > it with _LIBCPP_FUNC_VIS to make it available outside the library. > > This doesn't cause any ABI changes as-is since we don't build libc++ > with hidden visibility (so the function is exported anyway). It's needed > for building libc++ with hidden visibility, however. > > Clarify the Windows behavior for extern function templates while I'm > here, since this exercises that behavior. > > Modified: > libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst > libcxx/trunk/include/string > > Modified: libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst?rev=307966&r1=307965&r2=307966&view=diff > > <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=> > ============================================================================== > --- libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst (original) > +++ libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst Thu Jul 13 14:35:52 2017 > @@ -98,7 +98,8 @@ Visibility Macros > explicit instantiations themselves are marked as exported. Note that this > applies *only* to extern *class* templates. Extern *function* templates obey > regular import/export semantics, and applying `dllexport` directly to the > - extern template declaration is the correct thing to do for them. > + extern template declaration (i.e. using `_LIBCPP_FUNC_VIS`) is the correct > + thing to do for them. > > **_LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS** > Mark the member functions, typeinfo, and vtable of an explicit instantiation > > Modified: libcxx/trunk/include/string > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=307966&r1=307965&r2=307966&view=diff > > <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=> > ============================================================================== > --- libcxx/trunk/include/string (original) > +++ libcxx/trunk/include/string Thu Jul 13 14:35:52 2017 > @@ -4006,7 +4006,7 @@ basic_string<_CharT, _Traits, _Allocator > > _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS > basic_string<char>) > _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS > basic_string<wchar_t>) > -_LIBCPP_EXTERN_TEMPLATE(string operator+<char, char_traits<char>, > allocator<char> >(char const*, string const&)) > +_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS string operator+<char, > char_traits<char>, allocator<char> >(char const*, string const&)) > > #if _LIBCPP_STD_VER > 11 > // Literal suffixes for basic_string [basic.string.literals] > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits