pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/lang



Module Name:    pkgsrc
Committed By:   he
Date:           Wed Jul 22 19:28:27 UTC 2026

Modified Files:
        pkgsrc/lang/gcc15: Makefile distinfo
        pkgsrc/lang/gcc15-libs: Makefile
        pkgsrc/lang/gcc15/patches: patch-gcc_config.gcc
Added Files:
        pkgsrc/lang/gcc15/patches: patch-gcc_config_rs6000_netbsd.h
            patch-gcc_config_rs6000_netbsd64.h
            patch-gcc_config_rs6000_rs6000-logue.cc
            patch-gcc_config_rs6000_rs6000.cc patch-gcc_config_rs6000_sysv4.h
            patch-gcc_config_rs6000_t-netbsd patch-gcc_config_rs6000_t-netbsd64
            patch-gcc_config_rs6000_t-rs6000

Log Message:
lang/gcc15: Add changes to make this build on NetBSD/macppc 11.0_RC6.

This pulls over changes to config/rs6000/ and gcc/config.gcc from
our in-tree gcc instance of gcc14, while preserving existing Homebrew-
related changes to gcc/config.gcc.

The most important fix is that on NetBSD/powerpc, -msecure-plt is enabled
by default, so that resulting executables can be run with PAX_MPROTECT
active.  Otherwise, we end up with executables with sections which have
both "write" and "execute" turned on, which PAX_MPROTECT rejects.

Fixes PR#60439.

Bump PKGREVISION for both gcc15 and gcc15-libs, to adhere to rules in comments,
even though this *should* be a single-arch build fix, since I had to merge
the patch to gcc/config.gcc.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 pkgsrc/lang/gcc15/Makefile \
    pkgsrc/lang/gcc15/distinfo
cvs rdiff -u -r1.6 -r1.7 pkgsrc/lang/gcc15-libs/Makefile
cvs rdiff -u -r1.2 -r1.3 pkgsrc/lang/gcc15/patches/patch-gcc_config.gcc
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_netbsd.h \
    pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_netbsd64.h \
    pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_rs6000-logue.cc \
    pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_rs6000.cc \
    pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_sysv4.h \
    pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_t-netbsd \
    pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_t-netbsd64 \
    pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_t-rs6000

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/lang/gcc15/Makefile
diff -u pkgsrc/lang/gcc15/Makefile:1.6 pkgsrc/lang/gcc15/Makefile:1.7
--- pkgsrc/lang/gcc15/Makefile:1.6      Sun Jul 19 11:17:41 2026
+++ pkgsrc/lang/gcc15/Makefile  Wed Jul 22 19:28:26 2026
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile,v 1.6 2026/07/19 11:17:41 adam Exp $
+# $NetBSD: Makefile,v 1.7 2026/07/22 19:28:26 he Exp $
 
 PKGNAME=       ${GCC_PKGNAME}-${GCC15_DIST_VERSION}
 ## When bumping the PKGREVISION of this package the PKGREVISION of
 ## lang/gcc15-libs needs to be bumped to be at least 1 more than the
 ## PKGREVISION of this package!
+PKGREVISION=   1
 COMMENT=       The GNU Compiler Collection (GCC) - 15.0 Release Series
 
 LANGS=         c
Index: pkgsrc/lang/gcc15/distinfo
diff -u pkgsrc/lang/gcc15/distinfo:1.6 pkgsrc/lang/gcc15/distinfo:1.7
--- pkgsrc/lang/gcc15/distinfo:1.6      Sun Jul 19 11:17:41 2026
+++ pkgsrc/lang/gcc15/distinfo  Wed Jul 22 19:28:26 2026
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.6 2026/07/19 11:17:41 adam Exp $
+$NetBSD: distinfo,v 1.7 2026/07/22 19:28:26 he Exp $
 
 BLAKE2s (gcc-15.3.0.tar.xz) = 4230d4aaa5a4740a3101d5a06478d92d265796df542be1ddd6985be695a3e6ee
 SHA512 (gcc-15.3.0.tar.xz) = 0de9e296153b52c021b1c7e63c9c62151d7a0ac03f23ce6e9f772c1b0eb783f6acdd81cc4567bfe4128a6f64968c2cfc8eff40b36229cba7425349f7d637c654
@@ -27,7 +27,7 @@ SHA1 (patch-gcc_calls.h) = a66a37cdd293e
 SHA1 (patch-gcc_collect2.cc) = 6e6c1797215b36a1e5ffa7989cea1fe1eb2ae834
 SHA1 (patch-gcc_common.opt) = e06b8fc63f1d00ef41a22722397ec599b708243d
 SHA1 (patch-gcc_common_config_aarch64_aarch64-common.cc) = 4150450d2b41b7bad2be188fa3ff43bbc7389371
-SHA1 (patch-gcc_config.gcc) = 490dfef790893f4bef5bf48c35d2cca0f856c6dd
+SHA1 (patch-gcc_config.gcc) = 645f1beaaaf5bd5f30f882986d45ef74bc574e63
 SHA1 (patch-gcc_config.host) = bf95dd21bfdf79d173e745fbd35c9bb99fdf4087
 SHA1 (patch-gcc_config_aarch64_aarch64-builtins.cc) = 1b2e29c1749ab4aacad86422ef44b053d72550c7
 SHA1 (patch-gcc_config_aarch64_aarch64-c.cc) = e9e7e435d256e1e31fb0183716ea5475304f7c9b
@@ -57,6 +57,14 @@ SHA1 (patch-gcc_config_darwin.h) = 0183e
 SHA1 (patch-gcc_config_darwin.opt) = 5f8a8cb8f9cf3b3e4dac68c46d965cd1eda94921
 SHA1 (patch-gcc_config_i386_t-netbsd64) = 914b4d2fd65f5e46681aa2ea592d0bc75299f09a
 SHA1 (patch-gcc_config_netbsd.h) = ada05409eacb33bc1e7a659f3090f2f43551a35d
+SHA1 (patch-gcc_config_rs6000_netbsd.h) = 125d662332457115541a9143d2dc9a7958e0300e
+SHA1 (patch-gcc_config_rs6000_netbsd64.h) = 52c4fc08df72eb78230b6f856c204db0a90009ee
+SHA1 (patch-gcc_config_rs6000_rs6000-logue.cc) = c316d588f578269bbdd3dc068d34c65ddd56e37b
+SHA1 (patch-gcc_config_rs6000_rs6000.cc) = 5b3160df655d90eb4c4ef0f5251d5b1d1d05991d
+SHA1 (patch-gcc_config_rs6000_sysv4.h) = 1cbe846ac436a1a79847b724793e69a94e252177
+SHA1 (patch-gcc_config_rs6000_t-netbsd) = 1c35ae8e1024706ea35522dc81c2350463902dff
+SHA1 (patch-gcc_config_rs6000_t-netbsd64) = 753bcadf91a8be0b1aad234be2062c60b59c5245
+SHA1 (patch-gcc_config_rs6000_t-rs6000) = 206733074016983dc11cb2ad7231b95d4e89010f
 SHA1 (patch-gcc_configure) = 2385e4a226671add690820d1145c76339ba3685b
 SHA1 (patch-gcc_configure.ac) = e60df53f5c3c0c19f68000d893519a60cfdf0bcf
 SHA1 (patch-gcc_cp_decl2.cc) = 5510717ac2fa61f7f238466710af6d762c561365

Index: pkgsrc/lang/gcc15-libs/Makefile
diff -u pkgsrc/lang/gcc15-libs/Makefile:1.6 pkgsrc/lang/gcc15-libs/Makefile:1.7
--- pkgsrc/lang/gcc15-libs/Makefile:1.6 Sun Jul 19 11:17:45 2026
+++ pkgsrc/lang/gcc15-libs/Makefile     Wed Jul 22 19:28:27 2026
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2026/07/19 11:17:45 adam Exp $
+# $NetBSD: Makefile,v 1.7 2026/07/22 19:28:27 he Exp $
 
 GCC_PKGNAME=   gcc15
 .include       "../../lang/${GCC_PKGNAME}/version.mk"
