head 1.4; access; symbols pkgsrc-2026Q2:1.3.0.6 pkgsrc-2026Q2-base:1.3 pkgsrc-2026Q1:1.3.0.4 pkgsrc-2026Q1-base:1.3 pkgsrc-2025Q4:1.3.0.2 pkgsrc-2025Q4-base:1.3 pkgsrc-2025Q3:1.2.0.4 pkgsrc-2025Q3-base:1.2 pkgsrc-2025Q2:1.2.0.2 pkgsrc-2025Q2-base:1.2 pkgsrc-2025Q1:1.1.0.2 pkgsrc-2025Q1-base:1.1; locks; strict; comment @# @; 1.4 date 2026.07.20.08.02.51; author he; state Exp; branches; next 1.3; commitid T3qBoQLspnpMLmOG; 1.3 date 2025.10.12.21.44.57; author mrg; state Exp; branches; next 1.2; commitid tIWgIYeBMkvdmkeG; 1.2 date 2025.06.08.07.37.45; author wiz; state Exp; branches; next 1.1; commitid I3jr5qsuFSfII3YF; 1.1 date 2025.02.05.16.30.35; author adam; state Exp; branches; next ; commitid hLANQ79vzS0ICiIF; desc @@ 1.4 log @lang/gcc14: 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. Ref. the entries for .plt and .got sections in "readelf -a". Fixes PR#60439. Bump PKGREVISION for both gcc14 and gcc14-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$ Pull over change between gcc 14.3.0 and what's in-tree in -current. Also, preserve Homebrew patches to let GCC 14 build on macOS and other platforms. --- gcc/config.gcc.orig 13 Sep 2025 23:45:20 -0000 1.1.1.22 +++ gcc/config.gcc 22 Nov 2025 04:45:12 -0000 1.77 @@@@ -469,6 +469,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" @@@@ -981,6 +991,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 @@@@ -1177,13 +1192,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 @@@@ -1227,6 +1251,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" @@@@ -1238,6 +1270,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" @@@@ -1385,7 +1422,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" @@@@ -1394,26 +1430,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" @@@@ -1965,6 +2008,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*) @@@@ -2301,6 +2345,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" @@@@ -2397,8 +2451,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" @@@@ -2547,6 +2618,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}" @@@@ -2564,6 +2648,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/linux.h loongarch/loongarch-driver.h" @@@@ -3001,11 +3100,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" @@@@ -3510,9 +3622,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" @@@@ -4019,6 +4133,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") @@@@ -4199,8 +4316,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-*-*) @@@@ -4526,7 +4643,7 @@@@ case "${target}" in esac ;; - fido-*-* | m68k*-*-*) + fido-*-* | m68k*-*-* | m5200-*-* | m5407-*-*) supported_defaults="arch cpu" case "$with_arch" in "" | "m68k"| "cf") @ 1.3 log @add arm64eb support: a config snippet, and a gcc14 specific fix. @ text @d1 1 a1 1 $NetBSD: patch-gcc_config.gcc,v 1.2 2025/06/08 07:37:45 wiz Exp $ d3 1 a3 2 Support Darwin/aarch64, from https://github.com/Homebrew/formula-patches. Support NetBSD/aarch64eb. d5 35 a39 3 --- gcc/config.gcc.orig 2025-05-23 04:02:04.272197204 -0700 +++ gcc/config.gcc 2025-10-12 14:28:13.767650187 -0700 @@@@ -1177,13 +1177,22 @@@@ case ${target} in d50 1 a50 1 + # Executable stack is forbidden. d63 1 a63 1 @@@@ -1227,6 +1236,14 @@@@ aarch64*-*-elf | aarch64*-*-fuchsia* | a d68 7 a74 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} + ;; d78 1 a78 1 @@@@ -1238,6 +1255,11 @@@@ aarch64*-*-netbsd*) d90 214 @ 1.2 log @*gcc14*: update to 14.3 bugfix release. @ text @d1 1 a1 1 $NetBSD: patch-gcc_config.gcc,v 1.1 2025/02/05 16:30:35 adam Exp $ d4 1 d6 2 a7 2 --- gcc/config.gcc.orig 2025-05-23 11:02:04.272197204 +0000 +++ gcc/config.gcc d47 12 @ 1.1 log @gcc14: incorporate Homebrew patches to let GCC 14 build on macOS and other platforms @ text @d1 1 a1 1 $NetBSD$ d5 1 a5 1 --- gcc/config.gcc d10 1 a10 1 d31 1 a31 1 @@@@ -1227,6 +1236,14 @@@@ aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*) @