[PATCH] D35388: [libc++] Give extern templates default visibility on gcc

Tom Anderson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 18 16:01:32 PDT 2018


thomasanderson added a comment.

In https://reviews.llvm.org/D35388#1167305, @ldionne wrote:

> ABI-wise, I think this change is OK. Indeed, if `__type_visibility__` is not supported, we're already marking the base template as `__visibility__("default")`, so marking the extern template declaration with `__visibility__("default")` is not a problem. If `__type_visibility__` is supported, then there's no change in behavior. So I think there is no change in behavior either way, and I'm actually wondering why @thomasanderson wants this change in if the behavior is always the same. Perhaps I am missing something?


It's been a while, but IIRC this fixes the Chromium build with gcc and libc++, since std::vector_base_common<true>::__throw_length_error() wasn't getting exported otherwise.

See the comment in the Chromium source code:
https://cs.chromium.org/chromium/src/buildtools/third_party/libc%2B%2B/BUILD.gn?rcl=0dd5c6f980d22be96b728155249df2da355989d9&l=88

And also this CL https://reviews.llvm.org/D35326

> As a diversion, I'm confused by the very fact that we need to apply `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS` to the _extern template declaration_. I would have expected instead that, if anything, we need to specify the visibility on the _explicit instantiation_ in the dylib.




https://reviews.llvm.org/D35388





More information about the cfe-commits mailing list