[libcxx-commits] [libcxxabi] [libcxxabi] Don't enable -fvisibility=hidden on Windows (PR #207943)
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 7 03:48:27 PDT 2026
mstorsjo wrote:
And actually, compiling with `-fvisibility=hidden`, if we could do it, would be beneficial for the static library builds.
If a user statically links in libcxxabi into their own DLL, and there's no explicit dllexports, then the mingw linkers default to exporting all symbols. This would end up exporting the statically linked libcxx/libcxxabi symbols too, if we didn't have explicit excludes for them in LLD, https://github.com/llvm/llvm-project/blob/llvmorg-22.1.8/lld/COFF/MinGW.cpp#L51-L52. But if those libraries are built with `-fvisibility=hidden`, it would work even despite that.
So this workaround probably is reasonable as such, but we could consider reverting it at some point in the future if Clang is fixed to not trip up on this at some point. I updated the code comment to reflect this, and to reference the bug.
https://github.com/llvm/llvm-project/pull/207943
More information about the libcxx-commits
mailing list