projects/guix·blob python-team · refs

67 lines · 2.5 KiB

1Upstream status: https://github.com/llvm/llvm-project/issues/187182, not released
2
3From 592eba5d448fa6f28657d364f6fdf877a38d7603 Mon Sep 17 00:00:00 2001
4From: Bernd Kuhls <[email protected]>
5Date: Mon, 9 Mar 2026 19:07:10 +0100
6Subject: [PATCH] [libc] Fix detection of cfloat128
7
8Building compiler-rt with aarch64-buildroot-linux-gnu-gcc 15.2 causes a
9build error:
10
11compiler-rt-22.1.0/cmake/Modules/../../libc/src/__support/CPP/type_traits/is_complex.h:44:31:
12 error: 'cfloat128' was not declared in this scope; did you mean 'float128'? [-Wtemplate-body]
13
14According to https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gcc/Floating-Types.html
15__float128 is not available on aarch64.
16
17Analyzing the gcc defines for aarch64 seems to prove it:
18
19$ aarch64-buildroot-linux-gnu-gcc -v
20Target: aarch64-buildroot-linux-gnu
21gcc version 15.2.0 (Buildroot 2026.02-114-gdadec9da56)
22
23$ echo | aarch64-buildroot-linux-gnu-gcc -dM -E - | grep __GCC_IEC_559_COMPLEX
24 #define __GCC_IEC_559_COMPLEX 2
25
26$ echo | aarch64-buildroot-linux-gnu-gcc -dM -E - | grep __STDC_IEC_60559_COMPLEX__
27 #define __STDC_IEC_60559_COMPLEX__ 201404L
28
29$ echo | aarch64-buildroot-linux-gnu-gcc -dM -E - | grep -i float128
30$
31
32In contrast gcc for x86_64:
33
34$ x86_64-buildroot-linux-gnu-gcc -v
35Target: x86_64-buildroot-linux-gnu
36gcc version 15.2.0 (Buildroot 2026.02-112-gd12ac02486)
37
38$ echo | x86_64-buildroot-linux-gnu-gcc -dM -E - | grep __GCC_IEC_559_COMPLEX
39 #define __GCC_IEC_559_COMPLEX 2
40
41$ echo | x86_64-buildroot-linux-gnu-gcc -dM -E - | grep __STDC_IEC_60559_COMPLEX__
42 #define __STDC_IEC_60559_COMPLEX__ 201404L
43
44$ echo | x86_64-buildroot-linux-gnu-gcc -dM -E - | grep -i float128
45 #define __SIZEOF_FLOAT128__ 16
46
47This patch changes the or-condition to an and-condition for
48__STDC_IEC_60559_COMPLEX__ and __SIZEOF_FLOAT128__.
49
50Signed-off-by: Bernd Kuhls <[email protected]>
51---
52 libc/include/llvm-libc-macros/cfloat128-macros.h | 2 +-
53 1 file changed, 1 insertion(+), 1 deletion(-)
54
55diff --git a/libc/include/llvm-libc-macros/cfloat128-macros.h b/libc/include/llvm-libc-macros/cfloat128-macros.h
56index 5f28cfa21aaee..ff4aa530685de 100644
57--- a/libc/include/llvm-libc-macros/cfloat128-macros.h
58+++ b/libc/include/llvm-libc-macros/cfloat128-macros.h
59@@ -27,7 +27,7 @@
60 #define LIBC_TYPES_HAS_CFLOAT128
61 #endif
62 #elif defined(__GNUC__)
63-#if (defined(__STDC_IEC_60559_COMPLEX__) || defined(__SIZEOF_FLOAT128__)) && \
64+#if (defined(__STDC_IEC_60559_COMPLEX__) && defined(__SIZEOF_FLOAT128__)) && \
65 (__GNUC__ >= 13 || (!defined(__cplusplus)))
66 #define LIBC_TYPES_HAS_CFLOAT128
67 #endif