[PATCH] D35326: [libc++] Add _LIBCPP_TEMPLATE_VIS to string operator+ and __vector_base_common

Tom Anderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 12 13:56:01 PDT 2017


thomasanderson created this revision.
Herald added a reviewer: EricWF.

I built libc++ using gcc with -fvisibility=hidden, but when linking my app against the resulting libc++.so, I got a few errors:

../../buildtools/third_party/libc++/trunk/include/vector:964: error: undefined reference to 'std::__1::__vector_base_common<true>::__throw_length_error() const'

../../src/d8.cc:738: error: undefined reference to 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'


https://reviews.llvm.org/D35326

Files:
  include/string
  include/vector


Index: include/vector
===================================================================
--- include/vector
+++ include/vector
@@ -288,7 +288,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <bool>
-class __vector_base_common
+class _LIBCPP_TEMPLATE_VIS __vector_base_common
 {
 protected:
     _LIBCPP_ALWAYS_INLINE __vector_base_common() {}
Index: include/string
===================================================================
--- include/string
+++ include/string
@@ -536,23 +536,28 @@
 // basic_string
 
 template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_TEMPLATE_VIS
 basic_string<_CharT, _Traits, _Allocator>
 operator+(const basic_string<_CharT, _Traits, _Allocator>& __x,
           const basic_string<_CharT, _Traits, _Allocator>& __y);
 
 template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_TEMPLATE_VIS
 basic_string<_CharT, _Traits, _Allocator>
 operator+(const _CharT* __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
 
 template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_TEMPLATE_VIS
 basic_string<_CharT, _Traits, _Allocator>
 operator+(_CharT __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
 
 template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_TEMPLATE_VIS
 basic_string<_CharT, _Traits, _Allocator>
 operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, const _CharT* __y);
 
 template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_TEMPLATE_VIS
 basic_string<_CharT, _Traits, _Allocator>
 operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35326.106296.patch
Type: text/x-patch
Size: 1583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170712/2aad0e44/attachment.bin>


More information about the llvm-commits mailing list