[libcxx-commits] [PATCH] D147832: [libcxx] Introduce clang::lto_visibility_public attribute
Leonard Chan via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Sep 13 16:03:10 PDT 2023
leonardchan added a comment.
In D147832#4645512 <https://reviews.llvm.org/D147832#4645512>, @ldionne wrote:
> After careful consideration, I am left wondering why `-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -fvisibility=hidden` even makes sense. I understand that you want to minimize the number of symbols exported from your program and I think that's a desirable goal. However, let's say you take a typical program and just compile it normally without using `-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -fvisibility=hidden` -- what's the problem? What symbols end up being exported that you wouldn't want to export?
>
> We already mark the vast majority of symbols in libc++ as hidden (using `_LIBCPP_HIDE_FROM_ABI`), and the ones that are not marked as hidden basically need to be public for correctness purposes.
We also want to reduce size and startup time so marking them as hidden reduces dynamic relocations at least for ELF. Usage of classes included from headers can manifest public symbols that we don't need to be public. `std::streambuf` is one I've seen a lot and any usage of that also brings in the methods associated with it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147832/new/
https://reviews.llvm.org/D147832
More information about the libcxx-commits
mailing list