Date: Sun, 21 Jun 2026 20:05:31 +0000 From: Piotr Kubaj <pkubaj@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: c02c1227e2d2 - main - lang/gcc1?: fix runtime on powerpc64le/CURRENT Message-ID: <6a38440b.3a667.27c0550a@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/ports/commit/?id=c02c1227e2d23dbfdb7a4b32cc29f42847a21cfd commit c02c1227e2d23dbfdb7a4b32cc29f42847a21cfd Author: Piotr Kubaj <pkubaj@FreeBSD.org> AuthorDate: 2026-06-21 20:01:35 +0000 Commit: Piotr Kubaj <pkubaj@FreeBSD.org> CommitDate: 2026-06-21 20:05:23 +0000 lang/gcc1?: fix runtime on powerpc64le/CURRENT Since powerpc64le recently switched to 128-bit long double, use them to generate proper binaries. Patches are necessary to allow use of --with-long-double-format=ieee on FreeBSD (to be upstreamed). --- lang/gcc12/Makefile | 6 ++- lang/gcc12/files/patch-gcc_config.gcc | 14 +++++++ lang/gcc12/files/patch-libgcc_config.host | 15 +++++++ lang/gcc13/Makefile | 6 ++- lang/gcc13/files/patch-gcc_config.gcc | 14 +++++++ lang/gcc13/files/patch-libgcc_config.host | 15 +++++++ lang/gcc14/Makefile | 6 ++- lang/gcc14/files/patch-gcc_config.gcc | 14 +++++++ lang/gcc14/files/patch-gcc_configure | 32 +++++---------- lang/gcc14/files/patch-libgcc_config.host | 15 +++++++ .../patch-libgcc_config_rs6000_freebsd-unwind.h | 48 ++++++++++++++++++++++ lang/gcc15/Makefile | 6 ++- lang/gcc15/files/patch-gcc_config.gcc | 14 +++++++ lang/gcc15/files/patch-libgcc_config.host | 15 +++++++ lang/gcc16/Makefile | 5 +++ lang/gcc16/files/patch-gcc_config.gcc | 14 +++++++ lang/gcc16/files/patch-libgcc_config.host | 15 +++++++ 17 files changed, 229 insertions(+), 25 deletions(-) diff --git a/lang/gcc12/Makefile b/lang/gcc12/Makefile index 03aa59736457..f1eb0557e635 100644 --- a/lang/gcc12/Makefile +++ b/lang/gcc12/Makefile @@ -1,6 +1,6 @@ PORTNAME= gcc PORTVERSION= 12.4.0 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= lang MASTER_SITES= GCC PKGNAMESUFFIX= ${SUFFIX} @@ -70,6 +70,10 @@ GRAPHITE_CONFIGURE_WITH+= isl .include <bsd.port.pre.mk> +.if ${ARCH} == powerpc64le && ${OSVERSION} >= 1600019 +CONFIGURE_ARGS+= --with-long-double-format=ieee +.endif + # Extraction fails with poudriere on aarch64 for GCC 12. # It seems that the bug is specific to lang/gcc11 and lang/gcc12 only. # No other GCC port is affected. diff --git a/lang/gcc12/files/patch-gcc_config.gcc b/lang/gcc12/files/patch-gcc_config.gcc new file mode 100644 index 000000000000..4748ac147b45 --- /dev/null +++ b/lang/gcc12/files/patch-gcc_config.gcc @@ -0,0 +1,14 @@ +--- gcc/config.gcc.orig ++++ gcc/config.gcc +@@ -2925,7 +2925,10 @@ + tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" + case ${target} in + powerpc*le-*-*) +- tm_file="${tm_file} rs6000/sysv4le.h" ;; ++ tm_file="${tm_file} rs6000/sysv4le.h" ++ if test x$with_long_double_format = xieee; then ++ tm_defines="${tm_defines} RS6000_DEFAULT_LONG_DOUBLE_SIZE=128 TARGET_IEEEQUAD_DEFAULT=1 TARGET_FLOAT128_ENABLE_TYPE=1" ++ fi ;; + esac + case ${target} in + powerpc64*) diff --git a/lang/gcc12/files/patch-libgcc_config.host b/lang/gcc12/files/patch-libgcc_config.host new file mode 100644 index 000000000000..0a4d89aba26d --- /dev/null +++ b/lang/gcc12/files/patch-libgcc_config.host @@ -0,0 +1,15 @@ +--- libgcc/config.host.orig ++++ libgcc/config.host +@@ -1202,6 +1202,12 @@ + powerpc64*) + tmake_file="${tmake_file} rs6000/t-freebsd64" + md_unwind_header=rs6000/freebsd-unwind.h ++ if test $libgcc_cv_powerpc_float128 = yes; then ++ tmake_file="${tmake_file} rs6000/t-float128" ++ fi ++ if test $libgcc_cv_powerpc_float128_hw = yes; then ++ tmake_file="${tmake_file} rs6000/t-float128-hw" ++ fi + ;; + esac + ;; diff --git a/lang/gcc13/Makefile b/lang/gcc13/Makefile index 87a94678dcd1..51eab576cca3 100644 --- a/lang/gcc13/Makefile +++ b/lang/gcc13/Makefile @@ -1,6 +1,6 @@ PORTNAME= gcc PORTVERSION= 13.3.0 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= lang MASTER_SITES= GCC PKGNAMESUFFIX= ${SUFFIX} @@ -70,6 +70,10 @@ GRAPHITE_CONFIGURE_WITH+= isl .include <bsd.port.pre.mk> +.if ${ARCH} == powerpc64le && ${OSVERSION} >= 1600019 +CONFIGURE_ARGS+= --with-long-double-format=ieee +.endif + .if ${ARCH} == amd64 CONFIGURE_TARGET= x86_64-portbld-${OPSYS:tl}${OSREL} diff --git a/lang/gcc13/files/patch-gcc_config.gcc b/lang/gcc13/files/patch-gcc_config.gcc new file mode 100644 index 000000000000..ba3857024a0c --- /dev/null +++ b/lang/gcc13/files/patch-gcc_config.gcc @@ -0,0 +1,14 @@ +--- gcc/config.gcc.orig ++++ gcc/config.gcc +@@ -2896,7 +2896,10 @@ + tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" + case ${target} in + powerpc*le-*-*) +- tm_file="${tm_file} rs6000/sysv4le.h" ;; ++ tm_file="${tm_file} rs6000/sysv4le.h" ++ if test x$with_long_double_format = xieee; then ++ tm_defines="${tm_defines} RS6000_DEFAULT_LONG_DOUBLE_SIZE=128 TARGET_IEEEQUAD_DEFAULT=1 TARGET_FLOAT128_ENABLE_TYPE=1" ++ fi ;; + esac + case ${target} in + powerpc64*) diff --git a/lang/gcc13/files/patch-libgcc_config.host b/lang/gcc13/files/patch-libgcc_config.host new file mode 100644 index 000000000000..c8a166903ca8 --- /dev/null +++ b/lang/gcc13/files/patch-libgcc_config.host @@ -0,0 +1,15 @@ +--- libgcc/config.host.orig ++++ libgcc/config.host +@@ -1186,6 +1186,12 @@ + powerpc64*) + tmake_file="${tmake_file} rs6000/t-freebsd64" + md_unwind_header=rs6000/freebsd-unwind.h ++ if test $libgcc_cv_powerpc_float128 = yes; then ++ tmake_file="${tmake_file} rs6000/t-float128" ++ fi ++ if test $libgcc_cv_powerpc_float128_hw = yes; then ++ tmake_file="${tmake_file} rs6000/t-float128-hw" ++ fi + ;; + esac + ;; diff --git a/lang/gcc14/Makefile b/lang/gcc14/Makefile index 3f2d7cf4848d..17159a0be400 100644 --- a/lang/gcc14/Makefile +++ b/lang/gcc14/Makefile @@ -1,6 +1,6 @@ PORTNAME= gcc PORTVERSION= 14.2.0 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= lang MASTER_SITES= GCC PKGNAMESUFFIX= ${SUFFIX} @@ -73,6 +73,10 @@ GRAPHITE_CONFIGURE_WITH+= isl .include <bsd.port.pre.mk> +.if ${ARCH} == powerpc64le && ${OSVERSION} >= 1600019 +CONFIGURE_ARGS+= --with-long-double-format=ieee +.endif + .if ${ARCH} == amd64 CONFIGURE_TARGET= x86_64-portbld-${OPSYS:tl}${OSREL} diff --git a/lang/gcc14/files/patch-gcc_config.gcc b/lang/gcc14/files/patch-gcc_config.gcc new file mode 100644 index 000000000000..88982d862539 --- /dev/null +++ b/lang/gcc14/files/patch-gcc_config.gcc @@ -0,0 +1,14 @@ +--- gcc/config.gcc.orig ++++ gcc/config.gcc +@@ -2982,7 +2982,10 @@ + tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" + case ${target} in + powerpc*le-*-*) +- tm_file="${tm_file} rs6000/sysv4le.h" ;; ++ tm_file="${tm_file} rs6000/sysv4le.h" ++ if test x$with_long_double_format = xieee; then ++ tm_defines="${tm_defines} RS6000_DEFAULT_LONG_DOUBLE_SIZE=128 TARGET_IEEEQUAD_DEFAULT=1 TARGET_FLOAT128_ENABLE_TYPE=1" ++ fi ;; + esac + case ${target} in + powerpc64*) diff --git a/lang/gcc14/files/patch-gcc_configure b/lang/gcc14/files/patch-gcc_configure index cc60593ba6f7..f5fff9e6160c 100644 --- a/lang/gcc14/files/patch-gcc_configure +++ b/lang/gcc14/files/patch-gcc_configure @@ -1,22 +1,12 @@ -Enable support for .init_array and .fini_array, which FreeBSD supports -since commit 83aa9cc00c2d83d05a0efe7a1496d8aab4a153bb in the src -repository. - -There __FreeBSD_version is 1000009, so we start enabling the support -from __FreeBSD_version == 1000010. ---- gcc/configure.orig 2023-05-11 22:33:34 UTC +--- gcc/configure.orig +++ gcc/configure -@@ -24214,6 +24214,13 @@ EOF - #else - # if defined __sun__ && defined __svr4__ - /* Solaris ld.so.1 supports .init_array/.fini_array since Solaris 8. */ -+# elif defined __FreeBSD__ -+# include <sys/param.h> -+# if __FreeBSD_version >= 1000010 -+ /* FreeBSD supports .init_array/.fini_array since FreeBSD 10. */ -+# else -+# error The C library not known to support .init_array/.fini_array -+# endif - # else - # error The C library not known to support .init_array/.fini_array - # endif +@@ -33568,7 +33568,8 @@ + if test "${with_long_double_format+set}" = set; then : + withval=$with_long_double_format; + case "$target:$with_long_double_format" in +- powerpc64le-*-linux*:ieee | powerpc64le-*-linux*:ibm) ++ powerpc64le-*-linux*:ieee | powerpc64le-*-linux*:ibm | \ ++ powerpc64le-*-freebsd*:ieee | powerpc64le-*-freebsd*:ibm) + : + ;; + powerpc64-*-linux*:ieee | powerpc64-*-linux*:ibm) diff --git a/lang/gcc14/files/patch-libgcc_config.host b/lang/gcc14/files/patch-libgcc_config.host new file mode 100644 index 000000000000..9df98d888ad2 --- /dev/null +++ b/lang/gcc14/files/patch-libgcc_config.host @@ -0,0 +1,15 @@ +--- libgcc/config.host.orig ++++ libgcc/config.host +@@ -1230,6 +1230,12 @@ + powerpc64*) + tmake_file="${tmake_file} rs6000/t-freebsd64" + md_unwind_header=rs6000/freebsd-unwind.h ++ if test $libgcc_cv_powerpc_float128 = yes; then ++ tmake_file="${tmake_file} rs6000/t-float128" ++ fi ++ if test $libgcc_cv_powerpc_float128_hw = yes; then ++ tmake_file="${tmake_file} rs6000/t-float128-hw" ++ fi + ;; + esac + ;; diff --git a/lang/gcc14/files/patch-libgcc_config_rs6000_freebsd-unwind.h b/lang/gcc14/files/patch-libgcc_config_rs6000_freebsd-unwind.h new file mode 100644 index 000000000000..ad0a9045ecd6 --- /dev/null +++ b/lang/gcc14/files/patch-libgcc_config_rs6000_freebsd-unwind.h @@ -0,0 +1,48 @@ +--- libgcc/config/rs6000/freebsd-unwind.h.orig ++++ libgcc/config/rs6000/freebsd-unwind.h +@@ -33,6 +33,11 @@ + const unsigned int *pc = (const unsigned int *) context->ra; + + #ifdef __powerpc64__ ++#if _CALL_ELF == 2 ++#define TOC_SAVE_SLOT 24 ++#else ++#define TOC_SAVE_SLOT 40 ++#endif + if (fs->regs.how[2] == REG_UNSAVED) + { + /* If the current unwind info (FS) does not contain explicit info +@@ -40,9 +45,9 @@ + figure out if it was saved. The big problem here is that the + code that does the save/restore is generated by the linker, so + we have no good way to determine at compile time what to do. */ +- if (pc[0] == 0xF8410028 ++ if (pc[0] == 0xF8410000 + TOC_SAVE_SLOT + || ((pc[0] & 0xFFFF0000) == 0x3D820000 +- && pc[1] == 0xF8410028)) ++ && pc[1] == 0xF8410000 + TOC_SAVE_SLOT)) + { + /* We are in a plt call stub or r2 adjusting long branch stub, + before r2 has been saved. Keep REG_UNSAVED. */ +@@ -51,17 +56,17 @@ + { + unsigned int *insn + = (unsigned int *) _Unwind_GetGR (context, R_LR); +- if (insn && *insn == 0xE8410028) +- _Unwind_SetGRPtr (context, 2, context->cfa + 40); ++ if (insn && *insn == 0xE8410000 + TOC_SAVE_SLOT) ++ _Unwind_SetGRPtr (context, 2, context->cfa + TOC_SAVE_SLOT); + else if (pc[0] == 0x4E800421 +- && pc[1] == 0xE8410028) ++ && pc[1] == 0xE8410000 + TOC_SAVE_SLOT) + { + /* We are at the bctrl instruction in a call via function + pointer. gcc always emits the load of the new R2 just + before the bctrl so this is the first and only place + we need to use the stored R2. */ + _Unwind_Word sp = _Unwind_GetGR (context, 1); +- _Unwind_SetGRPtr (context, 2, (void *)(sp + 40)); ++ _Unwind_SetGRPtr (context, 2, (void *)(sp + TOC_SAVE_SLOT)); + } + } + } diff --git a/lang/gcc15/Makefile b/lang/gcc15/Makefile index d4e52f6d3815..62443af95010 100644 --- a/lang/gcc15/Makefile +++ b/lang/gcc15/Makefile @@ -1,6 +1,6 @@ PORTNAME= gcc PORTVERSION= 15.2.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= lang MASTER_SITES= GCC PKGNAMESUFFIX= ${SUFFIX} @@ -73,6 +73,10 @@ GRAPHITE_CONFIGURE_WITH+= isl .include <bsd.port.pre.mk> +.if ${ARCH} == powerpc64le && ${OSVERSION} >= 1600019 +CONFIGURE_ARGS+= --with-long-double-format=ieee +.endif + .if ${ARCH} == amd64 CONFIGURE_TARGET= x86_64-portbld-${OPSYS:tl}${OSREL} diff --git a/lang/gcc15/files/patch-gcc_config.gcc b/lang/gcc15/files/patch-gcc_config.gcc new file mode 100644 index 000000000000..f4411b855d0f --- /dev/null +++ b/lang/gcc15/files/patch-gcc_config.gcc @@ -0,0 +1,14 @@ +--- gcc/config.gcc.orig ++++ gcc/config.gcc +@@ -3001,7 +3001,10 @@ + tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" + case ${target} in + powerpc*le-*-*) +- tm_file="${tm_file} rs6000/sysv4le.h" ;; ++ tm_file="${tm_file} rs6000/sysv4le.h" ++ if test x$with_long_double_format = xieee; then ++ tm_defines="${tm_defines} RS6000_DEFAULT_LONG_DOUBLE_SIZE=128 TARGET_IEEEQUAD_DEFAULT=1 TARGET_FLOAT128_ENABLE_TYPE=1" ++ fi ;; + esac + case ${target} in + powerpc64*) diff --git a/lang/gcc15/files/patch-libgcc_config.host b/lang/gcc15/files/patch-libgcc_config.host new file mode 100644 index 000000000000..1fe3e9673157 --- /dev/null +++ b/lang/gcc15/files/patch-libgcc_config.host @@ -0,0 +1,15 @@ +--- libgcc/config.host.orig ++++ libgcc/config.host +@@ -1236,6 +1236,12 @@ + powerpc64*) + tmake_file="${tmake_file} rs6000/t-freebsd64" + md_unwind_header=rs6000/freebsd-unwind.h ++ if test $libgcc_cv_powerpc_float128 = yes; then ++ tmake_file="${tmake_file} rs6000/t-float128" ++ fi ++ if test $libgcc_cv_powerpc_float128_hw = yes; then ++ tmake_file="${tmake_file} rs6000/t-float128-hw" ++ fi + ;; + esac + ;; diff --git a/lang/gcc16/Makefile b/lang/gcc16/Makefile index a7e4e81c243e..50f171686af8 100644 --- a/lang/gcc16/Makefile +++ b/lang/gcc16/Makefile @@ -1,5 +1,6 @@ PORTNAME= gcc PORTVERSION= 16.1.0 +PORTREVISION= 1 CATEGORIES= lang MASTER_SITES= GCC PKGNAMESUFFIX= ${SUFFIX} @@ -72,6 +73,10 @@ GRAPHITE_CONFIGURE_WITH+= isl .include <bsd.port.pre.mk> +.if ${ARCH} == powerpc64le && ${OSVERSION} >= 1600019 +CONFIGURE_ARGS+= --with-long-double-format=ieee +.endif + .if ${ARCH} == amd64 CONFIGURE_TARGET= x86_64-portbld-${OPSYS:tl}${OSREL} diff --git a/lang/gcc16/files/patch-gcc_config.gcc b/lang/gcc16/files/patch-gcc_config.gcc new file mode 100644 index 000000000000..781d84f0fbd2 --- /dev/null +++ b/lang/gcc16/files/patch-gcc_config.gcc @@ -0,0 +1,14 @@ +--- gcc/config.gcc.orig ++++ gcc/config.gcc +@@ -3071,7 +3071,10 @@ + tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" + case ${target} in + powerpc*le-*-*) +- tm_file="${tm_file} rs6000/sysv4le.h" ;; ++ tm_file="${tm_file} rs6000/sysv4le.h" ++ if test x$with_long_double_format = xieee; then ++ tm_defines="${tm_defines} RS6000_DEFAULT_LONG_DOUBLE_SIZE=128 TARGET_IEEEQUAD_DEFAULT=1 TARGET_FLOAT128_ENABLE_TYPE=1" ++ fi ;; + esac + case ${target} in + powerpc64*) diff --git a/lang/gcc16/files/patch-libgcc_config.host b/lang/gcc16/files/patch-libgcc_config.host new file mode 100644 index 000000000000..a66af11c0545 --- /dev/null +++ b/lang/gcc16/files/patch-libgcc_config.host @@ -0,0 +1,15 @@ +--- libgcc/config.host.orig ++++ libgcc/config.host +@@ -1234,6 +1234,12 @@ + powerpc64*) + tmake_file="${tmake_file} rs6000/t-freebsd64" + md_unwind_header=rs6000/freebsd-unwind.h ++ if test $libgcc_cv_powerpc_float128 = yes; then ++ tmake_file="${tmake_file} rs6000/t-float128" ++ fi ++ if test $libgcc_cv_powerpc_float128_hw = yes; then ++ tmake_file="${tmake_file} rs6000/t-float128-hw" ++ fi + ;; + esac + ;;home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a38440b.3a667.27c0550a>
