[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
Thu Jul 13 12:59:59 PDT 2017


thomasanderson added a comment.

In https://reviews.llvm.org/D35326#808181, @smeenai wrote:

> This doesn't look right to me. `_LIBCPP_TEMPLATE_VIS` expands to `__attribute__((__type_visibility__("default")))` on compilers where `__type_visibility__` is supported; i.e., its intent is to only export the typeinfo and vtable. gcc doesn't support this attribute, so we'll use `__visibility__` instead and this change will appear to fix your issue, but it's not conceptually correct.
>
> All the types you're seeing link errors against have extern template instantiation declarations in the libc++ headers (and the corresponding instantiation definitions in the library itself). I think we may have a bug in our definition of `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS`. Can you try applying https://reviews.llvm.org/P8003 and let me know if that fixes the link errors?


That patch fixes the vector case but unfortunately operator+ for string is still not getting exported:
../../test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc:580: 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





More information about the llvm-commits mailing list