@@ -9,7 +9,7 @@ PKGNAME=        ${GCC_PKGNAME}-libs-${GCC15_DIS
 ## The PKGREVISION of this package needs to be at least 1 more than the
 ## PKGREVISION of the lang/gcc15 package so that with the dependence pattern
 ## '{gcc15,gcc15-libs}>=15.1.*' pkg_add will choose gcc15-libs over gcc15.
-PKGREVISION=   1
+PKGREVISION=   2
 
 CATEGORIES=    lang
 MASTER_SITES=  # empty

Index: pkgsrc/lang/gcc15/patches/patch-gcc_config.gcc
diff -u pkgsrc/lang/gcc15/patches/patch-gcc_config.gcc:1.2 pkgsrc/lang/gcc15/patches/patch-gcc_config.gcc:1.3
--- pkgsrc/lang/gcc15/patches/patch-gcc_config.gcc:1.2  Sun Jul 19 11:17:42 2026
+++ pkgsrc/lang/gcc15/patches/patch-gcc_config.gcc      Wed Jul 22 19:28:26 2026
@@ -1,24 +1,54 @@
-$NetBSD: patch-gcc_config.gcc,v 1.2 2026/07/19 11:17:42 adam Exp $
+$NetBSD: patch-gcc_config.gcc,v 1.3 2026/07/22 19:28:26 he Exp $
 
 Support Darwin/aarch64.
 https://github.com/Homebrew/homebrew-core/blob/main/Patches/gcc/gcc-15.3.0.diff
 
-Enable multilib support on amd64.
+Apply patches to gcc14 from in-tree gcc, which includes important
+changes for NetBSD's powerpc targets.
 
 --- gcc/config.gcc.orig        2026-06-12 06:09:06.107518032 +0000
 +++ gcc/config.gcc
-@@ -1174,13 +1174,22 @@ case ${target} in
+@@ -474,6 +474,16 @@ m32r*-*-*)
+         cpu_type=m32r
+       extra_options="${extra_options} g.opt"
+         ;;
++m5200-*-*|m5407-*-*)
++      cpu_type=m68k
++      extra_headers=math-68881.h
++      extra_options="${extra_options} m68k/m68k-tables.opt"
++      ;;
++m680[012]0-*-*)
++      cpu_type=m68k
++      extra_headers=math-68881.h
++      extra_options="${extra_options} m68k/m68k-tables.opt"
++      ;;
+ m68k-*-*)
+       extra_headers=math-68881.h
+       extra_options="${extra_options} m68k/m68k-tables.opt"
+@@ -982,6 +992,11 @@ case ${target} in
+   case ${enable_threads} in
+     "" | yes | posix) thread_file='posix' ;;
+   esac
++  case ${target} in
++    arm*-* | i[34567]86-* | powerpc*-* | sparc*-* | x86_64-*)
++      default_gnu_indirect_function=yes
++      ;;
++  esac
+   nbsd_tm_file="netbsd.h netbsd-stdint.h netbsd-elf.h"
+   default_use_cxa_atexit=yes
+   target_has_targetdm=yes
+@@ -1174,13 +1189,22 @@ case ${target} in
    ;;
  esac
-
+ 
 -# Figure out if we need to enable heap trampolines by default
 +# Figure out if we need to enable heap trampolines
 +# and variadic functions handling.
  case ${target} in
-+aarch64*-*-darwin2*)
+++aarch64*-*-darwin2*)
 +  # This applies to arm64 Darwin variadic funtions.
 +  tm_defines="$tm_defines STACK_USE_CUMULATIVE_ARGS_INIT=1"
-+  # Executable stack is forbidden.
++  # Executable stack is forbidden.
 +  tm_defines="$tm_defines HEAP_TRAMPOLINES_INIT=1"
 +  ;;
  *-*-darwin2*)
@@ -31,22 +61,244 @@ Enable multilib support on amd64.
    tm_defines="$tm_defines HEAP_TRAMPOLINES_INIT=0"
    ;;
  esac
-@@ -1224,6 +1233,14 @@ aarch64*-*-elf | aarch64*-*-fuchsia* | a
+@@ -1224,6 +1248,14 @@ aarch64*-*-elf | aarch64*-*-fuchsia* | a
        done
        TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
        ;;
 +aarch64-*-darwin* )
-+      tm_file="${tm_file} aarch64/aarch64-errata.h"
-+      tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-darwin"
-+      tm_defines="${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1"
-+      tm_defines="${tm_defines} DISABLE_AARCH64_AS_CRC_BUGFIX=1"
-+      # Choose a default CPU version that will work for all current releases.
-+      with_cpu=${with_cpu:-apple-m1}
-+      ;;
++        tm_file="${tm_file} aarch64/aarch64-errata.h"
++        tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-darwin"
++        tm_defines="${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1"
++        tm_defines="${tm_defines} DISABLE_AARCH64_AS_CRC_BUGFIX=1"
++        # Choose a default CPU version that will work for all current releases.
++        with_cpu=${with_cpu:-apple-m1}
++        ;;
  aarch64*-*-freebsd*)
        tm_file="${tm_file} elfos.h ${fbsd_tm_file}"
        tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-freebsd.h"
