Commit 37055c7
authored
Update libcxx and libcxxabi to LLVM 18.1.2 (#21638)
This updates libcxx and libcxxabi to LLVM 18.1.2. Due to
llvm/llvm-project#65534 we need to update both
at the same time.
Things to note:
- Disable hardening mode:
LLVM 18.1.2 adds support for "Hardening Modes" to libcxx
(https://libcxx.llvm.org/Hardening.html). There are four modes: none,
fast, extensive and debug. Different hardening modes make different
trade-offs between the amount of checking and runtime performance. We
for now disable it (i.e., set it to 'none') so that we don't have any
effects on the performance. We can consider enabling it when we ever
get to enable the debug version of libcxx.
- Disable C++20 time zone support:
LLVM 18.1.2 adds C++20 time zone support
(https://libcxx.llvm.org/DesignDocs/TimeZone.html) to libcxx, which
requires access IANA Time Zone Database. Currently it seems it only
supports Linux:
https://github.com/llvm/llvm-project/blob/26a1d6601d727a96f4301d0d8647b5a42760ae0c/libcxx/src/tz.cpp#L45-L49
So this excludes the two source files from build (which is done via
`CMakeLists.txt` in the upstream LLVM) and sets
`_LIBCPP_HAS_NO_TIME_ZONE_DATABASE` macro in `__config_site`. In
future maybe we can consider implementing this in JS.
- `__cxa_init_primary_exception` support:
llvm/llvm-project#65534 introduces
`__cxa_init_primary_exception` and uses this in libcxx. Like several
other methods like the below in `cxa_exception.cpp`,
https://github.com/emscripten-core/emscripten/blob/fbdd9249e939660cb0d20f00d6bc1897c2f3905e/system/lib/libcxxabi/src/cxa_exception.cpp#L264-L269
this new function takes a pointer to a destructor, and in Wasm
destructor returns a `this` pointer, which requires `ifdef
__USING_WASM_EXCEPTION__` on its signature. And that it is also used
in libcxx means we need to guard some code in libcxx with `ifdef
__USING_WASM_EXCEPTION__` for the signature difference, and we need to
build libcxx with `-D__USING_WASM_EXCEPTIONS__` when Wasm EH is used.
Also we add Emscripte EH's counterpart in
`cxa_exception_emscripten.cpp` too.
- This version fixes long-running misbehaviors of `operator new`
llvm/llvm-project#69498 seems to fix some
long-running misbhaviors of `operator new`, which in emscripten we
tried to fix in #11079 and #20154. So while resolving the conflicts, I
effectively reverted #11079 and #20154 in
`libcxx/src/stdlib_new_delete.cpp` and `libcxx/src/new.cpp`.
- Add default `__assertion_handler` to `libcxx/include`:
llvm/llvm-project#77883 adds a way for vendors
to override how we handle assertions. If a vendor doesn't want to
override it, CMake will copy the provided [default template assertion
handler
file](https://github.com/llvm/llvm-project/blob/26a1d6601d727a96f4301d0d8647b5a42760ae0c/libcxx/vendor/llvm/default_assertion_handler.in)
to libcxx's generated include dir, which defaults to
`SYSROOT/include/c++/v1`:
https://github.com/llvm/llvm-project/blob/26a1d6601d727a96f4301d0d8647b5a42760ae0c/libcxx/CMakeLists.txt#L72-L73
https://github.com/llvm/llvm-project/blob/26a1d6601d727a96f4301d0d8647b5a42760ae0c/libcxx/CMakeLists.txt#L439
https://github.com/llvm/llvm-project/blob/26a1d6601d727a96f4301d0d8647b5a42760ae0c/libcxx/include/CMakeLists.txt#L1024
We don't use CMake, so this renames the provided
`vendor/llvm/default_assertion_handler.in` to `__assert_handler` in
our `libcxx/include` directory, which will be copied to
`SYSROOT/include/c++/v1`.
- Disable `__libcpp_verbose_abort directly` in code:
In #20707 we decided to disable `__libcpp_verbose_abort` not to incur
the code size increase that brings (it brings in `vfprintf` and its
family). We disabled it in adding
`#define _LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT` in
`__config_site`. But that `_NO_` macros are gone in LLVM 18.1.2, and
changing it to `#define _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT 0` does
not work because it is overridden by this line, unless we provide our
own vendor annotations:
https://github.com/llvm/llvm-project/blob/38f5596feda3276a8aa64fc14e074334017088ca/libcxx/include/__availability#L138
I asked about this in
llvm/llvm-project#87012 and
llvm/llvm-project#71002 (comment)
(and more comments below)
but didn't get an actionable answer yet. So this disables
`__libcpp_verbose_abort` in the code directly for now, hopefully
temporarily.
Each fix is described in its own commit, except for the fixes required
to resolve conflicts when merging our changes, which I wasn't able to
commit separately.
Fixes #21603.1 parent f07067d commit 37055c7
File tree
929 files changed
+84034
-109301
lines changed- system/lib
- libcxxabi
- include
- src
- demangle
- libcxx
- include
- __algorithm
- pstl_backends
- cpu_backends
- __atomic
- __bit
- __charconv
- __chrono
- __compare
- __concepts
- __condition_variable
- __coroutine
- __debug_utils
- __exception
- __expected
- __filesystem
- __format
- __functional
- __fwd
- __ios
- __iterator
- __locale_dir/locale_base_api
- __math
- __mdspan
- __memory_resource
- __memory
- __mutex
- __numeric
- __pstl/internal
- omp
- __random
- __ranges
- __stop_token
- __string
- __support
- android
- fuchsia
- ibm
- newlib
- win32
- xlocale
- __system_error
- __thread
- __tuple
- __type_traits
- __utility
- __variant
- experimental
- __simd
- ext
- src
- experimental
- filesystem
- include
- ryu
- pstl
- ryu
- support
- ibm
- runtime
- win32
- test
- code_size
- other/metadce
- tools
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
929 files changed
+84034
-109301
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
32 | 29 | | |
33 | 30 | | |
34 | 31 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
41 | 35 | | |
42 | 36 | | |
43 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
32 | 31 | | |
33 | 32 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
27 | 26 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
37 | 34 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
47 | 42 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
59 | 51 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 52 | + | |
| 53 | + | |
64 | 54 | | |
65 | 55 | | |
66 | | - | |
67 | | - | |
68 | | - | |
| 56 | + | |
| 57 | + | |
69 | 58 | | |
70 | 59 | | |
71 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
| 55 | + | |
55 | 56 | | |
56 | | - | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
115 | | - | |
| 116 | + | |
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | | - | |
| 111 | + | |
113 | 112 | | |
114 | 113 | | |
115 | 114 | | |
| |||
124 | 123 | | |
125 | 124 | | |
126 | 125 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 126 | + | |
| 127 | + | |
132 | 128 | | |
133 | | - | |
| 129 | + | |
| 130 | + | |
134 | 131 | | |
135 | | - | |
136 | | - | |
| 132 | + | |
137 | 133 | | |
138 | 134 | | |
139 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
33 | 27 | | |
34 | | - | |
| 28 | + | |
| 29 | + | |
35 | 30 | | |
36 | 31 | | |
37 | 32 | | |
| |||
Lines changed: 16 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 55 | + | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
| 98 | + | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
| 139 | + | |
138 | 140 | | |
0 commit comments