[libcxx-commits] [libcxx] r370926 - [libc++] Only build with -fvisibility=hidden on Clang

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 4 09:41:31 PDT 2019


Author: ldionne
Date: Wed Sep  4 09:41:31 2019
New Revision: 370926

URL: http://llvm.org/viewvc/llvm-project?rev=370926&view=rev
Log:
[libc++] Only build with -fvisibility=hidden on Clang

The visibility annotations in libc++ are not quite right for GCC, which
results in symbols not being exported when -fvisibility=hidden is used.
To fix the GCC build bots, this commit reverts to the previous state of
not building with hidden visibility on GCC.

In the future, we can build with hidden visibility all the time and
export symbols explicitly using a list. See https://llvm.org/D66970
for one take at this.

Modified:
    libcxx/trunk/src/CMakeLists.txt

Modified: libcxx/trunk/src/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/CMakeLists.txt?rev=370926&r1=370925&r2=370926&view=diff
==============================================================================
--- libcxx/trunk/src/CMakeLists.txt (original)
+++ libcxx/trunk/src/CMakeLists.txt Wed Sep  4 09:41:31 2019
@@ -204,7 +204,13 @@ function(cxx_set_common_defines name)
   if(LIBCXX_CXX_ABI_HEADER_TARGET)
     add_dependencies(${name} ${LIBCXX_CXX_ABI_HEADER_TARGET})
   endif()
-  target_compile_options(${name} PRIVATE -fvisibility=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_compile_options(${name} PRIVATE -fvisibility=hidden)
+  endif()
   if(WIN32 AND NOT MINGW)
     target_compile_definitions(${name}
                                PRIVATE




More information about the libcxx-commits mailing list