-@@ -1992,6 +1992,7 @@
+@@ -1235,6 +1267,11 @@ aarch64*-*-netbsd*)
+       tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-netbsd.h"
+       tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-netbsd"
+       extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++      case $target in
++      aarch64_be-*)
++              tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
++              ;;
++      esac
+       ;;
+ aarch64*-*-linux*)
+       tm_file="${tm_file} elfos.h gnu-user.h linux.h glibc-stdint.h"
+@@ -1411,7 +1448,6 @@ arm*-*-freebsd*)                # ARM Fr
+       with_tls=${with_tls:-gnu}
+       ;;
+ arm*-*-netbsdelf*)
+-      target_cpu_cname="strongarm"
+       tmake_file="${tmake_file} arm/t-arm"
+       tm_file="elfos.h ${nbsd_tm_file} arm/elf.h"
+       extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+@@ -1420,26 +1456,33 @@ arm*-*-netbsdelf*)
+       esac
+       case ${target} in
+       arm*-*-netbsdelf-*eabi*)
+-          tm_file="$tm_file arm/bpabi.h arm/netbsd-elf.h arm/netbsd-eabi.h"
+-          tmake_file="$tmake_file arm/t-bpabi arm/t-netbsdeabi"
++          tm_file="${tm_file} arm/netbsd-elf.h arm/bpabi.h arm/netbsd-eabi.h"
++          # GCC 7 vs NetBSD/eabi -> avoid arm unwinder
++          #tmake_file="$tmake_file arm/t-bpabi"
++          tmake_file="$tmake_file arm/t-netbsdeabi"
++          # The EABI requires the use of __cxa_atexit.
++          default_use_cxa_atexit=yes
+           ;;
+       *)
+-          tm_file="$tm_file arm/netbsd-elf.h"
++          tm_file="$tm_file arm/netbsd-elf.h arm/bpabi.h"
++          #tmake_file="$tmake_file arm/t-bpabi arm/t-netbsdeabi"
+           tmake_file="$tmake_file arm/t-netbsd"
+           ;;
+       esac
+       tm_file="${tm_file} arm/aout.h arm/arm.h"
+       case ${target} in
+       arm*-*-netbsdelf-*eabihf*)
+-          # Hard-float requires at least Arm v5te
+-          target_cpu_cname="arm10e"
+           tm_defines="${tm_defines} TARGET_DEFAULT_FLOAT_ABI=ARM_FLOAT_ABI_HARD"
+           ;;
+       esac
+       case ${target} in
+-      armv6*) target_cpu_cname="arm1176jzf-s";;
+-      armv7*) target_cpu_cname="generic-armv7-a";;
++      armv4*) with_cpu=${with_cpu:-strongarm};;
++      armv6*) with_cpu=${with_cpu:-arm1176jzf-s};;
++      armv7*) with_cpu=${with_cpu:-cortex-a8};;
++      arm*eabihf*) with_cpu=${with_cpu:-arm10e};;
++      arm*) with_cpu=${with_cpu:-arm9e};;
+       esac
++      target_cpu_cname="$with_cpu"
+       ;;
+ arm*-*-linux-* | arm*-*-uclinuxfdpiceabi)
+       tm_file="elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
+@@ -2337,6 +2380,16 @@ ia64*-*-elf*)
+               target_cpu_default="${target_cpu_default}|MASK_GNU_LD"
+       fi
+       ;;
++ia64*-*-netbsd*)
++      tm_file="${tm_file} elfos.h ${nbsd_tm_file} ia64/sysv4.h ia64/netbsd.h"
++      target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
++      tmake_file="${tmake_file} ia64/t-ia64"
++      if test x$with_system_libunwind != xyes ; then
++              tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
++      fi
++      extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
++      extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++      ;;
+ ia64*-*-freebsd*)
+       tm_file="${tm_file} elfos.h ${fbsd_tm_file} ia64/sysv4.h ia64/freebsd.h"
+       target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
+@@ -2433,8 +2486,25 @@ m68k-*-elf* | fido-*-elf*)
+               ;;
+       esac
+       ;;
+-m68k*-*-netbsdelf*)
++m68010-*-netbsdelf* | m68k-*-netbsdelf* | m5407-*-netbsdelf*)
+       default_m68k_cpu=68020
++      case ${target} in
++      m5407*)
++              with_arch=${with_arch:-cf}
++              target_cpu_default="mcf5475"
++#             target="`echo ${target} | sed 's/m68kcf/m68k/'`"
++              ;;
++      m68010*)
++              target_cpu_default="m68010"
++              tmake_file="${tmake_file} m68k/t-m68kelf m68k/t-m68010-netbsd"
++              default_m68k_cpu=68010
++              tmake_file="${tmake_file} m68k/t-floatlib"
++              ;;
++      *)
++              with_arch=${with_arch:-m68k}
++              tmake_file="${tmake_file} m68k/t-floatlib"
++              ;;
++      esac
+       default_cf_cpu=5475
+       tm_file="${tm_file} elfos.h ${nbsd_tm_file} m68k/netbsd-elf.h"
+       extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+@@ -2583,6 +2653,19 @@ riscv*-*-freebsd*)
+       gcc_cv_initfini_array=yes
+       with_tls=${with_tls:-trad}
+       ;;
++riscv*-*-netbsd*)                     # NetBSD RISC-V
++      tm_file="elfos.h ${tm_file} ${nbsd_tm_file} riscv/netbsd.h"
++      tm_defines="${tm_defines} CHAR_FAST8=1 SHORT_FAST16=1"
++      case ${target} in
++        riscv32*) tm_defines="${tm_defines} TARGET_64BIT_DEFAULT=0" ;;
++        *) tmake_file="${tmake_file} riscv/t-netbsd64" ;;
++      esac
++      extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++      tmake_file="${tmake_file} riscv/t-riscv"
++      gnu_ld=yes
++      gas=yes
++      gcc_cv_initfini_array=yes
++      ;;
+ 
+ loongarch*-*-linux*)
+       tm_file="elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file}"
+@@ -2600,6 +2683,21 @@ loongarch*-*-linux*)
+       gcc_cv_initfini_array=yes
+       ;;
+ 
++mipsn64*-*-netbsd*)                   # NetBSD/mips64, either endian.
++      target_cpu_default="MASK_ABICALLS|MASK_FLOAT64|MASK_SOFT_FLOAT_ABI"
++      tm_file="elfos.h ${tm_file} mips/elf.h ${nbsd_tm_file} mips/netbsd.h mips/netbsd64.h"
++      tmake_file="${tmake_file} mips/t-netbsd64"
++      tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_64"
++      extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++      ;;
++mips64*-*-netbsd*)                    # NetBSD/mips64, either endian.
++      target_cpu_default="MASK_ABICALLS|MASK_FLOAT64|MASK_SOFT_FLOAT_ABI"
++      tm_file="elfos.h ${tm_file} mips/elf.h ${nbsd_tm_file} mips/netbsd.h mips/netbsd64.h"
++      tmake_file="${tmake_file} mips/t-netbsd64"
++      tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32"
++      extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++      ;;
++
+ loongarch*-*-elf*)
+       tm_file="elfos.h newlib-stdint.h ${tm_file}"
+       tm_file="${tm_file} loongarch/elf.h loongarch/loongarch-driver.h"
+@@ -3020,11 +3118,24 @@ powerpc*-*-freebsd*)
+               ;;
+       esac
+       ;;
+-powerpc-*-netbsd*)
+-      tm_file="${tm_file} elfos.h gnu-user.h ${nbsd_tm_file} freebsd-spec.h rs6000/sysv4.h rs6000/netbsd.h"
++powerpc*-*-netbsd*)
++      tm_file="${tm_file} elfos.h gnu-user.h ${nbsd_tm_file} freebsd-spec.h"
++      case ${target} in
++          powerpc64*)
++              tm_file="rs6000/biarch64.h ${tm_file}"
++              tm_file="${tm_file} rs6000/sysv4.h rs6000/default64.h rs6000/netbsd64.h"
++              tmake_file="${tmake_file} rs6000/t-netbsd64"
++              ;;
++          *)
++              tm_file="${tm_file} rs6000/sysv4.h rs6000/netbsd.h"
++              tmake_file="${tmake_file} rs6000/t-netbsd"
++              ;;
++      esac
+       extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+-      tmake_file="${tmake_file} rs6000/t-netbsd"
+-      extra_options="${extra_options} rs6000/sysv4.opt"
++      extra_options="${extra_options} rs6000/sysv4.opt rs6000/linux64.opt"
++      if test x${enable_secureplt} != xno; then
++          tm_file="rs6000/secureplt.h ${tm_file}"
++      fi
+       ;;
+ powerpc-*-eabisimaltivec*)
+       tm_file="${tm_file} elfos.h gnu-user.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/eabisim.h rs6000/eabialtivec.h"
+@@ -3529,9 +3640,11 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd*
+ sparc64-*-netbsd*)
+       tm_file="sparc/biarch64.h ${tm_file}"
+       tm_file="${tm_file} elfos.h sparc/sysv4.h ${nbsd_tm_file} sparc/netbsd-elf.h"
++      tm_file="${tm_file} sparc/default64.h"
+       extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+       extra_options="${extra_options} sparc/long-double-switch.opt"
+       tmake_file="${tmake_file} sparc/t-sparc sparc/t-netbsd64"
++      with_cpu=ultrasparc
+       ;;
+ sparc64-*-openbsd*)
+       tm_file="sparc/openbsd1-64.h ${tm_file} elfos.h sparc/sysv4.h sparc/sp64-elf.h"
+@@ -4046,6 +4159,9 @@ if test x$with_cpu = x ; then
+     frv550-*-*linux*)
+       with_cpu=fr550
+       ;;
++    m5200-*-*|m5407-*-*)
++      with_cpu=${default_cf_cpu}
++      ;;
+     m68k*-*-*)
+       case "$with_arch" in
+       "cf")
+@@ -4226,8 +4342,8 @@ fi
+ # Infer a default setting for --with-llsc.
+ if test x$with_llsc = x; then
+   case ${target} in
+-    mips*-*-linux*)
+-      # The kernel emulates LL and SC where necessary.
++    mips*-*-linux* | mips*-*-netbsd* )
++      # Linux and NetBSD kernels emulate LL and SC where necessary.
+       with_llsc=yes
+       ;;
+     mips64r5900-*-* | mips64r5900el-*-* | mipsr5900-*-* | mipsr5900el-*-*)
+@@ -4553,7 +4669,7 @@ case "${target}" in
+               esac
+               ;;
+ 
+-      fido-*-* | m68k*-*-*)
++      fido-*-* | m68k*-*-* | m5200-*-* | m5407-*-*)
+               supported_defaults="arch cpu"
+               case "$with_arch" in
+               "" | "m68k"| "cf")
+$NetBSD: patch-gcc_config.gcc,v 1.3 2026/07/22 19:28:26 he Exp $
+
+--- gcc/config.gcc.orig        2026-07-21 15:12:20.124826917 +0000
++++ gcc/config.gcc
+@@ -2035,6 +2035,7 @@ i[34567]86-*-netbsdelf*)
        ;;
  x86_64-*-netbsd*)
        tm_file="${tm_file} i386/unix.h i386/att.h elfos.h ${nbsd_tm_file} i386/x86-64.h i386/netbsd64.h"

