From 4f13b999297140486b2faa1b5d8d7c768fb40dfb Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Wed, 30 Sep 2020 19:17:16 -0400 Subject: [PATCH] [libc++] Simplify how we re-export symbols from libc++abi Instead of managing two copies of the symbol lists, reuse the same list in libc++abi and libc++. Differential Revision: https://reviews.llvm.org/D88623 --- libcxx/lib/abi/CHANGELOG.TXT | 14 ++++++++++++++ libcxx/lib/abi/x86_64-apple-darwin.v1.abilist | 4 ++++ libcxx/lib/libc++abi-exceptions.exp | 10 ---------- libcxx/lib/libc++abi-exceptions.sjlj.exp | 10 ---------- libcxx/lib/libc++abi-new-delete.exp | 20 -------------------- libcxx/src/CMakeLists.txt | 12 ------------ libcxxabi/src/CMakeLists.txt | 18 +++++++++++++----- 7 files changed, 31 insertions(+), 57 deletions(-) delete mode 100644 libcxx/lib/libc++abi-exceptions.exp delete mode 100644 libcxx/lib/libc++abi-exceptions.sjlj.exp delete mode 100644 libcxx/lib/libc++abi-new-delete.exp diff --git a/libcxx/lib/abi/CHANGELOG.TXT b/libcxx/lib/abi/CHANGELOG.TXT index 0672fb3..7ed2b7e 100644 --- a/libcxx/lib/abi/CHANGELOG.TXT +++ b/libcxx/lib/abi/CHANGELOG.TXT @@ -13,6 +13,20 @@ Afterwards the ABI list should be updated to include the new changes. New entries should be added directly below the "Version" header. ------------ +Version 12.0 +------------ + +* XXXXXXX - [libc++] Simplify how we re-export symbols from libc++abi + + We re-export some symbols that were exported from libc++abi but not from + libc++. Exporting new symbols is not an ABI break. + + x86_64-apple-apple-darwin + ------------------------- + Symbol added: ___cxa_allocate_dependent_exception + Symbol added: ___cxa_free_dependent_exception + +------------ Version 10.0 ------------ diff --git a/libcxx/lib/abi/x86_64-apple-darwin.v1.abilist b/libcxx/lib/abi/x86_64-apple-darwin.v1.abilist index db06a4c..e141feb 100644 --- a/libcxx/lib/abi/x86_64-apple-darwin.v1.abilist +++ b/libcxx/lib/abi/x86_64-apple-darwin.v1.abilist @@ -2431,3 +2431,7 @@ {'type': 'FUNC', 'is_defined': True, 'name': '__ZNSt3__131__arrive_barrier_algorithm_baseEPNS_24__barrier_algorithm_baseEh'} {'type': 'FUNC', 'is_defined': True, 'name': '__ZNSt3__132__destroy_barrier_algorithm_baseEPNS_24__barrier_algorithm_baseE'} {'type': 'FUNC', 'is_defined': True, 'name': '__ZNSt3__134__construct_barrier_algorithm_baseERl'} +{'type': 'U', 'is_defined': False, 'name': '___cxa_allocate_dependent_exception'} +{'type': 'U', 'is_defined': False, 'name': '___cxa_free_dependent_exception'} +{'type': 'I', 'is_defined': True, 'name': '___cxa_allocate_dependent_exception'} +{'type': 'I', 'is_defined': True, 'name': '___cxa_free_dependent_exception'} diff --git a/libcxx/lib/libc++abi-exceptions.exp b/libcxx/lib/libc++abi-exceptions.exp deleted file mode 100644 index 600a65f..0000000 --- a/libcxx/lib/libc++abi-exceptions.exp +++ /dev/null @@ -1,10 +0,0 @@ -___cxa_allocate_exception -___cxa_begin_catch -___cxa_call_unexpected -___cxa_current_exception_type -___cxa_end_catch -___cxa_free_exception -___cxa_get_exception_ptr -___cxa_rethrow -___cxa_throw -___gxx_personality_v0 diff --git a/libcxx/lib/libc++abi-exceptions.sjlj.exp b/libcxx/lib/libc++abi-exceptions.sjlj.exp deleted file mode 100644 index 10073d6..0000000 --- a/libcxx/lib/libc++abi-exceptions.sjlj.exp +++ /dev/null @@ -1,10 +0,0 @@ -___cxa_allocate_exception -___cxa_begin_catch -___cxa_call_unexpected -___cxa_current_exception_type -___cxa_end_catch -___cxa_free_exception -___cxa_get_exception_ptr -___cxa_rethrow -___cxa_throw -___gxx_personality_sj0 diff --git a/libcxx/lib/libc++abi-new-delete.exp b/libcxx/lib/libc++abi-new-delete.exp deleted file mode 100644 index 9f74b03..0000000 --- a/libcxx/lib/libc++abi-new-delete.exp +++ /dev/null @@ -1,20 +0,0 @@ -__ZdaPv -__ZdaPvRKSt9nothrow_t -__ZdaPvSt11align_val_t -__ZdaPvSt11align_val_tRKSt9nothrow_t -__ZdaPvm -__ZdaPvmSt11align_val_t -__ZdlPv -__ZdlPvRKSt9nothrow_t -__ZdlPvSt11align_val_t -__ZdlPvSt11align_val_tRKSt9nothrow_t -__ZdlPvm -__ZdlPvmSt11align_val_t -__Znam -__ZnamRKSt9nothrow_t -__ZnamSt11align_val_t -__ZnamSt11align_val_tRKSt9nothrow_t -__Znwm -__ZnwmRKSt9nothrow_t -__ZnwmSt11align_val_t -__ZnwmSt11align_val_tRKSt9nothrow_t diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt index dcd53c8..fc9fc0e 100644 --- a/libcxx/src/CMakeLists.txt +++ b/libcxx/src/CMakeLists.txt @@ -212,18 +212,6 @@ if (LIBCXX_ENABLE_SHARED) "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/libc++abi.v${LIBCXX_LIBCPPABI_VERSION}.exp" "-Wl,-force_symbols_not_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/notweak.exp" "-Wl,-force_symbols_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/weak.exp") - - if (LIBCXX_ENABLE_EXCEPTIONS) - if ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "^(armv6|armv7|armv7s)$") - target_link_libraries(cxx_shared PRIVATE "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/libc++abi-exceptions.sjlj.exp") - else() - target_link_libraries(cxx_shared PRIVATE "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/libc++abi-exceptions.exp") - endif() - endif() - - if (NOT LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS) - target_link_libraries(cxx_shared PRIVATE "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/libc++abi-new-delete.exp") - endif() endif() # Generate a linker script in place of a libc++.so symlink. diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt index 85e3fda..e9e4540 100644 --- a/libcxxabi/src/CMakeLists.txt +++ b/libcxxabi/src/CMakeLists.txt @@ -204,19 +204,27 @@ if (LIBCXXABI_ENABLE_SHARED) # -exported_symbols_list is only available on Apple platforms if (APPLE) - target_link_libraries(cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/itanium-base.exp") + function(export_symbols file) + target_link_libraries(cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${file}") + endfunction() + function(reexport_symbols file) + export_symbols("${file}") + target_link_libraries(cxxabi_shared INTERFACE "-Wl,-reexported_symbols_list,${file}") + endfunction() + + export_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/itanium-base.exp") if (LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS) - target_link_libraries(cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/new-delete.exp") + reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/new-delete.exp") endif() if (LIBCXXABI_ENABLE_EXCEPTIONS) - target_link_libraries(cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/exceptions.exp") + reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/exceptions.exp") if ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "^(armv6|armv7|armv7s)$") - target_link_libraries(cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/personality-sjlj.exp") + reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/personality-sjlj.exp") else() - target_link_libraries(cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/personality-v0.exp") + reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/personality-v0.exp") endif() endif() endif() -- 2.7.4