Skip to content

Commit c9d9b33

Browse files
author
git apple-llvm automerger
committed
Merge commit 'c36d7fd568a5' from llvm.org/release/19.x into stable/20240723
2 parents a939acd + c36d7fd commit c9d9b33

7 files changed

+52
-19
lines changed

libcxx/lib/abi/CHANGELOG.TXT

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,36 @@ New entries should be added directly below the "Version" header.
1616
Version 19.0
1717
------------
1818

19+
* [libc++] Avoid re-exporting a few specific symbols from libc++abi
20+
21+
In 6a884a9aef39, I synchronized the export list of libc++abi to the
22+
export list of libc++. From the linker's perspective, this caused
23+
these symbols to be taken from libc++.dylib instead of libc++abi.dylib.
24+
25+
However, that can be problematic when back-deploying. Indeed, this means
26+
that the linker will encode an undefined reference to be fullfilled by
27+
libc++.dylib, but when backdeploying against an older system, that symbol
28+
might only be available in libc++abi.dylib.
29+
30+
Most of the symbols that started being re-exported after 6a884a9aef39
31+
turn out to be implementation details of libc++abi, so nobody really
32+
depends on them and this back-deployment issue is inconsequential.
33+
34+
However, we ran into issues with a few of these symbols while testing
35+
LLVM 19, which led to this patch.
36+
37+
In the future, a follow-up cleanup would be to stop exporting most of
38+
the _cxxabiv1_foo_type_infoE symbols from both libc++abi and libc++
39+
since they are implementation details that nobody should be relying
40+
on.
41+
42+
<arch>-apple-darwin
43+
-------------------
44+
Symbol not reexported anymore: ___cxa_rethrow_primary_exception
45+
Symbol not reexported anymore: __ZTIN10__cxxabiv117__class_type_infoE
46+
Symbol not reexported anymore: __ZTIN10__cxxabiv120__si_class_type_infoE
47+
Symbol not reexported anymore: __ZTIN10__cxxabiv121__vmi_class_type_infoE
48+
1949
* [libc++] Always keep libc++abi re-exports up-to-date
2050

2151
This patch makes sure that the set of libc++abi symbols re-exported from libc++

libcxx/lib/abi/arm64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,9 @@
7878
{'is_defined': False, 'name': '__ZTIN10__cxxabiv116__enum_type_infoE', 'type': 'U'}
7979
{'is_defined': False, 'name': '__ZTIN10__cxxabiv116__shim_type_infoE', 'type': 'U'}
8080
{'is_defined': False, 'name': '__ZTIN10__cxxabiv117__array_type_infoE', 'type': 'U'}
81-
{'is_defined': False, 'name': '__ZTIN10__cxxabiv117__class_type_infoE', 'type': 'U'}
8281
{'is_defined': False, 'name': '__ZTIN10__cxxabiv117__pbase_type_infoE', 'type': 'U'}
8382
{'is_defined': False, 'name': '__ZTIN10__cxxabiv119__pointer_type_infoE', 'type': 'U'}
8483
{'is_defined': False, 'name': '__ZTIN10__cxxabiv120__function_type_infoE', 'type': 'U'}
85-
{'is_defined': False, 'name': '__ZTIN10__cxxabiv120__si_class_type_infoE', 'type': 'U'}
86-
{'is_defined': False, 'name': '__ZTIN10__cxxabiv121__vmi_class_type_infoE', 'type': 'U'}
8784
{'is_defined': False, 'name': '__ZTIN10__cxxabiv123__fundamental_type_infoE', 'type': 'U'}
8885
{'is_defined': False, 'name': '__ZTIN10__cxxabiv129__pointer_to_member_type_infoE', 'type': 'U'}
8986
{'is_defined': False, 'name': '__ZTIPDh', 'type': 'U'}
@@ -2002,12 +1999,9 @@
20021999
{'is_defined': True, 'name': '__ZTIN10__cxxabiv116__enum_type_infoE', 'type': 'I'}
20032000
{'is_defined': True, 'name': '__ZTIN10__cxxabiv116__shim_type_infoE', 'type': 'I'}
20042001
{'is_defined': True, 'name': '__ZTIN10__cxxabiv117__array_type_infoE', 'type': 'I'}
2005-
{'is_defined': True, 'name': '__ZTIN10__cxxabiv117__class_type_infoE', 'type': 'I'}
20062002
{'is_defined': True, 'name': '__ZTIN10__cxxabiv117__pbase_type_infoE', 'type': 'I'}
20072003
{'is_defined': True, 'name': '__ZTIN10__cxxabiv119__pointer_type_infoE', 'type': 'I'}
20082004
{'is_defined': True, 'name': '__ZTIN10__cxxabiv120__function_type_infoE', 'type': 'I'}
2009-
{'is_defined': True, 'name': '__ZTIN10__cxxabiv120__si_class_type_infoE', 'type': 'I'}
2010-
{'is_defined': True, 'name': '__ZTIN10__cxxabiv121__vmi_class_type_infoE', 'type': 'I'}
20112005
{'is_defined': True, 'name': '__ZTIN10__cxxabiv123__fundamental_type_infoE', 'type': 'I'}
20122006
{'is_defined': True, 'name': '__ZTIN10__cxxabiv129__pointer_to_member_type_infoE', 'type': 'I'}
20132007
{'is_defined': True, 'name': '__ZTINSt12experimental15fundamentals_v112bad_any_castE', 'size': 0, 'type': 'OBJECT'}
@@ -2615,7 +2609,6 @@
26152609
{'is_defined': True, 'name': '___cxa_new_handler', 'type': 'I'}
26162610
{'is_defined': True, 'name': '___cxa_pure_virtual', 'type': 'I'}
26172611
{'is_defined': True, 'name': '___cxa_rethrow', 'type': 'I'}
2618-
{'is_defined': True, 'name': '___cxa_rethrow_primary_exception', 'type': 'I'}
26192612
{'is_defined': True, 'name': '___cxa_terminate_handler', 'type': 'I'}
26202613
{'is_defined': True, 'name': '___cxa_throw', 'type': 'I'}
26212614
{'is_defined': True, 'name': '___cxa_throw_bad_array_new_length', 'type': 'I'}

