Skip to content

Commit 5dde14f

Browse files
committed
ndk-sysroot-gcc-compact: bump to 27
1 parent c5214b3 commit 5dde14f

19 files changed

+240
-1052
lines changed

common-files/setup_toolchain_gcc.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,6 @@ _setup_standalone_toolchain_current_ndk_newer_gcc() {
195195
echo "Applying patch: $(basename $f)"
196196
patch -d "$GCC_STANDALONE_TOOLCHAIN_TMP/sysroot/usr/include/" -p8 < "$f";
197197
done
198-
# Revert the math header patch
199-
patch -d "$GCC_STANDALONE_TOOLCHAIN_TMP/sysroot/usr/include/" -p8 -R < "$TERMUX_SCRIPTDIR/tur/ndk-sysroot-gcc-compact/0001-c++-v1-math-headers.patch"
200198
cp -R $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_API_LEVEL/* \
201199
$GCC_STANDALONE_TOOLCHAIN_TMP/sysroot/usr/lib/
202200
# Use libc++_shared as libstdc++

tur/ndk-sysroot-gcc-compact/0002-android-versioning.h.patch renamed to tur/ndk-sysroot-gcc-compact/0001-android-versioning.h.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ attribute is not available in GCC.
1010
// The `annotate` attribute always pulls the annotated (inline) function into the object files, thus
1111
// we should only annotate headers when we are running versioner.
1212
-#if defined(__BIONIC_VERSIONER)
13-
+#if defined(__BIONIC_VERSIONER) || ! defined(__clang__)
13+
+#if defined(__BIONIC_VERSIONER) || !defined(__clang__)
1414

15-
#define __INTRODUCED_IN(api_level) __attribute__((annotate("introduced_in=" #api_level)))
16-
#define __INTRODUCED_IN_NO_GUARD_FOR_NDK(api_level) __attribute__((annotate("introduced_in=" #api_level))) __VERSIONER_NO_GUARD
15+
#define __INTRODUCED_IN(api_level) __attribute__((__annotate__("introduced_in=" #api_level)))
16+
#define __INTRODUCED_IN_NO_GUARD_FOR_NDK(api_level) __attribute__((__annotate__("introduced_in=" #api_level))) __VERSIONER_NO_GUARD

tur/ndk-sysroot-gcc-compact/0001-c++-v1-math-headers.patch

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

tur/ndk-sysroot-gcc-compact/0004-compact-with-clang-builtins.patch renamed to tur/ndk-sysroot-gcc-compact/0002-compact-with-clang-builtins.patch

Lines changed: 7 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,11 @@ diff -uNr a/bits/ioctl.h b/bits/ioctl.h
1111
+#if defined(__clang__) && __has_extension(overloadable_unmarked) && \
1212
+ !defined(BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD)
1313
/* enable_if(1) just exists to break overloading ties. */
14-
int ioctl(int __fd, unsigned __request, ...) __overloadable __enable_if(1, "") __RENAME(ioctl);
14+
int ioctl(int __fd, unsigned __op, ...) __overloadable __enable_if(1, "") __RENAME(ioctl);
1515
#endif
1616
diff -uNr a/bits/stdatomic.h b/bits/stdatomic.h
1717
--- a/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/bits/stdatomic.h
1818
+++ b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/bits/stdatomic.h
19-
@@ -41,7 +41,7 @@
20-
*/
21-
22-
#include <stddef.h> /* For ptrdiff_t. */
23-
-#include <stdint.h>
24-
+#include <stdint.h> /* TODO: don't drag in all the macros, just the types. */
25-
// Include uchar.h only when available. Bionic's stdatomic.h is also used for
26-
// the host (via a copy in prebuilts/clang) and uchar.h is not available in the
27-
// glibc used for the host.
2819
@@ -49,6 +49,20 @@
2920
# include <uchar.h> /* For char16_t and char32_t. */
3021
#endif
@@ -60,15 +51,10 @@ diff -uNr a/bits/stdatomic.h b/bits/stdatomic.h
6051

6152
/*
6253
* Clang and recent GCC both provide predefined macros for the memory
63-
@@ -138,24 +157,63 @@
64-
* 7.17.4 Fences.
54+
@@ -139,23 +158,56 @@
6555
*/
6656

67-
-static __inline void atomic_thread_fence(memory_order __order __attribute__((unused))) {
68-
+static __inline void
69-
+atomic_thread_fence(memory_order __order __attribute__((unused)))
70-
+{
71-
+
57+
static __inline void atomic_thread_fence(memory_order __order __attribute__((__unused__))) {
7258
+#ifdef __CLANG_ATOMICS
7359
__c11_atomic_thread_fence(__order);
7460
+#elif defined(__GNUC_ATOMICS)
@@ -78,11 +64,7 @@ diff -uNr a/bits/stdatomic.h b/bits/stdatomic.h
7864
+#endif
7965
}
8066

81-
-static __inline void atomic_signal_fence(memory_order __order __attribute__((unused))) {
82-
+static __inline void
83-
+atomic_signal_fence(memory_order __order __attribute__((unused)))
84-
+{
85-
+
67+
static __inline void atomic_signal_fence(memory_order __order __attribute__((__unused__))) {
8668
+#ifdef __CLANG_ATOMICS
8769
__c11_atomic_signal_fence(__order);
8870
+#elif defined(__GNUC_ATOMICS)
@@ -127,15 +109,15 @@ diff -uNr a/bits/stdatomic.h b/bits/stdatomic.h
127109
typedef _Atomic(bool) atomic_bool;
128110
typedef _Atomic(char) atomic_char;
129111
typedef _Atomic(signed char) atomic_schar;
130-
@@ -204,6 +262,7 @@
112+
@@ -204,6 +256,7 @@
131113
* Compiler-specific operations.
132114
*/
133115

134116
+#if defined(__CLANG_ATOMICS)
135117
#define atomic_compare_exchange_strong_explicit(object, expected, \
136118
desired, success, failure) \
137119
__c11_atomic_compare_exchange_strong(object, expected, desired, \
138-
@@ -228,11 +287,91 @@
120+
@@ -228,11 +281,91 @@
139121
__c11_atomic_load(object, order)
140122
#define atomic_store_explicit(object, desired, order) \
141123
__c11_atomic_store(object, desired, order)
@@ -227,53 +209,14 @@ diff -uNr a/bits/stdatomic.h b/bits/stdatomic.h
227209
#define atomic_compare_exchange_strong(object, expected, desired) \
228210
atomic_compare_exchange_strong_explicit(object, expected, \
229211
desired, memory_order_seq_cst, memory_order_seq_cst)
230-
@@ -255,6 +394,7 @@
212+
@@ -255,6 +388,7 @@
231213
atomic_load_explicit(object, memory_order_seq_cst)
232214
#define atomic_store(object, desired) \
233215
atomic_store_explicit(object, desired, memory_order_seq_cst)
234216
+#endif /* !_KERNEL */
235217

236218
/*
237219
* 7.17.8 Atomic flag type and operations.
238-
@@ -269,18 +409,33 @@
239-
240-
#define ATOMIC_FLAG_INIT { ATOMIC_VAR_INIT(false) }
241-
242-
-static __inline bool atomic_flag_test_and_set_explicit(volatile atomic_flag *__object, memory_order __order) {
243-
+static __inline bool
244-
+atomic_flag_test_and_set_explicit(volatile atomic_flag *__object,
245-
+ memory_order __order)
246-
+{
247-
return (atomic_exchange_explicit(&__object->__flag, 1, __order));
248-
}
249-
250-
-static __inline void atomic_flag_clear_explicit(volatile atomic_flag *__object, memory_order __order) {
251-
+static __inline void
252-
+atomic_flag_clear_explicit(volatile atomic_flag *__object, memory_order __order)
253-
+{
254-
+
255-
atomic_store_explicit(&__object->__flag, 0, __order);
256-
}
257-
258-
-static __inline bool atomic_flag_test_and_set(volatile atomic_flag *__object) {
259-
- return (atomic_flag_test_and_set_explicit(__object, memory_order_seq_cst));
260-
+#ifndef _KERNEL
261-
+static __inline bool
262-
+atomic_flag_test_and_set(volatile atomic_flag *__object)
263-
+{
264-
+
265-
+ return (atomic_flag_test_and_set_explicit(__object,
266-
+ memory_order_seq_cst));
267-
}
268-
269-
-static __inline void atomic_flag_clear(volatile atomic_flag *__object) {
270-
+static __inline void
271-
+atomic_flag_clear(volatile atomic_flag *__object)
272-
+{
273-
+
274-
atomic_flag_clear_explicit(__object, memory_order_seq_cst);
275-
}
276-
+#endif /* !_KERNEL */
277220
diff -uNr a/complex.h b/complex.h
278221
--- a/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/complex.h
279222
+++ b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/complex.h

tur/ndk-sysroot-gcc-compact/0003-sys-cdefs.h.patch

Lines changed: 30 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,17 @@ diff -uNr a/sys/cdefs.h b/sys/cdefs.h
3333
#if defined(__cplusplus)
3434
#define __BEGIN_DECLS extern "C" {
3535
#define __END_DECLS }
36-
@@ -139,12 +162,25 @@
36+
@@ -142,12 +165,25 @@
3737

3838
#define __wur __attribute__((__warn_unused_result__))
3939

40-
-#define __errorattr(msg) __attribute__((unavailable(msg)))
41-
-#define __warnattr(msg) __attribute__((deprecated(msg)))
42-
-#define __warnattr_real(msg) __attribute__((deprecated(msg)))
43-
-#define __enable_if(cond, msg) __attribute__((enable_if(cond, msg)))
44-
-#define __clang_error_if(cond, msg) __attribute__((diagnose_if(cond, msg, "error")))
45-
-#define __clang_warning_if(cond, msg) __attribute__((diagnose_if(cond, msg, "warning")))
4640
+#ifdef __clang__
47-
+# define __errorattr(msg) __attribute__((unavailable(msg)))
48-
+# define __warnattr(msg) __attribute__((deprecated(msg)))
49-
+# define __warnattr_real(msg) __attribute__((deprecated(msg)))
50-
+# define __enable_if(cond, msg) __attribute__((enable_if(cond, msg)))
51-
+# define __clang_error_if(cond, msg) __attribute__((diagnose_if(cond, msg, "error")))
52-
+# define __clang_warning_if(cond, msg) __attribute__((diagnose_if(cond, msg, "warning")))
41+
#define __errorattr(msg) __attribute__((__unavailable__(msg)))
42+
#define __warnattr(msg) __attribute__((__deprecated__(msg)))
43+
#define __warnattr_real(msg) __attribute__((__deprecated__(msg)))
44+
#define __enable_if(cond, msg) __attribute__((__enable_if__(cond, msg)))
45+
#define __clang_error_if(cond, msg) __attribute__((__diagnose_if__(cond, msg, "error")))
46+
#define __clang_warning_if(cond, msg) __attribute__((__diagnose_if__(cond, msg, "warning")))
5347
+#else
5448
+# define __errorattr(msg) __attribute__((__error__(msg)))
5549
+# define __warnattr(msg) __attribute__((__warning__(msg)))
@@ -65,82 +59,60 @@ diff -uNr a/sys/cdefs.h b/sys/cdefs.h
6559

6660
#if defined(ANDROID_STRICT)
6761
/*
68-
@@ -281,19 +317,20 @@
62+
@@ -251,6 +287,7 @@
6963

7064
#if defined(__BIONIC_FORTIFY)
7165
# define __bos0(s) __bosn((s), 0)
72-
-# define __pass_object_size_n(n) __attribute__((pass_object_size(n)))
73-
+# if defined(__clang__)
74-
+# define __pass_object_size_n(n) __attribute__((pass_object_size(n)))
66+
+#if defined(__clang__)
67+
# define __pass_object_size_n(n) __attribute__((__pass_object_size__(n)))
7568
/*
7669
* FORTIFY'ed functions all have either enable_if or pass_object_size, which
77-
* makes taking their address impossible. Saying (&read)(foo, bar, baz); will
78-
* therefore call the unFORTIFYed version of read.
79-
*/
80-
-# define __call_bypassing_fortify(fn) (&fn)
81-
+# define __call_bypassing_fortify(fn) (&fn)
82-
/*
83-
* Because clang-FORTIFY uses overloads, we can't mark functions as `extern inline` without making
84-
* them available externally. FORTIFY'ed functions try to be as close to possible as 'invisible';
85-
* having stack protectors detracts from that (b/182948263).
86-
*/
87-
-# define __BIONIC_FORTIFY_INLINE static __inline__ __attribute__((no_stack_protector)) \
88-
+# define __BIONIC_FORTIFY_INLINE static __inline__ __attribute__((no_stack_protector)) \
89-
__always_inline __VERSIONER_FORTIFY_INLINE
90-
/*
91-
* We should use __BIONIC_FORTIFY_VARIADIC instead of __BIONIC_FORTIFY_INLINE
92-
@@ -301,9 +338,21 @@
93-
* The __always_inline attribute is useless, misleading, and could trigger
94-
* clang compiler bug to incorrectly inline variadic functions.
95-
*/
96-
-# define __BIONIC_FORTIFY_VARIADIC static __inline__
97-
+# define __BIONIC_FORTIFY_VARIADIC static __inline__
70+
@@ -275,6 +312,18 @@
9871
/* Error functions don't have bodies, so they can just be static. */
99-
-# define __BIONIC_ERROR_FUNCTION_VISIBILITY static __attribute__((unused))
100-
+# define __BIONIC_ERROR_FUNCTION_VISIBILITY static __attribute__((unused))
101-
+# else
72+
# define __BIONIC_ERROR_FUNCTION_VISIBILITY static __unused
73+
#else
10274
+/*
10375
+ * Where they can, GCC and clang-style FORTIFY share implementations.
10476
+ * So, make these nops in GCC.
10577
+ */
106-
+# define __pass_object_size_n(n)
107-
+# define __call_bypassing_fortify(fn) (fn)
78+
+# define __pass_object_size_n(n)
79+
+# define __call_bypassing_fortify(fn) (fn)
10880
+/* __BIONIC_FORTIFY_NONSTATIC_INLINE is pointless in GCC's FORTIFY */
109-
+# define __BIONIC_FORTIFY_INLINE extern __inline__ __always_inline __attribute__((gnu_inline)) __attribute__((__artificial__))
81+
+# define __BIONIC_FORTIFY_INLINE extern __inline__ __always_inline __attribute__((gnu_inline)) __attribute__((__artificial__))
11082
+/* __always_inline is probably okay and ignored by gcc in __BIONIC_FORTIFY_VARIADIC */
111-
+# define __BIONIC_FORTIFY_VARIADIC __BIONIC_FORTIFY_INLINE
112-
+# endif
113-
#else
83+
+# define __BIONIC_FORTIFY_VARIADIC __BIONIC_FORTIFY_INLINE
84+
+#endif
85+
+#else
11486
/* Further increase sharing for some inline functions */
11587
# define __pass_object_size_n(n)
116-
@@ -333,7 +382,16 @@
88+
#endif
89+
@@ -303,7 +352,16 @@
11790
# define __BIONIC_INCLUDE_FORTIFY_HEADERS 1
11891
#endif
11992

120-
-#define __overloadable __attribute__((overloadable))
12193
+#if !defined(__clang__) && defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
12294
+#undef __BIONIC_INCLUDE_FORTIFY_HEADERS
12395
+#warning "Fortify headers are not supported and will not used without clang."
12496
+#endif
12597
+
12698
+#if defined(__clang__)
127-
+# define __overloadable __attribute__((overloadable))
99+
#define __overloadable __attribute__((__overloadable__))
128100
+#else
129-
+# define __overloadable
101+
+#define __overloadable
130102
+#endif
131103

132-
#define __diagnose_as_builtin(...) __attribute__((diagnose_as_builtin(__VA_ARGS__)))
104+
#define __diagnose_as_builtin(...) __attribute__((__diagnose_as_builtin__(__VA_ARGS__)))
133105

134-
@@ -368,6 +426,7 @@
135-
}
136-
#endif
106+
@@ -323,6 +381,7 @@
107+
/* Used to rename functions so that the compiler emits a call to 'x' rather than the function this was applied to. */
108+
#define __RENAME(x) __asm__(#x)
137109

138110
+#if defined(__clang__)
139111
/*
140112
* Used when we need to check for overflow when multiplying x and y. This
141-
* should only be used where __size_mul_overflow can not work, because it makes
142-
@@ -376,6 +435,7 @@
143-
* __size_mul_overflow.
113+
* should only be used where __builtin_umull_overflow can not work, because it makes
114+
@@ -331,6 +390,7 @@
115+
* __builtin_umull_overflow.
144116
*/
145117
#define __unsafe_check_mul_overflow(x, y) ((__SIZE_TYPE__)-1 / (x) < (y))
146118
+#endif
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
--- a/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/bits/bionic_multibyte_result.h
2+
+++ b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/bits/bionic_multibyte_result.h
3+
@@ -45,6 +45,7 @@
4+
* Refer to C23 7.30.1 Restartable multibyte/wide character conversion functions
5+
* for more details.
6+
*/
7+
+#ifdef __clang__
8+
enum : size_t {
9+
/// @brief An encoding error occurred. The bytes read are not a valid unicode
10+
/// character, nor are they a partially valid character.
11+
@@ -64,5 +65,21 @@
12+
BIONIC_MULTIBYTE_RESULT_NO_BYTES_CONSUMED = -3UL,
13+
#define BIONIC_MULTIBYTE_RESULT_NO_BYTES_CONSUMED BIONIC_MULTIBYTE_RESULT_NO_BYTES_CONSUMED
14+
};
15+
+#else
16+
+/// @brief An encoding error occurred. The bytes read are not a valid unicode
17+
+/// character, nor are they a partially valid character.
18+
+#define BIONIC_MULTIBYTE_RESULT_ILLEGAL_SEQUENCE (size_t(-1UL))
19+
+
20+
+/// @brief The bytes read may produce a valid unicode character, but the
21+
+/// sequence is incomplete. Future calls may complete the character.
22+
+#define BIONIC_MULTIBYTE_RESULT_INCOMPLETE_SEQUENCE (size_t(-2UL))
23+
+
24+
+/// @brief The output of the call was the result of a previous successful
25+
+/// decoding. No new bytes were consumed.
26+
+///
27+
+/// The common case for this return value is when mbrtoc16 returns the low
28+
+/// surrogate of a pair.
29+
+#define BIONIC_MULTIBYTE_RESULT_NO_BYTES_CONSUMED (size_t(-3UL))
30+
+#endif
31+
32+
__END_DECLS
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__config
2+
+++ b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__config
3+
@@ -41,7 +41,7 @@
4+
# warning "Libc++ only supports AppleClang 15 and later"
5+
# endif
6+
# elif defined(_LIBCPP_GCC_VER)
7+
-# if _LIBCPP_GCC_VER < 1300
8+
+# if _LIBCPP_GCC_VER < 1300 && !defined(__TERMUX__)
9+
# warning "Libc++ only supports GCC 13 and later"
10+
# endif
11+
# endif

tur/ndk-sysroot-gcc-compact/0005-workaround-for-builtin-is_convertible.patch

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

tur/ndk-sysroot-gcc-compact/0007-reland-macro-guard-for-is_trivially_destructible.patch

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

0 commit comments

Comments
 (0)