head 1.3; access; symbols pkgsrc-2026Q2:1.1.0.8 pkgsrc-2026Q2-base:1.1 pkgsrc-2026Q1:1.1.0.6 pkgsrc-2026Q1-base:1.1 pkgsrc-2025Q4:1.1.0.4 pkgsrc-2025Q4-base:1.1 pkgsrc-2025Q3:1.1.0.2 pkgsrc-2025Q3-base:1.1; locks; strict; comment @# @; 1.3 date 2026.07.22.19.28.26; author he; state Exp; branches; next 1.2; commitid 0u5lNjmDZTsRtGOG; 1.2 date 2026.07.19.11.17.42; author adam; state Exp; branches; next 1.1; commitid FhXjPkGd9j9WSfOG; 1.1 date 2025.08.04.02.48.24; author mrg; state Exp; branches; next ; commitid gmuPaxnEJmuJhm5G; desc @@ 1.3 log @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. @ text @$NetBSD: patch-gcc_config.gcc,v 1.2 2026/07/19 11:17:42 adam Exp $ Support Darwin/aarch64. https://github.com/Homebrew/homebrew-core/blob/main/Patches/gcc/gcc-15.3.0.diff 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 @@@@ -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*) + # This applies to arm64 Darwin variadic funtions. + tm_defines="$tm_defines STACK_USE_CUMULATIVE_ARGS_INIT=1" + # Executable stack is forbidden. + tm_defines="$tm_defines HEAP_TRAMPOLINES_INIT=1" + ;; *-*-darwin2*) + tm_defines="$tm_defines STACK_USE_CUMULATIVE_ARGS_INIT=0" # Currently, we do this for macOS 11 and above. tm_defines="$tm_defines HEAP_TRAMPOLINES_INIT=1" ;; *) + tm_defines="$tm_defines STACK_USE_CUMULATIVE_ARGS_INIT=0" tm_defines="$tm_defines HEAP_TRAMPOLINES_INIT=0" ;; esac @@@@ -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} + ;; 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" @@@@ -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$ --- 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" + tmake_file="${tmake_file} i386/t-netbsd64" extra_options="${extra_options} netbsd.opt netbsd-elf.opt" ;; i[34567]86-*-openbsd*) @ 1.2 log @gcc15: updated to 15.3 15.3 This release is a bug-fix release, containing fixes for regressions in GCC 15.2 relative to previous releases of GCC. PkgSrc: Allow building on Darwin/aarch64. @ text @d1 1 a1 1 $NetBSD$ d6 2 a7 1 Enable multilib support on amd64. d11 30 a40 1 @@@@ -1174,13 +1174,22 @@@@ case ${target} in d43 1 a43 1 d48 1 a48 1 +aarch64*-*-darwin2*) d51 1 a51 1 + # Executable stack is forbidden. d64 1 a64 1 @@@@ -1224,6 +1233,14 @@@@ aarch64*-*-elf | aarch64*-*-fuchsia* | a d69 7 a75 7 + 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} + ;; d79 223 a301 1 @@@@ -1992,6 +1992,7 @@@@ @ 1.1 log @enable "gcc -m32" support on amd64. this can probably be ported to many prior GCC versions. @ text @d3 3 d8 41 a48 2 --- gcc/config.gcc.orig 2025-04-25 01:18:00.000000000 -0700 +++ gcc/config.gcc 2025-08-03 17:22:06.592442114 -0700 @