[libc-commits] [libc] fix ppc64le builds without IEEE double long (PR #184995)

via libc-commits libc-commits at lists.llvm.org
Fri Mar 6 04:06:33 PST 2026


https://github.com/Fabian-Gruenbichler created https://github.com/llvm/llvm-project/pull/184995

I don't know a lot about LLVM internals, but these at least make a build pass on ppc64le without `-DPPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON` and might serve as a starting point ;)

>From 8bbbb319080366d11feb5796fbababbd99876773 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?=
 <debian at fabian.gruenbichler.email>
Date: Fri, 6 Mar 2026 08:17:35 +0100
Subject: [PATCH 1/2] libc: RPC: disable printf float support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

it does not work for ppc64el without -DPPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON.

Fixes: #184994

Signed-off-by: Fabian Grünbichler <debian at fabian.gruenbichler.email>
---
 libc/src/__support/RPC/rpc_server.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libc/src/__support/RPC/rpc_server.h b/libc/src/__support/RPC/rpc_server.h
index 8ea43c91826e6..6fdc0c1bcbdd5 100644
--- a/libc/src/__support/RPC/rpc_server.h
+++ b/libc/src/__support/RPC/rpc_server.h
@@ -36,6 +36,7 @@
 #define LIBC_COPT_PRINTF_DISABLE_WRITE_INT
 #define LIBC_COPT_PRINTF_DISABLE_INDEX_MODE
 #define LIBC_COPT_PRINTF_DISABLE_STRERROR
+#define LIBC_COPT_PRINTF_DISABLE_FLOAT
 
 // TODO: Remove this check once UTF-16 is supported. It may be necessary to add
 // additional targets for other systems that use UTF-16.

>From 133f997099485bdd326d4941addc4082509be553 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?=
 <debian at fabian.gruenbichler.email>
Date: Fri, 6 Mar 2026 08:18:48 +0100
Subject: [PATCH 2/2] libc: printf: add more ppc double double support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

the missing include caused the ppc case to fail to find UInt128 in the first
place, and the type definition in parser.h needed a similar fix.

Fixes: cc6def4b7521 (2025-04-23; "[libc] Special case PPC double double for print (#136614)")
Fixes: #184994

Signed-off-by: Fabian Grünbichler <debian at fabian.gruenbichler.email>
---
 libc/src/stdio/printf_core/core_structs.h | 3 +++
 libc/src/stdio/printf_core/parser.h       | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/libc/src/stdio/printf_core/core_structs.h b/libc/src/stdio/printf_core/core_structs.h
index 705865745db47..7e8e6407898cf 100644
--- a/libc/src/stdio/printf_core/core_structs.h
+++ b/libc/src/stdio/printf_core/core_structs.h
@@ -13,6 +13,9 @@
 
 #include "src/__support/CPP/string_view.h"
 #include "src/__support/CPP/type_traits.h"
+#ifdef LIBC_TYPES_LONG_DOUBLE_IS_DOUBLE_DOUBLE
+#include "src/__support/uint128.h"
+#endif // LIBC_TYPES_LONG_DOUBLE_IS_DOUBLE_DOUBLE
 #include "src/__support/FPUtil/FPBits.h"
 #include "src/stdio/printf_core/printf_config.h"
 
diff --git a/libc/src/stdio/printf_core/parser.h b/libc/src/stdio/printf_core/parser.h
index d70a3aa91ce61..e4494ac46e402 100644
--- a/libc/src/stdio/printf_core/parser.h
+++ b/libc/src/stdio/printf_core/parser.h
@@ -41,7 +41,11 @@ template <> struct int_type_of<double> {
   using type = fputil::FPBits<double>::StorageType;
 };
 template <> struct int_type_of<long double> {
+#ifdef LIBC_TYPES_LONG_DOUBLE_IS_DOUBLE_DOUBLE
+  using type = UInt128;
+#else
   using type = fputil::FPBits<long double>::StorageType;
+#endif // LIBC_TYPES_LONG_DOUBLE_IS_DOUBLE_DOUBLE
 };
 
 #ifdef LIBC_INTERNAL_PRINTF_HAS_FIXED_POINT



More information about the libc-commits mailing list