[libcxx-commits] [libcxx] [libc++] Always build the dylib with hidden visibility (PR #131313)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Mar 14 04:26:52 PDT 2025
https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/131313
The comment seems to be wrong by now. The only difference this makes for GCC is that there are fewer private symbols exported from the dylib, which can't ever be accessed by user code anyways.
>From 7429932639e0341a75fea6674b08069f75cc195b Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Fri, 14 Mar 2025 12:23:58 +0100
Subject: [PATCH] [libc++] Always build the dylib with hidden visibility
---
libcxx/CMakeLists.txt | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index abe12c2805a7c..ebaa6e9fd0e97 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -522,13 +522,7 @@ function(cxx_add_basic_build_flags target)
# the dylib when get ODR used by another function.
target_add_compile_flags_if_supported(${target} PRIVATE -fvisibility-inlines-hidden)
- # Our visibility annotations are not quite right for non-Clang compilers,
- # so we end up not exporting all the symbols we should. In the future, we
- # can improve the situation by providing an explicit list of exported
- # symbols on all compilers.
- if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- target_add_compile_flags_if_supported(${target} PRIVATE -fvisibility=hidden)
- endif()
+ target_add_compile_flags_if_supported(${target} PRIVATE -fvisibility=hidden)
# Build with -fsized-deallocation, which is default in recent versions of Clang.
# TODO(LLVM 21): This can be dropped once we only support Clang >= 19.
More information about the libcxx-commits
mailing list