[libcxx-commits] [libcxx] 4f13b99 - [libc++] Simplify how we re-export symbols from libc++abi

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 1 05:30:33 PDT 2020


Author: Louis Dionne
Date: 2020-10-01T08:30:27-04:00
New Revision: 4f13b999297140486b2faa1b5d8d7c768fb40dfb

URL: https://github.com/llvm/llvm-project/commit/4f13b999297140486b2faa1b5d8d7c768fb40dfb
DIFF: https://github.com/llvm/llvm-project/commit/4f13b999297140486b2faa1b5d8d7c768fb40dfb.diff

LOG: [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

Added: 
    

Modified: 
    libcxx/lib/abi/CHANGELOG.TXT
    libcxx/lib/abi/x86_64-apple-darwin.v1.abilist
    libcxx/src/CMakeLists.txt
    libcxxabi/src/CMakeLists.txt

Removed: 
    libcxx/lib/libc++abi-exceptions.exp
    libcxx/lib/libc++abi-exceptions.sjlj.exp
    libcxx/lib/libc++abi-new-delete.exp


################################################################################
diff  --git a/libcxx/lib/abi/CHANGELOG.TXT b/libcxx/lib/abi/CHANGELOG.TXT
index 0672fb3f4441..7ed2b7e28d40 100644
--- a/libcxx/lib/abi/CHANGELOG.TXT
+++ b/libcxx/lib/abi/CHANGELOG.TXT
@@ -12,6 +12,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 db06a4cc17cd..e141feb0b6c1 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 600a65ffead2..000000000000
--- 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 10073d615c24..000000000000
--- 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 9f74b0336efc..000000000000
--- 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 dcd53c8a302a..fc9fc0e7bc27 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 85e3fda034f7..e9e454082a05 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()


        


More information about the libcxx-commits mailing list