libcxx/lib/abi/x86_64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,9 @@
7878
{'is_defined': False, 'name': '__ZTIN10__cxxabiv116__enum_type_infoE', 'type': 'U'}
7979
{'is_defined': False, 'name': '__ZTIN10__cxxabiv116__shim_type_infoE', 'type': 'U'}
8080
{'is_defined': False, 'name': '__ZTIN10__cxxabiv117__array_type_infoE', 'type': 'U'}
81-
{'is_defined': False, 'name': '__ZTIN10__cxxabiv117__class_type_infoE', 'type': 'U'}
8281
{'is_defined': False, 'name': '__ZTIN10__cxxabiv117__pbase_type_infoE', 'type': 'U'}
8382
{'is_defined': False, 'name': '__ZTIN10__cxxabiv119__pointer_type_infoE', 'type': 'U'}
8483
{'is_defined': False, 'name': '__ZTIN10__cxxabiv120__function_type_infoE', 'type': 'U'}
85-
{'is_defined': False, 'name': '__ZTIN10__cxxabiv120__si_class_type_infoE', 'type': 'U'}
86-
{'is_defined': False, 'name': '__ZTIN10__cxxabiv121__vmi_class_type_infoE', 'type': 'U'}
8784
{'is_defined': False, 'name': '__ZTIN10__cxxabiv123__fundamental_type_infoE', 'type': 'U'}
8885
{'is_defined': False, 'name': '__ZTIN10__cxxabiv129__pointer_to_member_type_infoE', 'type': 'U'}
8986
{'is_defined': False, 'name': '__ZTIPDh', 'type': 'U'}
@@ -2002,12 +1999,9 @@
20021999
{'is_defined': True, 'name': '__ZTIN10__cxxabiv116__enum_type_infoE', 'type': 'I'}
20032000
{'is_defined': True, 'name': '__ZTIN10__cxxabiv116__shim_type_infoE', 'type': 'I'}
20042001
{'is_defined': True, 'name': '__ZTIN10__cxxabiv117__array_type_infoE', 'type': 'I'}
2005-
{'is_defined': True, 'name': '__ZTIN10__cxxabiv117__class_type_infoE', 'type': 'I'}
20062002
{'is_defined': True, 'name': '__ZTIN10__cxxabiv117__pbase_type_infoE', 'type': 'I'}
20072003
{'is_defined': True, 'name': '__ZTIN10__cxxabiv119__pointer_type_infoE', 'type': 'I'}
20082004
{'is_defined': True, 'name': '__ZTIN10__cxxabiv120__function_type_infoE', 'type': 'I'}
2009-
{'is_defined': True, 'name': '__ZTIN10__cxxabiv120__si_class_type_infoE', 'type': 'I'}
2010-
{'is_defined': True, 'name': '__ZTIN10__cxxabiv121__vmi_class_type_infoE', 'type': 'I'}
20112005
{'is_defined': True, 'name': '__ZTIN10__cxxabiv123__fundamental_type_infoE', 'type': 'I'}
20122006
{'is_defined': True, 'name': '__ZTIN10__cxxabiv129__pointer_to_member_type_infoE', 'type': 'I'}
20132007
{'is_defined': True, 'name': '__ZTINSt12experimental15fundamentals_v112bad_any_castE', 'size': 0, 'type': 'OBJECT'}
@@ -2649,7 +2643,6 @@
26492643
{'is_defined': True, 'name': '___cxa_new_handler', 'type': 'I'}
26502644
{'is_defined': True, 'name': '___cxa_pure_virtual', 'type': 'I'}
26512645
{'is_defined': True, 'name': '___cxa_rethrow', 'type': 'I'}
2652-
{'is_defined': True, 'name': '___cxa_rethrow_primary_exception', 'type': 'I'}
26532646
{'is_defined': True, 'name': '___cxa_terminate_handler', 'type': 'I'}
26542647
{'is_defined': True, 'name': '___cxa_throw', 'type': 'I'}
26552648
{'is_defined': True, 'name': '___cxa_throw_bad_array_new_length', 'type': 'I'}

