[PATCH] D20270: libc++abi: build with -fvisibility=default

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Sat May 14 14:39:07 PDT 2016


compnerd created this revision.
compnerd added a reviewer: EricWF.
compnerd added subscribers: llvm-commits, mclow.lists.
compnerd set the repository for this revision to rL LLVM.

This enables building libc++abi with -fvisibility=hidden if the compiler supports it.  This is required to ensure that only public interfaces are made available from the library.  Currently, the ABI difference between the default and hidden versions is:

- __cxa_new_handler
- __cxa_terminate_handler
- __cxa_unexpected_handler

On Darwin, the difference between the version shipped in 10.11 and the hidden visibility is a bit more interesting as follows:

- __cxa_new_handler
- __cxa_terminate_handler
- __cxa_unexpected_handler
+ __cxa_throw_bad_array_new_length
+ __cxa_uncaught_exceptions

Linux is even more interesting with the following diffs:

- __cxa_new_handler
- __cxa_terminate_handler
- __cxa_unexpected_handler
- _ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv
- _ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv
- _ZNKSt3__121__basic_string_commonILb1EE20__throw_out_of_rangeEv

The last three removed on Linux is more of a bug fix as they are supposed to be provided either by libc++ or inlined.

Its unclear whether the diffs are part of the public ABI or not.

Repository:
  rL LLVM

http://reviews.llvm.org/D20270

Files:
  CMakeLists.txt
  cmake/config-ix.cmake

Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -8,6 +8,7 @@
 check_cxx_compiler_flag(-fno-exceptions       LIBCXXABI_HAS_NO_EXCEPTIONS_FLAG)
 check_cxx_compiler_flag(-fno-rtti             LIBCXXABI_HAS_NO_RTTI_FLAG)
 check_cxx_compiler_flag(-fstrict-aliasing     LIBCXXABI_HAS_FSTRICT_ALIASING_FLAG)
+check_cxx_compiler_flag(-fvisibility=hidden   LIBCXXABI_HAS_FVISIBILITY_HIDDEN_FLAG)
 check_cxx_compiler_flag(-nodefaultlibs        LIBCXXABI_HAS_NODEFAULTLIBS_FLAG)
 check_cxx_compiler_flag(-nostdinc++           LIBCXXABI_HAS_NOSTDINCXX_FLAG)
 check_cxx_compiler_flag(-Wall                 LIBCXXABI_HAS_WALL_FLAG)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -249,6 +249,8 @@
 
 append_if(LIBCXXABI_C_FLAGS LIBCXXABI_HAS_FUNWIND_TABLES -funwind-tables)
 
+append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_FVISIBILITY_HIDDEN_FLAG -fvisibility=hidden)
+
 # Assert
 string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
 if (LIBCXXABI_ENABLE_ASSERTIONS)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20270.57285.patch
Type: text/x-patch
Size: 1155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160514/303ba5d4/attachment.bin>


More information about the llvm-commits mailing list