Added files:

Index: pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_netbsd.h
diff -u /dev/null pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_netbsd.h:1.1
--- /dev/null   Wed Jul 22 19:28:27 2026
+++ pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_netbsd.h  Wed Jul 22 19:28:26 2026
@@ -0,0 +1,111 @@
+$NetBSD: patch-gcc_config_rs6000_netbsd.h,v 1.1 2026/07/22 19:28:26 he Exp $
+
+Carry over changes from in-tree gcc in an attempt at
+making this build on NetBSD/powerpc.
+
+In particular this should enable -msecure-plt by default so that
+the compiler produces executables which will run with
+
+   security.pax.mprotect.enabled=1
+
+--- gcc/config/rs6000/netbsd.h.orig    2026-07-17 07:01:21.448909835 +0000
++++ gcc/config/rs6000/netbsd.h
+@@ -19,6 +19,10 @@
+    along with GCC; see the file COPYING3.  If not see
+    <http://www.gnu.org/licenses/>.  */
+ 
++/* NetBSD doesn't support saving and restoring 64-bit regs in a 32-bit
++   process.  */
++#define OS_MISSING_POWERPC64 (!TARGET_64BIT)
++
+ /* Undef gnu-user.h macros we don't want.  */
+ #undef CPLUSPLUS_CPP_SPEC
+ #undef LINK_GCC_C_SEQUENCE_SPEC
+@@ -31,6 +35,12 @@
+       builtin_define ("__powerpc__");         \
+       builtin_assert ("cpu=powerpc");         \
+       builtin_assert ("machine=powerpc");     \
++      if (TARGET_SECURE_PLT)                  \
++        builtin_define ("_SECURE_PLT");               \
++      if (TARGET_SOFT_FLOAT)                  \
++        builtin_define ("_SOFT_FLOAT");               \
++      if (TARGET_ISEL)                                \
++        builtin_define ("__PPC_ISEL__");      \
+     }                                         \
+   while (0)
+ 
+@@ -62,6 +72,29 @@
+ #undef  PTRDIFF_TYPE
+ #define PTRDIFF_TYPE "int"
+ 
++/* Redefine some types that where redefined by rs6000 include files.  */
++
++#undef WCHAR_TYPE
++#define WCHAR_TYPE "int"
++
++#undef WCHAR_TYPE_SIZE
++#define WCHAR_TYPE_SIZE 32
++
++#undef WINT_TYPE
++#define WINT_TYPE "int"
++
++#undef INT64_TYPE
++#define INT64_TYPE "long long int"
++
++#undef UINT64_TYPE
++#define UINT64_TYPE "long long unsigned int"
++
++#undef INTMAX_TYPE
++#define INTMAX_TYPE "long long int"
++
++#undef UINTMAX_TYPE
++#define UINTMAX_TYPE "long long unsigned int"
++
+ /* Undo the spec mess from sysv4.h, and just define the specs
+    the way NetBSD systems actually expect.  */
+ 
+@@ -79,18 +112,39 @@
+ #define STARTFILE_SPEC NETBSD_STARTFILE_SPEC
+ 
+ #undef  ENDFILE_SPEC
+-#define ENDFILE_SPEC "%(netbsd_endfile_spec)"
++#define ENDFILE_SPEC NETBSD_ENDFILE_SPEC
+ 
+ #undef  LIB_SPEC
+ #define LIB_SPEC NETBSD_LIB_SPEC
+ 
+ #undef  SUBTARGET_EXTRA_SPECS
+ #define SUBTARGET_EXTRA_SPECS                                 \
+-  { "netbsd_link_spec",               NETBSD_LINK_SPEC_ELF },         \
+-  { "netbsd_entry_point",     NETBSD_ENTRY_POINT },           \
+-  { "netbsd_endfile_spec",    NETBSD_ENDFILE_SPEC },
++  { "cc1_secure_plt_default",  CC1_SECURE_PLT_DEFAULT_SPEC },   \
++  NETBSD_SUBTARGET_EXTRA_SPECS
+ 
++/*
++ * Add NetBSD specific defaults: -mstrict-align
++ */
++#undef TARGET_DEFAULT
++#define TARGET_DEFAULT (MASK_STRICT_ALIGN)
++
++/*
++ * We know we have the right binutils for this (we shouldn't need to do this
++ * but until the cross build does the right thing...)
++ */
++#undef TARGET_SECURE_PLT
++#define TARGET_SECURE_PLT secure_plt
++#undef HAVE_AS_TLS
++#define HAVE_AS_TLS 1
++#define POWERPC_NETBSD
++
++/* Attempt to enable execute permissions on the stack.  */
++//#define TRANSFER_FROM_TRAMPOLINE NETBSD_ENABLE_EXECUTE_STACK
++// XXXMRG use enable-execute-stack-mprotect.c ?
++#ifdef L_trampoline
++#undef TRAMPOLINE_SIZE
++#define TRAMPOLINE_SIZE 48
++#endif
+ 
+ /* Use standard DWARF numbering for DWARF debugging information.  */
+ #define RS6000_USE_DWARF_NUMBERING
+-
Index: pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_netbsd64.h
diff -u /dev/null pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_netbsd64.h:1.1
--- /dev/null   Wed Jul 22 19:28:27 2026
+++ pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_netbsd64.h        Wed Jul 22 19:28:26 2026
@@ -0,0 +1,541 @@
+$NetBSD: patch-gcc_config_rs6000_netbsd64.h,v 1.1 2026/07/22 19:28:26 he Exp $
+
+Carry over changes from in-tree gcc in an attempt at
+making this build on NetBSD/powerpc.
+
+--- gcc/config/rs6000/netbsd64.h.orig  2026-07-18 05:30:38.502894936 +0000
++++ gcc/config/rs6000/netbsd64.h       2026-07-18 16:48:10.498287125 +0000
+@@ -0,0 +1,533 @@
++/* Definitions of target machine for GNU compiler,
++   for 64 bit PowerPC NetBSD.
++   Copyright (C) 2006-2023 Free Software Foundation, Inc.
++   Contributed by Matthew Green (mrg%eterna.com.au@localhost).
++
++   This file is part of GCC.
++
++   GCC is free software; you can redistribute it and/or modify it
++   under the terms of the GNU General Public License as published
++   by the Free Software Foundation; either version 2, or (at your
++   option) any later version.
++
++   GCC is distributed in the hope that it will be useful, but WITHOUT
++   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
++   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
++   License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with GCC; see the file COPYING.  If not, write to the
++   Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
++   MA 02110-1301, USA.  */
++
++/* Undef gnu-user.h macros we don't want.  */
++#undef CPLUSPLUS_CPP_SPEC
++#undef LINK_GCC_C_SEQUENCE_SPEC
++
++#ifndef RS6000_BI_ARCH
++
++#undef        DEFAULT_ABI
++#define       DEFAULT_ABI ABI_AIX
++
++#undef        TARGET_64BIT
++#define       TARGET_64BIT 1
++
++#define       DEFAULT_ARCH64_P 1
++#define       RS6000_BI_ARCH_P 0
++
++#else
++
++#define       DEFAULT_ARCH64_P (TARGET_DEFAULT & MASK_64BIT)
++#define       RS6000_BI_ARCH_P 1
++
++#endif
++
++#ifdef IN_LIBGCC2
++#undef TARGET_64BIT
++#ifdef __powerpc64__
++#define TARGET_64BIT 1
++#else
++#define TARGET_64BIT 0
++#endif
++#endif
++
++#undef        TARGET_AIX
++#define       TARGET_AIX TARGET_64BIT
++
++#ifdef HAVE_LD_NO_DOT_SYMS
++/* New ABI uses a local sym for the function entry point.  */
++extern int dot_symbols;
++#undef DOT_SYMBOLS
++#define DOT_SYMBOLS dot_symbols
++#endif
++
++#define TARGET_PROFILE_KERNEL profile_kernel
++
++#define TARGET_USES_LINUX64_OPT 1
++#ifdef HAVE_LD_LARGE_TOC
++#undef TARGET_CMODEL
++#define TARGET_CMODEL rs6000_current_cmodel
++#define SET_CMODEL(opt) rs6000_current_cmodel = opt
++#else
++#define SET_CMODEL(opt) do {} while (0)
++#endif
++
++#undef  PROCESSOR_DEFAULT
++#define PROCESSOR_DEFAULT PROCESSOR_POWER4
++#undef  PROCESSOR_DEFAULT64
++#define PROCESSOR_DEFAULT64 PROCESSOR_POWER4
++
++/* We don't need to generate entries in .fixup, except when
++   -mrelocatable or -mrelocatable-lib is given.  */
++#undef RELOCATABLE_NEEDS_FIXUP
++#define RELOCATABLE_NEEDS_FIXUP \
++  (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE)
++
++#undef        RS6000_ABI_NAME
++#define       RS6000_ABI_NAME "netbsd"
++
++#define INVALID_64BIT "-m%s not supported in this configuration"
++#define INVALID_32BIT INVALID_64BIT
++
++#define ELFv2_ABI_CHECK (rs6000_elf_abi == 2)                   
++
++#undef        SUBSUBTARGET_OVERRIDE_OPTIONS
++#define       SUBSUBTARGET_OVERRIDE_OPTIONS                           \
++  do rs6000_linux64_override_options (); while (0)
++
++#undef        ASM_DEFAULT_SPEC
++#undef        ASM_SPEC
++#undef        LINK_OS_NETBSD_SPEC
++#undef        LINK_SECURE_PLT_SPEC
++
++#ifndef       RS6000_BI_ARCH
++#define       ASM_DEFAULT_SPEC "-mppc64"
++#define       ASM_SPEC         "%(asm_spec64) %(asm_spec_common)"
++#define       LINK_OS_NETBSD_SPEC "%(link_os_netbsd_spec64)"
++#define       LINK_SECURE_PLT_SPEC ""
++#else
++#if DEFAULT_ARCH64_P
++#define       ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
++#define       ASM_SPEC         "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
++#define       LINK_OS_NETBSD_SPEC "%{m32:%(link_os_netbsd_spec32)}%{!m32:%(link_os_netbsd_spec64)}"
++#define       LINK_SECURE_PLT_SPEC "%{m32: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
++#else
++#define       ASM_DEFAULT_SPEC "-mppc%{m64:64}"
++#define       ASM_SPEC         "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
++#define       LINK_OS_NETBSD_SPEC "%{!m64:%(link_os_netbsd_spec32)}%{m64:%(link_os_netbsd_spec64)}"
++#define       LINK_SECURE_PLT_SPEC "%{!m64: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
++#endif
++#endif
++
++#define ASM_SPEC32 "-a32 \
++%{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \
++%{memb|msdata=eabi: -memb}"
++
++#define ASM_SPEC64 "-a64"
++
++#define ASM_SPEC_COMMON "%(asm_cpu) \
++%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \
++  ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
++
++#undef        SUBSUBTARGET_EXTRA_SPECS
++#define SUBSUBTARGET_EXTRA_SPECS \
++  { "asm_spec_common",                ASM_SPEC_COMMON },                      \
++  { "asm_spec32",             ASM_SPEC32 },                           \
++  { "asm_spec64",             ASM_SPEC64 },                           \
++  { "link_os_netbsd_spec32",  LINK_OS_NETBSD_SPEC32 },                \
++  { "link_os_netbsd_spec64",  LINK_OS_NETBSD_SPEC64 },
++
++#undef        MULTILIB_DEFAULTS
++#if DEFAULT_ARCH64_P
++#define MULTILIB_DEFAULTS { "m64" }
++#else
++#define MULTILIB_DEFAULTS { "m32" }
++#endif
++
++#ifndef RS6000_BI_ARCH
++
++/* 64-bit PowerPC NetBSD is always big-endian.  */
++#undef        TARGET_LITTLE_ENDIAN
++#define TARGET_LITTLE_ENDIAN  0
++
++/* 64-bit PowerPC NetBSD always has a TOC.  */
++#undef  TARGET_TOC
++#define       TARGET_TOC              1
++
++/* Some things from sysv4.h we don't do when 64 bit.  */
++#undef        TARGET_RELOCATABLE
++#define       TARGET_RELOCATABLE      0
++#undef        TARGET_EABI
++#define       TARGET_EABI             0
++#undef        TARGET_PROTOTYPE
++#define       TARGET_PROTOTYPE        0
++#undef RELOCATABLE_NEEDS_FIXUP
++#define RELOCATABLE_NEEDS_FIXUP 0
++
++#endif
++
++/* We use NetBSD libc _mcount for profiling.  */
++#define NO_PROFILE_COUNTERS 1
++#define PROFILE_HOOK(LABEL) \
++  do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0)
++
++/* PowerPC64 NetBSD word-aligns FP doubles when -malign-power is given.  */
++#undef  ADJUST_FIELD_ALIGN
++#define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \
++  ((TARGET_64BIT                                                      \
++    && TARGET_ALIGN_NATURAL == 0                                      \
++    && TYPE_MODE (strip_array_types (TYPE)) == DFmode)                \
++   ? MIN ((COMPUTED), 32)                                             \
++   : (COMPUTED))
++
++/* PowerPC64 NetBSD increases natural record alignment to doubleword if
++   the first field is an FP double, only if in power alignment mode.  */
++#undef  ROUND_TYPE_ALIGN
++#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)                 \
++  ((TARGET_64BIT                                                      \
++    && (TREE_CODE (STRUCT) == RECORD_TYPE                             \
++      || TREE_CODE (STRUCT) == UNION_TYPE                             \
++      || TREE_CODE (STRUCT) == QUAL_UNION_TYPE)                       \
++    && TARGET_ALIGN_NATURAL == 0)                                     \
++   ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED)    \
++   : MAX ((COMPUTED), (SPECIFIED)))
++
++/* Use the default for compiling target libs.  */
++#ifdef IN_TARGET_LIBS
++#undef TARGET_ALIGN_NATURAL
++#define TARGET_ALIGN_NATURAL 1
++#endif
++
++/* Indicate that jump tables go in the text section.  */
++#undef  JUMP_TABLES_IN_TEXT_SECTION
++#define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT
++
++/* The linux ppc64 ABI isn't explicit on whether aggregates smaller
++   than a doubleword should be padded upward or downward.  You could
++   reasonably assume that they follow the normal rules for structure
++   layout treating the parameter area as any other block of memory,
++   then map the reg param area to registers.  i.e. pad upward.
++   Setting both of the following defines results in this behavior.
++   Setting just the first one will result in aggregates that fit in a
++   doubleword being padded downward, and others being padded upward.
++   Not a bad idea as this results in struct { int x; } being passed
++   the same way as an int.  */
++#define AGGREGATE_PADDING_FIXED TARGET_64BIT
++#define AGGREGATES_PAD_UPWARD_ALWAYS 0
++
++/* Specify padding for the last element of a block move between
++   registers and memory.  FIRST is nonzero if this is the only
++   element.  */
++#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
++  (!(FIRST) ? PAD_UPWARD : targetm.calls.function_arg_padding (MODE, TYPE))
++
++/* NetBSD doesn't support saving and restoring 64-bit regs in a 32-bit
++   process.  */
++#define OS_MISSING_POWERPC64 (!TARGET_64BIT)
++
++#undef  TARGET_OS_CPP_BUILTINS
++#define TARGET_OS_CPP_BUILTINS()                      \
++  do                                                  \
++    {                                                 \
++      NETBSD_OS_CPP_BUILTINS_ELF();                   \
++      builtin_define ("__PPC__");                     \
++      builtin_define ("__ppc__");                     \
++      builtin_define ("__powerpc__");                 \
++      if (TARGET_ISEL)                                        \
++      builtin_define ("__PPC_ISEL__");                \
++      if (TARGET_64BIT)                                       \
++      {                                               \
++        builtin_define ("__arch64__");                \
++        builtin_define ("__PPC64__");                 \
++        builtin_define ("__powerpc64__");             \
++        builtin_assert ("cpu=powerpc64");             \
++        builtin_assert ("machine=powerpc64");         \
++      }                                               \
++      else                                            \
++      {                                               \
++        builtin_define_std ("PPC");                   \
++        builtin_define_std ("powerpc");               \
++        builtin_assert ("cpu=powerpc");               \
++        builtin_assert ("machine=powerpc");           \
++        TARGET_OS_SYSV_CPP_BUILTINS ();               \
++      }                                               \
++    }                                                 \
++  while (0)
++
++/* Override the default from rs6000.h to avoid conflicts with macros
++   defined in NetBSD header files.  */
++
++#undef  RS6000_CPU_CPP_ENDIAN_BUILTINS
++#define RS6000_CPU_CPP_ENDIAN_BUILTINS()      \
++  do                                          \
++    {                                         \
++      builtin_define ("__BIG_ENDIAN__");      \
++      builtin_assert ("machine=bigendian");   \
++    }                                         \
++  while (0)
++
++#undef CC1_OS_NETBSD_SPEC
++#define CC1_OS_NETBSD_SPEC \
++  NETBSD_CC1_AND_CC1PLUS_SPEC \
++  "%{!m32: %{!mrelocatable: %{!fno-pie: %{!fno-pic: \
++     %{!fpie: %{!fpic: \
++       %{!fPIE: %{!fPIC:-fPIC}}}}}}}}"
++/* %{!m32: %{!mcmodel*: -mcmodel=medium}}" */
++
++#undef CC1PLUS_SPEC
++#define CC1PLUS_SPEC CC1_OS_NETBSD_SPEC
++
++#undef  CPP_OS_DEFAULT_SPEC
++#define CPP_OS_DEFAULT_SPEC "%(cpp_os_netbsd)"
++
++#undef  LINK_SHLIB_SPEC
++#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
++
++#undef  LIB_DEFAULT_SPEC
++#define LIB_DEFAULT_SPEC "%(lib_netbsd)"
++
++#undef  STARTFILE_DEFAULT_SPEC
++#define STARTFILE_DEFAULT_SPEC "%(startfile_netbsd)"
++
++#undef        ENDFILE_DEFAULT_SPEC
++#define ENDFILE_DEFAULT_SPEC "%(endfile_netbsd)"
++
++#undef        LINK_START_DEFAULT_SPEC
++#define LINK_START_DEFAULT_SPEC "%(link_start_netbsd)"
++
++#undef        LINK_OS_DEFAULT_SPEC
++#define LINK_OS_DEFAULT_SPEC "%(link_os_netbsd)"
++
++#define LINK_OS_NETBSD_SPEC32 "-m elf32ppc %{!shared: %{!static: \
++  %{rdynamic:-export-dynamic} \
++  %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
++
++#define LINK_OS_NETBSD_SPEC64 "-m elf64ppc %{!shared: %{!static: \
++  %{rdynamic:-export-dynamic} \
++  %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
++
++/* Use standard DWARF numbering for DWARF debugging information.  */
++#define RS6000_USE_DWARF_NUMBERING
++
++#undef  TOC_SECTION_ASM_OP
++#define TOC_SECTION_ASM_OP \
++  (TARGET_64BIT                                               \
++   ? "\t.section\t\".toc\",\"aw\""                    \
++   : "\t.section\t\".got\",\"aw\"")
++
++#undef  MINIMAL_TOC_SECTION_ASM_OP
++#define MINIMAL_TOC_SECTION_ASM_OP \
++  (TARGET_64BIT                                               \
++   ? "\t.section\t\".toc1\",\"aw\""                   \
++   : (flag_pic                                                \
++      ? "\t.section\t\".got2\",\"aw\""                        \
++      : "\t.section\t\".got1\",\"aw\""))
++
++/* This is how to declare the size of a function.  */
++#undef  ASM_DECLARE_FUNCTION_SIZE
++#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)                    \
++  do                                                                    \
++    {                                                                   \
++      if (!flag_inhibit_size_directive)                                 \
++        {                                                               \
++          fputs ("\t.size\t", (FILE));                                  \
++          if (TARGET_64BIT && DOT_SYMBOLS)                              \
++            putc ('.', (FILE));                                         \
++          assemble_name ((FILE), (FNAME));                              \
++          fputs (",.-", (FILE));                                        \
++          rs6000_output_function_entry (FILE, FNAME);                   \
++          putc ('\n', (FILE));                                          \
++        }                                                               \
++    }                                                                   \
++  while (0)
++
++#undef  ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
++#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE)                        \
++  (TARGET_TOC                                                           \
++   && (SYMBOL_REF_P (X)                                                       \
++       || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS      \
++           && SYMBOL_REF_P (XEXP (XEXP (X, 0), 0)))                   \
++       || GET_CODE (X) == LABEL_REF                                     \
++       || (CONST_INT_P (X)                                            \
++           && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))      \
++       || (CONST_DOUBLE_P (X)                                         \
++           && ((TARGET_64BIT                                            \
++                && (TARGET_MINIMAL_TOC                                  \
++                    || (SCALAR_FLOAT_MODE_P (GET_MODE (X))              \
++                        && ! TARGET_NO_FP_IN_TOC)))                     \
++               || (!TARGET_64BIT                                        \
++                   && !TARGET_NO_FP_IN_TOC                              \
++                   && SCALAR_FLOAT_MODE_P (GET_MODE (X))                \
++                   && BITS_PER_WORD == HOST_BITS_PER_INT)))))
++
++/* Make GCC agree with <machine/ansi.h>.  */
++
++#undef        SIZE_TYPE
++#define       SIZE_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
++
++#undef        PTRDIFF_TYPE
++#define       PTRDIFF_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
++
++#undef INTPTR_TYPE
++#define INTPTR_TYPE PTRDIFF_TYPE
++
++#undef UINTPTR_TYPE
++#define UINTPTR_TYPE SIZE_TYPE
++
++#undef        WCHAR_TYPE
++#define       WCHAR_TYPE "int"
++
++#undef INT8_TYPE
++#define INT8_TYPE "signed char"
++
++#undef INT16_TYPE
++#define INT16_TYPE "short int"
++
++#undef INT32_TYPE
++#define INT32_TYPE "int"
++
++#undef INT64_TYPE
++#define       INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
++
++#undef UINT8_TYPE
++#define UINT8_TYPE "unsigned char"
++
++#undef UINT16_TYPE
++#define UINT16_TYPE "short unsigned int"
++
++#undef UINT32_TYPE
++#define UINT32_TYPE "unsigned int"
++
++#undef UINT64_TYPE
++#define       UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
++
++#undef INT_FAST8_TYPE
++#define INT_FAST8_TYPE "int"
++
++#undef INT_FAST16_TYPE
++#define INT_FAST16_TYPE "int"
++
++#undef INT_FAST32_TYPE
++#define INT_FAST32_TYPE "int"
++
++#undef INT_FAST64_TYPE
++#define INT_FAST64_TYPE INT64_TYPE
++
++#undef UINT_FAST8_TYPE
++#define UINT_FAST8_TYPE "unsigned int"
++
++#undef UINT_FAST16_TYPE
++#define UINT_FAST16_TYPE "unsigned int"
++
++#undef UINT_FAST32_TYPE
++#define UINT_FAST32_TYPE "unsigned int"
++
++#undef UINT_FAST8_TYPE
++#define UINT_FAST8_TYPE "unsigned int"
++
++#undef UINT_FAST16_TYPE
++#define UINT_FAST16_TYPE "unsigned int"
++
++#undef UINT_FAST32_TYPE
++#define UINT_FAST32_TYPE "unsigned int"
++
++#undef UINT_FAST64_TYPE
++#define UINT_FAST64_TYPE UINT64_TYPE
++
++#undef INT_LEAST8_TYPE
++#define INT_LEAST8_TYPE INT8_TYPE
++
++#undef INT_LEAST16_TYPE
++#define INT_LEAST16_TYPE INT16_TYPE
++
++#undef INT_LEAST32_TYPE
++#define INT_LEAST32_TYPE "int"
++
++#undef INT_LEAST64_TYPE
++#define INT_LEAST64_TYPE INT64_TYPE
++
++#undef UINT_LEAST8_TYPE
++#define UINT_LEAST8_TYPE UINT8_TYPE
++
++#undef UINT_LEAST16_TYPE
++#define UINT_LEAST16_TYPE UINT16_TYPE
++
++#undef UINT_LEAST32_TYPE
++#define UINT_LEAST32_TYPE "unsigned int"
++
++#undef UINT_LEAST64_TYPE
++#define UINT_LEAST64_TYPE UINT64_TYPE
++
++#undef INTMAX_TYPE
++#define INTMAX_TYPE INT64_TYPE
++
++#undef UINTMAX_TYPE
++#define UINTMAX_TYPE UINT64_TYPE
++
++#if 0
++/* Override rs6000.h definition.  */
++#undef  ASM_APP_ON
++#define ASM_APP_ON "#APP\n"
++
++/* Override rs6000.h definition.  */
++#undef  ASM_APP_OFF
++#define ASM_APP_OFF "#NO_APP\n"
++#endif
++
++#undef  RS6000_MCOUNT
++#define RS6000_MCOUNT "_mcount"
++
++#ifdef __powerpc64__
++/* _init and _fini functions are built from bits spread across many
++   object files, each potentially with a different TOC pointer.  For
++   that reason, place a nop after the call so that the linker can
++   restore the TOC pointer if a TOC adjusting call stub is needed.  */
++#if DOT_SYMBOLS
++#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)    \
++  asm (SECTION_OP "\n"                                        \
++"     bl ." #FUNC "\n"                                \
++"     nop\n"                                          \
++"     .previous");
++#else
++#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)    \
++  asm (SECTION_OP "\n"                                        \
++"     bl " #FUNC "\n"                                 \
++"     nop\n"                                          \
++"     .previous");
++#endif
++#endif
++
++/* FP save and restore routines.  */
++#undef  SAVE_FP_PREFIX
++#define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_")
++#undef  RESTORE_FP_PREFIX
++#define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_")
++
++/* For backward compatibility, we must continue to use the AIX
++   structure return convention.  */
++#undef DRAFT_V4_STRUCT_RET
++#define DRAFT_V4_STRUCT_RET (!TARGET_64BIT)
++
++/* Use --as-needed -lgcc_s for eh support.  */
++#ifdef HAVE_LD_AS_NEEDED
++#define USE_LD_AS_NEEDED 1
++#endif
++
++/*
++ * NetBSD ppc64 used to have 128-bit long double support.
++ * But it does not work anymore:
++ * (insn 23 22 24 5 (set (reg:CCFP 179)
++ *     (compare:CCFP (reg/v:TF 171 [ a ])
++ *                 (reg:TF 177)))
++ *  "/usr/src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixxfti.c":43 -1
++ */
++#undef        RS6000_DEFAULT_LONG_DOUBLE_SIZE
++#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 64
++
++#define POWERPC_NETBSD
++
++/* The IEEE 128-bit emulator is only built on Linux systems.  Flag that we
++   should enable the type handling for KFmode on VSX systems even if we are not
++   enabling the __float128 keyword.  */
++#undef        TARGET_FLOAT128_ENABLE_TYPE
++#define TARGET_FLOAT128_ENABLE_TYPE 1
Index: pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_rs6000-logue.cc
diff -u /dev/null pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_rs6000-logue.cc:1.1
--- /dev/null   Wed Jul 22 19:28:27 2026
+++ pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_rs6000-logue.cc   Wed Jul 22 19:28:26 2026
@@ -0,0 +1,27 @@
+$NetBSD: patch-gcc_config_rs6000_rs6000-logue.cc,v 1.1 2026/07/22 19:28:26 he Exp $
+
+Carry over changes from in-tree gcc in an attempt at
+making this build on NetBSD/powerpc.
+
+--- gcc/config/rs6000/rs6000-logue.cc.orig     13 Sep 2025 23:45:31 -0000      1.1.1.3
++++ gcc/config/rs6000/rs6000-logue.cc  14 Sep 2025 00:07:22 -0000      1.4
+@@ -2263,7 +2263,8 @@
+     }
+   else if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
+     {
+-#if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD)
++#if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD) \
++    && !defined(POWERPC_NETBSD)
+       /* No out-of-line save/restore routines for GPRs on AIX.  */
+       gcc_assert (!TARGET_AIX || (sel & SAVRES_REG) != SAVRES_GPR);
+ #endif
+@@ -2275,7 +2276,8 @@
+                 : ((sel & SAVRES_LR) ? "_restgpr0_" : "_restgpr1_"));
+       else if ((sel & SAVRES_REG) == SAVRES_FPR)
+       {
+-#if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD)
++#if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD) \
++    || defined(POWERPC_NETBSD)
+         if ((sel & SAVRES_LR))
+           prefix = ((sel & SAVRES_SAVE) ? "_savefpr_" : "_restfpr_");
+         else
Index: pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_rs6000.cc
diff -u /dev/null pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_rs6000.cc:1.1
--- /dev/null   Wed Jul 22 19:28:27 2026
+++ pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_rs6000.cc Wed Jul 22 19:28:26 2026
@@ -0,0 +1,28 @@
+$NetBSD: patch-gcc_config_rs6000_rs6000.cc,v 1.1 2026/07/22 19:28:26 he Exp $
+
+Carry over changes from in-tree gcc in an attempt at
+making this build on NetBSD/powerpc.
+
+--- gcc/config/rs6000/rs6000.cc.orig   13 Sep 2025 23:45:31 -0000      1.1.1.4
++++ gcc/config/rs6000/rs6000.cc        14 Sep 2025 00:07:22 -0000      1.5
+@@ -96,7 +96,7 @@
+      of the include files, so that POWERPC_LINUX and POWERPC_FREEBSD are
+      properly defined.  */
+ #ifndef TARGET_IEEEQUAD_DEFAULT
+-#if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD)
++#if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD) && !defined(POWERPC_NETBSD)
+ #define TARGET_IEEEQUAD_DEFAULT 1
+ #else
+ #define TARGET_IEEEQUAD_DEFAULT 0
+@@ -21230,7 +21230,11 @@
+   if (flag_pic)
+     return 3;
+   else if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
++#if defined (POWERPC_NETBSD)
++    return 3;
++#else
+     return 2;
++#endif
+   else
+     return 0;
+ }
Index: pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_sysv4.h
diff -u /dev/null pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_sysv4.h:1.1
--- /dev/null   Wed Jul 22 19:28:27 2026
+++ pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_sysv4.h   Wed Jul 22 19:28:26 2026
@@ -0,0 +1,78 @@
+$NetbSD$
+
+Carry over changes from in-tree gcc in an attempt at
+making this build on NetBSD/powerpc.
+
+--- gcc/config/rs6000/sysv4.h.orig     13 Sep 2025 23:45:31 -0000      1.1.1.15
++++ gcc/config/rs6000/sysv4.h  14 Sep 2025 00:07:22 -0000      1.16
+@@ -92,6 +92,7 @@
+   else if (!strcmp (rs6000_abi_name, "aixdesc"))                      \
+     rs6000_current_abi = ABI_AIX;                                     \
+   else if (!strcmp (rs6000_abi_name, "freebsd")                               \
++         || !strcmp (rs6000_abi_name, "netbsd")                       \
+          || !strcmp (rs6000_abi_name, "linux"))                       \
+     {                                                                 \
+       if (TARGET_64BIT)                                                       \
+@@ -99,8 +100,6 @@
+       else                                                            \
+       rs6000_current_abi = ABI_V4;                                    \
+     }                                                                 \
+-  else if (!strcmp (rs6000_abi_name, "netbsd"))                               \
+-    rs6000_current_abi = ABI_V4;                                      \
+   else if (!strcmp (rs6000_abi_name, "openbsd"))                      \
+     rs6000_current_abi = ABI_V4;                                      \
+   else if (!strcmp (rs6000_abi_name, "i960-old"))                     \
+@@ -576,7 +575,8 @@
+     %{mcall-openbsd: -mno-eabi }}} \
+ %{msdata: -msdata=default} \
+ %{mno-sdata: -msdata=none} \
+-%{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}}" \
++%{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
++%(cc1_os_netbsd)" \
+ GNU_USER_TARGET_CC1_SPEC
+ 
+ /* Default starting address if specified.  */
+@@ -788,28 +788,23 @@
+ #define CPP_OS_LINUX_SPEC "%{pthread:-D_REENTRANT}"
+ 
+ /* NetBSD support.  */
+-#define LIB_NETBSD_SPEC "\
+--lc"
++#define LIB_NETBSD_SPEC NETBSD_LIB_SPEC
+ 
+-#define       STARTFILE_NETBSD_SPEC "\
+-ncrti.o%s crt0.o%s \
+-%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
++#define       STARTFILE_NETBSD_SPEC NETBSD_STARTFILE_SPEC
+ 
+-#define ENDFILE_NETBSD_SPEC "\
+-%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
+-ncrtn.o%s"
++#define ENDFILE_NETBSD_SPEC NETBSD_ENDFILE_SPEC
+ 
+ #define LINK_START_NETBSD_SPEC "\
+ "
+ 
+-#define LINK_OS_NETBSD_SPEC "\
+-%{!shared: %{!static: \
+-  %{rdynamic:-export-dynamic} \
+-  -dynamic-linker /usr/libexec/ld.elf_so}}"
++#define LINK_OS_NETBSD_SPEC NETBSD_LINK_SPEC_ELF
+ 
+ #define CPP_OS_NETBSD_SPEC "\
+ -D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__"
+ 
++#define CC1_OS_NETBSD_SPEC "\
++%{cxx-isystem}"
++
+ /* OpenBSD support.  */
+ #ifndef       LIB_OPENBSD_SPEC
+ #define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
+@@ -892,6 +887,7 @@
+   { "link_os_openbsd",                LINK_OS_OPENBSD_SPEC },                 \
+   { "link_os_default",                LINK_OS_DEFAULT_SPEC },                 \
+   { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC },          \
++  { "cc1_os_netbsd",          CC1_OS_NETBSD_SPEC },                   \
+   { "link_secure_plt",                LINK_SECURE_PLT_SPEC },                 \
+   { "cpp_os_ads",             CPP_OS_ADS_SPEC },                      \
+   { "cpp_os_yellowknife",     CPP_OS_YELLOWKNIFE_SPEC },              \
Index: pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_t-netbsd
diff -u /dev/null pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_t-netbsd:1.1
--- /dev/null   Wed Jul 22 19:28:27 2026
+++ pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_t-netbsd  Wed Jul 22 19:28:27 2026
@@ -0,0 +1,28 @@
+$NetBSD: patch-gcc_config_rs6000_t-netbsd,v 1.1 2026/07/22 19:28:27 he Exp $
+
+Carry over changes from in-tree gcc in an attempt at
+making this build on NetBSD/powerpc.
+
+--- gcc/config/rs6000/t-netbsd.orig    13 Sep 2025 23:45:31 -0000      1.1.1.12
++++ gcc/config/rs6000/t-netbsd 14 Sep 2025 00:07:23 -0000      1.13
+@@ -18,6 +18,10 @@
+ # along with GCC; see the file COPYING3.  If not see
+ # <http://www.gnu.org/licenses/>.
+ 
++# It is important that crtbegin.o, etc., aren't surprised by stuff in .sdata.
++CRTSTUFF_T_CFLAGS += -msdata=none
++CRTSTUFF_T_CFLAGS_S += -msdata=none
++
+ # Switch synonyms
+ MULTILIB_MATCHES_FLOAT        = msoft-float=mcpu?401 \
+                         msoft-float=mcpu?403 \
+@@ -34,3 +38,9 @@
+ MULTILIB_EXCEPTIONS   =
+ 
+ MULTILIB_MATCHES      = ${MULTILIB_MATCHES_FLOAT}
++
++LIBGCC = stmp-multilib
++
++INSTALL_LIBGCC = install-multilib
++EXTRA_MULTILIB_PARTS = crtbegin$(objext) crtend$(objext) \
++  crtbeginS$(objext) crtendS$(objext) crtbeginT$(objext)
Index: pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_t-netbsd64
diff -u /dev/null pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_t-netbsd64:1.1
--- /dev/null   Wed Jul 22 19:28:27 2026
+++ pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_t-netbsd64        Wed Jul 22 19:28:27 2026
@@ -0,0 +1,38 @@
+$NetBSD: patch-gcc_config_rs6000_t-netbsd64,v 1.1 2026/07/22 19:28:27 he Exp $
+
+Carry over changes from in-tree gcc in an attempt at
+making this build on NetBSD/powerpc.
+
+--- gcc/config/rs6000/t-netbsd64.aorig 2026-07-18 05:30:38.502894936 +0000
++++ gcc/config/rs6000/t-netbsd64       2014-08-23 02:17:47.000000000 +0000
+@@ -0,0 +1,30 @@
++# Support for NetBSD PowerPC64 ELF targets (ELF64 ABI).
++
++LIB2FUNCS_EXTRA = $(srcdir)/config/rs6000/tramp.asm \
++      $(srcdir)/config/rs6000/ppc64-fp.c \
++      $(srcdir)/config/rs6000/darwin-ldouble.c
++
++TARGET_LIBGCC2_CFLAGS += -mno-minimal-toc
++
++MULTILIB_OPTIONS        = m64/m32
++MULTILIB_DIRNAMES       = 64 32
++MULTILIB_OSDIRNAMES   = . ../lib/powerpc
++
++MULTILIB_MATCHES        = $(MULTILIB_MATCHES_FLOAT)
++
++# We want fine grained libraries, so use the new code to build the
++# floating point emulation libraries.
++# fp-bit is only to be used by 32-bit multilibs
++FPBIT = fp-bit32.c
++DPBIT = dp-bit32.c
++
++dp-bit32.c: $(srcdir)/config/fp-bit.c
++      ( echo '#ifndef __powerpc64__'; \
++        cat $(srcdir)/config/fp-bit.c; \
++        echo '#endif' ) > dp-bit32.c
++
++fp-bit32.c: $(srcdir)/config/fp-bit.c
++      ( echo '#ifndef __powerpc64__'; \
++        echo '#define FLOAT'; \
++        cat $(srcdir)/config/fp-bit.c; \
++        echo '#endif' ) > fp-bit32.c
Index: pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_t-rs6000
diff -u /dev/null pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_t-rs6000:1.1
--- /dev/null   Wed Jul 22 19:28:27 2026
+++ pkgsrc/lang/gcc15/patches/patch-gcc_config_rs6000_t-rs6000  Wed Jul 22 19:28:27 2026
@@ -0,0 +1,16 @@
+$NetBSD: patch-gcc_config_rs6000_t-rs6000,v 1.1 2026/07/22 19:28:27 he Exp $
+
+Carry over changes from in-tree gcc in an attempt at
+making this build on NetBSD/powerpc.
+
+--- gcc/config/rs6000/t-rs6000.orig    13 Sep 2025 23:45:31 -0000      1.1.1.13
++++ gcc/config/rs6000/t-rs6000 14 Sep 2025 00:07:23 -0000      1.11
+@@ -93,6 +93,8 @@
+ 
+ $(srcdir)/config/rs6000/rs6000-tables.opt: $(srcdir)/config/rs6000/genopt.sh \
+   $(srcdir)/config/rs6000/rs6000-cpus.def
++      @echo "NOT REBUILDING $@"
++NetBSD_DISABLED_rs6000-tables.opt:
+       $(SHELL) $(srcdir)/config/rs6000/genopt.sh $(srcdir)/config/rs6000 > \
+               $(srcdir)/config/rs6000/rs6000-tables.opt
+ 



Home | Main Index | Thread Index | Old Index