libcxxabi/lib/cxxabiv1.exp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22
__ZTIN10__cxxabiv116__enum_type_infoE
33
__ZTIN10__cxxabiv116__shim_type_infoE
44
__ZTIN10__cxxabiv117__array_type_infoE
5-
__ZTIN10__cxxabiv117__class_type_infoE
65
__ZTIN10__cxxabiv117__pbase_type_infoE
76
__ZTIN10__cxxabiv119__pointer_type_infoE
87
__ZTIN10__cxxabiv120__function_type_infoE
9-
__ZTIN10__cxxabiv120__si_class_type_infoE
10-
__ZTIN10__cxxabiv121__vmi_class_type_infoE
118
__ZTIN10__cxxabiv123__fundamental_type_infoE
129
__ZTIN10__cxxabiv129__pointer_to_member_type_infoE
1310

libcxxabi/lib/itanium-base.exp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ ___cxa_guard_acquire
1212
___cxa_guard_release
1313
___cxa_increment_exception_refcount
1414
___cxa_pure_virtual
15-
___cxa_rethrow_primary_exception
1615
___cxa_throw_bad_array_new_length
1716
___cxa_uncaught_exception
1817
___cxa_uncaught_exceptions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# These symbols are not re-exported from libc++ because providing a definition in libc++ causes
2+
# issues with some clients when backdeploying.
3+
4+
# These symbols are implementation details of libc++abi, but they are referenced from UBSan
5+
# (which is a total hack). We'll need to figure out how to decouple UBSan from these details
6+
# before we can stop exporting them from libc++abi.
7+
__ZTIN10__cxxabiv117__class_type_infoE
8+
__ZTIN10__cxxabiv120__si_class_type_infoE
9+
__ZTIN10__cxxabiv121__vmi_class_type_infoE
10+
11+
# This symbol is not an implementation detail of libc++abi, but it also causes issues when moving
12+
# to libc++. This needs further investigation.
13+
___cxa_rethrow_primary_exception

libcxxabi/src/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,22 @@ if (LIBCXXABI_ENABLE_SHARED)
214214
endif()
215215

216216
add_library(cxxabi-reexports INTERFACE)
217-
function(reexport_symbols file)
217+
function(export_symbols file)
218218
# -exported_symbols_list is only available on Apple platforms
219219
if (APPLE)
220220
target_link_libraries(cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${file}")
221+
endif()
222+
endfunction()
223+
224+
function(reexport_symbols file)
225+
export_symbols("${file}")
226+
# -reexported_symbols_list is only available on Apple platforms
227+
if (APPLE)
221228
target_link_libraries(cxxabi-reexports INTERFACE "-Wl,-reexported_symbols_list,${file}")
222229
endif()
223230
endfunction()
224231

232+
export_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/symbols-not-reexported.exp")
225233
reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/cxxabiv1.exp")
226234
reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/fundamental-types.exp")
227235
reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/itanium-base.exp")

0 commit comments

Comments
 (0)