git: c570f9bf8c0b - main - devel/gdb: fix runtime on powerpc64le/CURRENT

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Sun, 21 Jun 2026 20:05:29 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c570f9bf8c0b99400a6a037490ce91ee4c2a62a6

commit c570f9bf8c0b99400a6a037490ce91ee4c2a62a6
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2026-06-21 19:59:01 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2026-06-21 20:05:22 +0000

    devel/gdb: fix runtime on powerpc64le/CURRENT
    
    powerpc64le recently switched to 128-bit long double, so conditionally
    apply the patch to use them instead of 64-bit ones.
---
 devel/gdb/Makefile                              |  8 +++++++-
 devel/gdb/files/extra-patch-gdb_ppc-fbsd-tdep.c | 24 ++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/devel/gdb/Makefile b/devel/gdb/Makefile
index ac00b1ce3187..a3c26100de9c 100644
--- a/devel/gdb/Makefile
+++ b/devel/gdb/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	gdb
 DISTVERSION=	15.1
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	devel
 MASTER_SITES=	GNU
 
@@ -129,6 +129,12 @@ EXCLUDE+=	zlib
 CONFIGURE_TARGET=	x86_64-portbld-freebsd${OSREL}
 .endif
 
+# powerpc64le switched long double to IEEE-128 in FreeBSD 16; apply the gdb
+# long-double format fix only there so 14/15 packages keep the 64-bit format.
+.if ${ARCH} == powerpc64le && ${OSVERSION} >= 1600019
+EXTRA_PATCHES+=	${PATCHDIR}/extra-patch-gdb_ppc-fbsd-tdep.c
+.endif
+
 post-patch:
 	@${REINPLACE_CMD} -e 's|$$| [GDB v${DISTVERSION} for FreeBSD]|' \
 		${WRKSRC}/gdb/version.in
diff --git a/devel/gdb/files/extra-patch-gdb_ppc-fbsd-tdep.c b/devel/gdb/files/extra-patch-gdb_ppc-fbsd-tdep.c
new file mode 100644
index 000000000000..fd56f6ee9f7a
--- /dev/null
+++ b/devel/gdb/files/extra-patch-gdb_ppc-fbsd-tdep.c
@@ -0,0 +1,24 @@
+--- gdb/ppc-fbsd-tdep.c.orig	2026-06-04 12:15:06.422114475 +0200
++++ gdb/ppc-fbsd-tdep.c	2026-06-04 12:15:07.853463132 +0200
+@@ -322,9 +322,18 @@
+   /* Generic FreeBSD support. */
+   fbsd_init_abi (info, gdbarch);
+ 
+-  /* FreeBSD doesn't support the 128-bit `long double' from the psABI.  */
+-  set_gdbarch_long_double_bit (gdbarch, 64);
+-  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
++  /* powerpc64le switched long double to IEEE 754 binary128 in FreeBSD 16;
++     other powerpc variants keep the 64-bit `long double'.  */
++  if (tdep->wordsize == 8 && info.byte_order == BFD_ENDIAN_LITTLE)
++    {
++      set_gdbarch_long_double_bit (gdbarch, 128);
++      set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
++    }
++  else
++    {
++      set_gdbarch_long_double_bit (gdbarch, 64);
++      set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
++    }
+ 
+   if (tdep->wordsize == 4)
+     {