Skip to content

Commit 4f13b99

Browse files
committed
[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
1 parent b272250 commit 4f13b99

File tree

7 files changed

+31
-57
lines changed

7 files changed

+31
-57
lines changed

libcxx/lib/abi/CHANGELOG.TXT

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ Afterwards the ABI list should be updated to include the new changes.
1212

1313
New entries should be added directly below the "Version" header.
1414

15+
------------
16+
Version 12.0
17+
------------
18+
19+
* XXXXXXX - [libc++] Simplify how we re-export symbols from libc++abi
20+
21+
We re-export some symbols that were exported from libc++abi but not from
22+
libc++. Exporting new symbols is not an ABI break.
23+
24+
x86_64-apple-apple-darwin
25+
-------------------------
26+
Symbol added: ___cxa_allocate_dependent_exception
27+
Symbol added: ___cxa_free_dependent_exception
28+
1529
------------
1630
Version 10.0
1731
------------

libcxx/lib/abi/x86_64-apple-darwin.v1.abilist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,3 +2431,7 @@
24312431
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNSt3__131__arrive_barrier_algorithm_baseEPNS_24__barrier_algorithm_baseEh'}
24322432
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNSt3__132__destroy_barrier_algorithm_baseEPNS_24__barrier_algorithm_baseE'}
24332433
{'type': 'FUNC', 'is_defined': True, 'name': '__ZNSt3__134__construct_barrier_algorithm_baseERl'}
2434+
{'type': 'U', 'is_defined': False, 'name': '___cxa_allocate_dependent_exception'}
2435+
{'type': 'U', 'is_defined': False, 'name': '___cxa_free_dependent_exception'}
2436+
{'type': 'I', 'is_defined': True, 'name': '___cxa_allocate_dependent_exception'}
2437+
{'type': 'I', 'is_defined': True, 'name': '___cxa_free_dependent_exception'}

libcxx/lib/libc++abi-exceptions.exp

Lines changed: 0 additions & 10 deletions
This file was deleted.

libcxx/lib/libc++abi-exceptions.sjlj.exp

Lines changed: 0 additions & 10 deletions
This file was deleted.

libcxx/lib/libc++abi-new-delete.exp

Lines changed: 0 additions & 20 deletions
This file was deleted.

libcxx/src/CMakeLists.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,18 +212,6 @@ if (LIBCXX_ENABLE_SHARED)
212212
"-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/libc++abi.v${LIBCXX_LIBCPPABI_VERSION}.exp"
213213
"-Wl,-force_symbols_not_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/notweak.exp"
214214
"-Wl,-force_symbols_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/weak.exp")
215-
216-
if (LIBCXX_ENABLE_EXCEPTIONS)
217-
if ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "^(armv6|armv7|armv7s)$")
218-
target_link_libraries(cxx_shared PRIVATE "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/libc++abi-exceptions.sjlj.exp")
219-
else()
220-
target_link_libraries(cxx_shared PRIVATE "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/libc++abi-exceptions.exp")
221-
endif()
222-
endif()
223-
224-
if (NOT LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS)
225-
target_link_libraries(cxx_shared PRIVATE "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/libc++abi-new-delete.exp")
226-
endif()
227215
endif()
228216

229217
# Generate a linker script in place of a libc++.so symlink.

libcxxabi/src/CMakeLists.txt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,19 +204,27 @@ if (LIBCXXABI_ENABLE_SHARED)
204204

205205
# -exported_symbols_list is only available on Apple platforms
206206
if (APPLE)
207-
target_link_libraries(cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/itanium-base.exp")
207+
function(export_symbols file)
208+
target_link_libraries(cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${file}")
209+
endfunction()
210+
function(reexport_symbols file)
211+
export_symbols("${file}")
212+
target_link_libraries(cxxabi_shared INTERFACE "-Wl,-reexported_symbols_list,${file}")
213+
endfunction()
214+
215+
export_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/itanium-base.exp")
208216

209217
if (LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS)
210-
target_link_libraries(cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/new-delete.exp")
218+
reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/new-delete.exp")
211219
endif()
212220

213221
if (LIBCXXABI_ENABLE_EXCEPTIONS)
214-
target_link_libraries(cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/exceptions.exp")
222+
reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/exceptions.exp")
215223

216224
if ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "^(armv6|armv7|armv7s)$")
217-
target_link_libraries(cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/personality-sjlj.exp")
225+
reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/personality-sjlj.exp")
218226
else()
219-
target_link_libraries(cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/personality-v0.exp")
227+
reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/personality-v0.exp")
220228
endif()
221229
endif()
222230
endif()

0 commit comments

Comments
 (0)