mirror of
https://codeberg.org/guix/guix.git
synced 2026-10-03 15:43:14 +00:00
Building clang-runtime-22 fails since gcc does not support the __float128 type on all platforms. The triggering code has been fixed in upstream LLVM but has not been included in a release so far. * gnu/packages/patches/llvm-22-cfloat128-detection.patch: New file. * gnu/packages/llvm.scm (%llvm-patches): Add it for version 22.1.8. * gnu/local.mk (dist_patch_DATA): Register the patch. Merges: https://codeberg.org/guix/guix/pulls/9713 Signed-off-by: Nguyễn Gia Phong <cnx@loang.net>
68 lines
2.5 KiB
Diff
68 lines
2.5 KiB
Diff
Upstream status: https://github.com/llvm/llvm-project/issues/187182, not released
|
|
|
|
From 592eba5d448fa6f28657d364f6fdf877a38d7603 Mon Sep 17 00:00:00 2001
|
|
From: Bernd Kuhls <bernd@kuhls.net>
|
|
Date: Mon, 9 Mar 2026 19:07:10 +0100
|
|
Subject: [PATCH] [libc] Fix detection of cfloat128
|
|
|
|
Building compiler-rt with aarch64-buildroot-linux-gnu-gcc 15.2 causes a
|
|
build error:
|
|
|
|
compiler-rt-22.1.0/cmake/Modules/../../libc/src/__support/CPP/type_traits/is_complex.h:44:31:
|
|
error: 'cfloat128' was not declared in this scope; did you mean 'float128'? [-Wtemplate-body]
|
|
|
|
According to https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gcc/Floating-Types.html
|
|
__float128 is not available on aarch64.
|
|
|
|
Analyzing the gcc defines for aarch64 seems to prove it:
|
|
|
|
$ aarch64-buildroot-linux-gnu-gcc -v
|
|
Target: aarch64-buildroot-linux-gnu
|
|
gcc version 15.2.0 (Buildroot 2026.02-114-gdadec9da56)
|
|
|
|
$ echo | aarch64-buildroot-linux-gnu-gcc -dM -E - | grep __GCC_IEC_559_COMPLEX
|
|
#define __GCC_IEC_559_COMPLEX 2
|
|
|
|
$ echo | aarch64-buildroot-linux-gnu-gcc -dM -E - | grep __STDC_IEC_60559_COMPLEX__
|
|
#define __STDC_IEC_60559_COMPLEX__ 201404L
|
|
|
|
$ echo | aarch64-buildroot-linux-gnu-gcc -dM -E - | grep -i float128
|
|
$
|
|
|
|
In contrast gcc for x86_64:
|
|
|
|
$ x86_64-buildroot-linux-gnu-gcc -v
|
|
Target: x86_64-buildroot-linux-gnu
|
|
gcc version 15.2.0 (Buildroot 2026.02-112-gd12ac02486)
|
|
|
|
$ echo | x86_64-buildroot-linux-gnu-gcc -dM -E - | grep __GCC_IEC_559_COMPLEX
|
|
#define __GCC_IEC_559_COMPLEX 2
|
|
|
|
$ echo | x86_64-buildroot-linux-gnu-gcc -dM -E - | grep __STDC_IEC_60559_COMPLEX__
|
|
#define __STDC_IEC_60559_COMPLEX__ 201404L
|
|
|
|
$ echo | x86_64-buildroot-linux-gnu-gcc -dM -E - | grep -i float128
|
|
#define __SIZEOF_FLOAT128__ 16
|
|
|
|
This patch changes the or-condition to an and-condition for
|
|
__STDC_IEC_60559_COMPLEX__ and __SIZEOF_FLOAT128__.
|
|
|
|
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
|
---
|
|
libc/include/llvm-libc-macros/cfloat128-macros.h | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/libc/include/llvm-libc-macros/cfloat128-macros.h b/libc/include/llvm-libc-macros/cfloat128-macros.h
|
|
index 5f28cfa21aaee..ff4aa530685de 100644
|
|
--- a/libc/include/llvm-libc-macros/cfloat128-macros.h
|
|
+++ b/libc/include/llvm-libc-macros/cfloat128-macros.h
|
|
@@ -27,7 +27,7 @@
|
|
#define LIBC_TYPES_HAS_CFLOAT128
|
|
#endif
|
|
#elif defined(__GNUC__)
|
|
-#if (defined(__STDC_IEC_60559_COMPLEX__) || defined(__SIZEOF_FLOAT128__)) && \
|
|
+#if (defined(__STDC_IEC_60559_COMPLEX__) && defined(__SIZEOF_FLOAT128__)) && \
|
|
(__GNUC__ >= 13 || (!defined(__cplusplus)))
|
|
#define LIBC_TYPES_HAS_CFLOAT128
|
|
#endif
|