? work
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/lang/gcc7/Makefile,v
retrieving revision 1.16
diff -u -r1.16 Makefile
--- Makefile 28 Jan 2018 16:24:14 -0000 1.16
+++ Makefile 15 Jun 2018 19:42:12 -0000
@@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.16 2018/01/28 16:24:14 wiz Exp $
GCC_PKGNAME= gcc7
-PKGREVISION= 1
+PKGREVISION= 2
.include "version.mk"
DISTNAME= gcc-${GCC7_DIST_VERSION}
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/lang/gcc7/distinfo,v
retrieving revision 1.8
diff -u -r1.8 distinfo
--- distinfo 25 Jan 2018 23:27:30 -0000 1.8
+++ distinfo 15 Jun 2018 19:42:12 -0000
@@ -10,14 +10,18 @@
Size (isl-0.16.1.tar.bz2) = 1626446 bytes
SHA1 (patch-contrib_download__prerequisites) = 86c6c16e0e3e3a0bcb38579a8b4004f603fac1ca
SHA1 (patch-gcc_Makefile.in) = c0f97c75ba1d37eae894141edd58bb36b734f651
-SHA1 (patch-gcc_config.gcc) = 943797cbbdbf25885b4f16a1a027d137ef68357e
+SHA1 (patch-gcc_config.gcc) = 7223b043e6a669d389c20b477ca2ad0195d5a9fc
SHA1 (patch-gcc_config_arm_arm.h) = 92c8bff1063e153fec4454e6dea5334a42b0dad6
-SHA1 (patch-gcc_config_netbsd-protos.h) = 6d28864b4ccc8c1a63fe28e43601b84b63a00633
+SHA1 (patch-gcc_config_arm_netbsd-eabi.h) = 9c1d2148e306024e8de3bdc9802fb63b976e0e7a
+SHA1 (patch-gcc_config_arm_netbsd-elf.h) = 80a07645fab197969b4a6f518fdc81bda7376375
+SHA1 (patch-gcc_config_netbsd-elf.h) = 5a9b5ef26c03bec3cd58e2f446224aa6e94a30d5
+SHA1 (patch-gcc_config_netbsd-protos.h) = a02cc783125fe9ab9a7f97b76483c5cee3c16c3b
SHA1 (patch-gcc_config_netbsd.h) = 8861abb345b3ad72574fbe7afca2ea78b81d9632
-SHA1 (patch-gcc_config_t-netbsd) = 802ad5706aa7ca9629f8e237f08fbb1569d28846
+SHA1 (patch-gcc_config_t-netbsd) = 4e7221b01b7614fd5ca8bac21bf6de952a0e366b
SHA1 (patch-gcc_config_x-netbsd) = 6dc3d78e26df62054ea29f98ca51592858e671e3
SHA1 (patch-gcc_configure) = 15fb7af267b79965f83bc64ce8aad1279b0ea52d
SHA1 (patch-gcc_ggc-common.c) = a5d2dba635859f5d680c3f80d7c30b42461c752b
+SHA1 (patch-gcc_ginclude_stddef.h) = 583b7931aad14058be75569b0138efad8ac74113
SHA1 (patch-gcc_lto_lto.c) = 825b632e2a7ff5777d4fbfdcf6f0ea3f64c4742b
SHA1 (patch-gcc_system.h) = 4c959a6b1c4d524cbdf44cfb80f0e5758ec20783
SHA1 (patch-isl_configure) = 36b37778ee13c0b364fb24d5864d6a9e65b29b7d
@@ -26,6 +30,9 @@
SHA1 (patch-libdecnumber_decNumber.c) = cec90e49c829bfc6ba1ec605d2fac7daaad62762
SHA1 (patch-libffi_configure) = bcfbfe8abddc378e2de4a39ad0669583b37e0292
SHA1 (patch-libffi_testsuite_libffi.call_float2.c) = 6321dde308579448c27c2b6e1e30633699dd145f
+SHA1 (patch-libgcc_config.host) = 1c2ebce3a44d935e9bbab30952b51b6f3716e47e
+SHA1 (patch-libgcc_config_arm_t-netbsd) = fe986b09ccbfc253aaaca263e8e38f06da4891cc
+SHA1 (patch-libgcc_config_arm_t-netbsd-eabi) = 1e818e92fe79f57d305ff42ce3449dddf87c3179
SHA1 (patch-libgcc_config_i386_cpuinfo.h) = d217e3c65178c96c7314cb88c740b9586d4e8fed
SHA1 (patch-libgcc_crtstuff.c) = e3a3b02a26229992851f195b5701cb1b86c29efe
SHA1 (patch-libgfortran_configure) = 869a60fd08edecf18a42732dcbf226bad1309394
Index: patches/patch-gcc_config.gcc
===================================================================
RCS file: /cvsroot/pkgsrc/lang/gcc7/patches/patch-gcc_config.gcc,v
retrieving revision 1.2
diff -u -r1.2 patch-gcc_config.gcc
--- patches/patch-gcc_config.gcc 25 Jan 2018 23:27:30 -0000 1.2
+++ patches/patch-gcc_config.gcc 15 Jun 2018 19:42:13 -0000
@@ -1,10 +1,14 @@
$NetBSD: patch-gcc_config.gcc,v 1.2 2018/01/25 23:27:30 maya Exp $
Workaround netbsd's compatibility non-C99 cabs (causes gfortran link failures)
+netbsd/arm eabi support
+
+use nbsd_tm_file to make sure every netbsd target gets netbsd-stdint.h
+(upstreamed)
--- gcc/config.gcc.orig 2018-01-08 13:39:11.000000000 +0000
+++ gcc/config.gcc
-@@ -781,6 +781,10 @@ case ${target} in
+@@ -781,7 +781,12 @@ case ${target} in
gas=yes
gnu_ld=yes
use_gcc_stdint=wrap
@@ -13,18 +17,119 @@
+ target_gtfiles="${target_gtfiles} \$(srcdir)/config/netbsd.c"
+ extra_objs="${extra_objs} netbsd.o"
++ nbsd_tm_file="netbsd.h netbsd-stdint.h netbsd-elf.h"
# NetBSD 2.0 and later get POSIX threads enabled by default.
# Allow them to be explicitly enabled on any other version.
-@@ -1487,10 +1491,12 @@ x86_64-*-freebsd*)
+ case ${enable_threads} in
+@@ -1001,7 +1006,7 @@ alpha*-*-freebsd*)
+ extra_options="${extra_options} alpha/elf.opt"
+ ;;
+ alpha*-*-netbsd*)
+- tm_file="elfos.h ${tm_file} netbsd.h alpha/elf.h netbsd-elf.h alpha/netbsd.h"
++ tm_file="elfos.h ${tm_file} ${nbsd_tm_file} alpha/elf.h alpha/netbsd.h"
+ tmake_file="${tmake_file} alpha/t-alpha"
+ extra_options="${extra_options} netbsd.opt netbsd-elf.opt \
+ alpha/elf.opt"
+@@ -1092,10 +1097,37 @@ arm*-*-freebsd*) # ARM Fr
+ with_tls=${with_tls:-gnu}
+ ;;
+ arm*-*-netbsdelf*)
+- tm_file="dbxelf.h elfos.h netbsd.h netbsd-elf.h arm/elf.h arm/aout.h ${tm_file} arm/netbsd-elf.h"
+- extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+ tmake_file="${tmake_file} arm/t-arm"
+- target_cpu_cname="arm6"
++ tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h"
++ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++ case ${target} in
++ arm*eb-*) tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" ;;
++ 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"
++ # The BPABI long long divmod functions return a 128-bit value in
++ # registers r0-r3. Correctly modeling that requires the use of
++ # TImode.
++ need_64bit_hwint=yes
++ ;;
++ *)
++ tm_file="$tm_file arm/netbsd-elf.h"
++ tmake_file="$tmake_file arm/t-netbsd"
++ ;;
++ esac
++ tm_file="${tm_file} arm/aout.h arm/arm.h"
++ case ${target} in
++ arm*-*-netbsdelf-*eabihf*)
++ tm_defines="${tm_defines} TARGET_DEFAULT_FLOAT_ABI=ARM_FLOAT_ABI_HARD"
++ ;;
++ esac
++ case ${target} in
++ armv4*) target_cpu_cname="strongarm";;
++ armv6*) target_cpu_cname="arm1176jzf-s";;
++ armv7*) target_cpu_cname="cortex-a8";;
++ esac
+ ;;
+ arm*-*-linux-*) # ARM GNU/Linux with ELF
+ tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
+@@ -1485,12 +1517,14 @@ x86_64-*-freebsd*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h"
+ ;;
i[34567]86-*-netbsdelf*)
- tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-stdint.h netbsd-elf.h i386/netbsd-elf.h"
+- tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-stdint.h netbsd-elf.h i386/netbsd-elf.h"
++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${nbsd_tm_file} i386/netbsd-elf.h"
extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+ tmake_file="${tmake_file} i386/t-crtstuff"
;;
x86_64-*-netbsd*)
- tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-stdint.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h"
+- tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-stdint.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h"
++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h ${nbsd_tm_file} i386/x86-64.h i386/netbsd64.h"
extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+ tmake_file="${tmake_file} i386/t-crtstuff"
;;
i[34567]86-*-openbsd*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h"
+@@ -2381,7 +2415,7 @@ powerpc*-*-freebsd*)
+ esac
+ ;;
+ powerpc-*-netbsd*)
+- tm_file="${tm_file} dbxelf.h elfos.h netbsd.h netbsd-elf.h freebsd-spec.h rs6000/sysv4.h rs6000/netbsd.h"
++ tm_file="${tm_file} dbxelf.h elfos.h ${nbsd_tm_file} freebsd-spec.h rs6000/sysv4.h rs6000/netbsd.h"
+ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+ tmake_file="${tmake_file} rs6000/t-netbsd"
+ extra_options="${extra_options} rs6000/sysv4.opt"
+@@ -2700,7 +2734,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
+ fi
+ tm_file="${tm_file} gnu-user.h linux.h glibc-stdint.h sh/linux.h" ;;
+ sh*-*-netbsd*)
+- tm_file="${tm_file} netbsd.h netbsd-elf.h sh/netbsd-elf.h"
++ tm_file="${tm_file} ${nbsd_tm_file} sh/netbsd-elf.h"
+ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+
+ ;;
+@@ -2860,7 +2894,7 @@ sparc-*-linux*)
+ fi
+ ;;
+ sparc-*-netbsdelf*)
+- tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h netbsd.h netbsd-elf.h sparc/netbsd-elf.h"
++ tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h ${nbsd_tm_file} sparc/netbsd-elf.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"
+@@ -2908,7 +2942,7 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd*
+ ;;
+ sparc64-*-netbsd*)
+ tm_file="sparc/biarch64.h ${tm_file}"
+- tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h netbsd.h netbsd-elf.h sparc/netbsd-elf.h"
++ tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h ${nbsd_tm_file} sparc/netbsd-elf.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"
+@@ -3012,7 +3046,7 @@ vax-*-linux*)
+ extra_options="${extra_options} vax/elf.opt"
+ ;;
+ vax-*-netbsdelf*)
+- tm_file="${tm_file} elfos.h netbsd.h netbsd-elf.h vax/elf.h vax/netbsd-elf.h"
++ tm_file="${tm_file} elfos.h ${nbsd_tm_file} vax/elf.h vax/netbsd-elf.h"
+ extra_options="${extra_options} netbsd.opt netbsd-elf.opt vax/elf.opt"
+ ;;
+ vax-*-openbsd*)
Index: patches/patch-gcc_config_arm_netbsd-eabi.h
===================================================================
RCS file: patches/patch-gcc_config_arm_netbsd-eabi.h
diff -N patches/patch-gcc_config_arm_netbsd-eabi.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-gcc_config_arm_netbsd-eabi.h 15 Jun 2018 19:42:13 -0000
@@ -0,0 +1,119 @@
+$NetBSD$
+
+netbsd/arm EABI support
+
+--- gcc/config/arm/netbsd-eabi.h.orig 2018-02-02 18:49:57.566284082 +0000
++++ gcc/config/arm/netbsd-eabi.h
+@@ -0,0 +1,112 @@
++/* Definitions of target machine for GNU compiler, NetBSD/arm ELF version.
++ Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
++ Contributed by Wasabi Systems, Inc.
++
++ 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 3, 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 COPYING3. If not see
++ . */
++
++/* Run-time Target Specification. */
++#undef MULTILIB_DEFAULTS
++#define MULTILIB_DEFAULTS { "mabi=aapcs-linux" }
++
++#define TARGET_LINKER_EABI_SUFFIX \
++ (TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_SOFT \
++ ? "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=hard:_eabihf;:_eabi}}}" \
++ : "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=soft:_eabi;:_eabihf}}}")
++#define TARGET_LINKER_BIG_EMULATION "armelfb_nbsd%(linker_eabi_suffix)"
++#define TARGET_LINKER_LITTLE_EMULATION "armelf_nbsd%(linker_eabi_suffix)"
++
++/* TARGET_BIG_ENDIAN_DEFAULT is set in
++ config.gcc for big endian configurations. */
++#undef TARGET_LINKER_EMULATION
++#if TARGET_BIG_ENDIAN_DEFAULT
++#define TARGET_LINKER_EMULATION TARGET_LINKER_BIG_EMULATION
++#undef BE8_LINK_SPEC
++#define BE8_LINK_SPEC " %{!mlittle-endian:%{march=armv7-a|mcpu=cortex-a5|mcpu=cortex-a8|mcpu=cortex-a9:%{!r:--be8}}}"
++#else
++#define TARGET_LINKER_EMULATION TARGET_LINKER_LITTLE_EMULATION
++#endif
++
++#undef ARM_DEFAULT_ABI
++#define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX
++
++#undef ARM_EABI_UNWIND_TABLES
++#define ARM_EABI_UNWIND_TABLES 0
++#undef ARM_UNWIND_INFO
++#define ARM_UNWIND_INFO 0
++#undef ARM_DWARF_UNWIND_TABLES
++#define ARM_DWARF_UNWIND_TABLES 1
++
++#undef TARGET_OS_CPP_BUILTINS
++#define TARGET_OS_CPP_BUILTINS() \
++ do \
++ { \
++ if (TARGET_AAPCS_BASED) \
++ TARGET_BPABI_CPP_BUILTINS(); \
++ NETBSD_OS_CPP_BUILTINS_ELF(); \
++ if (ARM_DWARF_UNWIND_TABLES) \
++ builtin_define ("__ARM_DWARF_EH__"); \
++ if (ARM_EABI_UNWIND_TABLES) \
++ builtin_define ("__UNWIND_TABLES__"); \
++ } \
++ while (0)
++
++#undef SUBTARGET_CPP_SPEC
++#define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
++
++/*
++ * Override AAPCS types to remain compatible the existing NetBSD types.
++ */
++#undef WCHAR_TYPE
++#define WCHAR_TYPE "int"
++
++#undef SIZE_TYPE
++#define SIZE_TYPE "long unsigned int"
++
++#undef PTRDIFF_TYPE
++#define PTRDIFF_TYPE "long int"
++
++#undef SUBTARGET_EXTRA_ASM_SPEC
++#define SUBTARGET_EXTRA_ASM_SPEC \
++ "-matpcs %{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu} %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
++
++/* Default to full VFP if -mhard-float is specified. */
++#undef SUBTARGET_ASM_FLOAT_SPEC
++#define SUBTARGET_ASM_FLOAT_SPEC \
++ "%{mhard-float:%{!mfpu=*:-mfpu=vfp}} \
++ %{mfloat-abi=hard:%{!mfpu=*:-mfpu=vfp}}"
++
++#undef SUBTARGET_EXTRA_SPECS
++#define SUBTARGET_EXTRA_SPECS \
++ { "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC }, \
++ { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
++ { "linker_eabi_suffix", TARGET_LINKER_EABI_SUFFIX }, \
++ { "linker_emulation", TARGET_LINKER_EMULATION }, \
++ { "linker_big_emulation", TARGET_LINKER_BIG_EMULATION }, \
++ { "linker_little_emulation", TARGET_LINKER_LITTLE_EMULATION }, \
++ { "be8_link_spec", BE8_LINK_SPEC }, \
++ { "target_fix_v4bx_spec", TARGET_FIX_V4BX_SPEC }, \
++ NETBSD_SUBTARGET_EXTRA_SPECS
++
++#define NETBSD_ENTRY_POINT "__start"
++
++#undef LINK_SPEC
++#define LINK_SPEC \
++ "-X %{mbig-endian:-EB -m %(linker_big_emulation)} \
++ %{mlittle-endian:-EL -m %(linker_liitle_emulation)} \
++ %{!mbig-endian:%{!mlittle-endian:-m %(linker_emulation)}} \
++ %(be8_link_spec) %(target_fix_v4bx_spec) \
++ %(netbsd_link_spec)"
Index: patches/patch-gcc_config_arm_netbsd-elf.h
===================================================================
RCS file: patches/patch-gcc_config_arm_netbsd-elf.h
diff -N patches/patch-gcc_config_arm_netbsd-elf.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-gcc_config_arm_netbsd-elf.h 15 Jun 2018 19:42:13 -0000
@@ -0,0 +1,96 @@
+$NetBSD$
+
+netbsd/arm EABI support
+
+--- gcc/config/arm/netbsd-elf.h.orig 2017-01-01 12:07:43.000000000 +0000
++++ gcc/config/arm/netbsd-elf.h
+@@ -27,9 +27,20 @@
+
+ /* arm.h defaults to ARM6 CPU. */
+
+-/* This defaults us to little-endian. */
+-#ifndef TARGET_ENDIAN_DEFAULT
+-#define TARGET_ENDIAN_DEFAULT 0
++/* Default EABI to armv5t so that thumb shared libraries work.
++ The ARM926EH-S core is the default for armv5te, so set
++ SUBTARGET_CPU_DEFAULT to achieve this. */
++
++#define SUBTARGET_CPU_DEFAULT \
++ (ARM_DEFAULT_ABI != ARM_ABI_APCS && ARM_DEFAULT_ABI != ARM_ABI_ATPCS \
++ ? TARGET_CPU_arm926ejs : TARGET_CPU_arm6)
++
++/* TARGET_BIG_ENDIAN_DEFAULT is set in
++ config.gcc for big endian configurations. */
++#if TARGET_BIG_ENDIAN_DEFAULT
++#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
++#else
++#define TARGET_ENDIAN_DEFAULT 0
+ #endif
+
+ #undef MULTILIB_DEFAULTS
+@@ -43,6 +54,7 @@
+ #undef ARM_DEFAULT_ABI
+ #define ARM_DEFAULT_ABI ARM_ABI_ATPCS
+
++#undef TARGET_OS_CPP_BUILTINS
+ #define TARGET_OS_CPP_BUILTINS() \
+ do \
+ { \
+@@ -55,25 +67,21 @@
+
+ #undef SUBTARGET_EXTRA_ASM_SPEC
+ #define SUBTARGET_EXTRA_ASM_SPEC \
+- "-matpcs %{" FPIE_OR_FPIC_SPEC ":-k}"
++ "-matpcs %{mabi=aapcs*:-meabi=5} %{" FPIE_OR_FPIC_SPEC ":-k}"
+
+ /* Default to full VFP if -mfloat-abi=hard is specified. */
+ #undef SUBTARGET_ASM_FLOAT_SPEC
+ #define SUBTARGET_ASM_FLOAT_SPEC \
+- "%{mfloat-abi=hard:{!mfpu=*:-mfpu=vfp}}"
+-
+-#undef SUBTARGET_EXTRA_SPECS
+-#define SUBTARGET_EXTRA_SPECS \
+- { "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC }, \
+- { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
+- { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
+- { "netbsd_entry_point", NETBSD_ENTRY_POINT },
++ "%{mhard-float:%{!mfpu=*:-mfpu=vfp}} \
++ %{mfloat-abi=hard:%{!mfpu=*:-mfpu=vfp}}"
+
+ #define NETBSD_ENTRY_POINT "__start"
+
+ #undef LINK_SPEC
+ #define LINK_SPEC \
+- "-X %{mbig-endian:-EB} %{mlittle-endian:-EL} \
++ "-X \
++ %{mbig-endian:-EB %{-mabi=aapcs*:-m armelfb_nbsd_eabi}} \
++ %{mlittle-endian:-EL %{-mabi=aapcs*:-m armelf_nbsd_eabi}} \
+ %(netbsd_link_spec)"
+
+ /* Make GCC agree with . */
+@@ -84,6 +92,12 @@
+ #undef PTRDIFF_TYPE
+ #define PTRDIFF_TYPE "long int"
+
++#undef INTPTR_TYPE
++#define INTPTR_TYPE PTRDIFF_TYPE
++
++#undef UINTPTR_TYPE
++#define UINTPTR_TYPE SIZE_TYPE
++
+ /* We don't have any limit on the length as out debugger is GDB. */
+ #undef DBX_CONTIN_LENGTH
+
+@@ -157,3 +171,12 @@ while (0)
+ #undef FPUTYPE_DEFAULT
+ #define FPUTYPE_DEFAULT "vfp"
+
++/* Ensure that libgcc does not attempt to define __[CD]TOR_LIST__[] for APCS,
++ which belongs in crtbegin on NetBSD. */
++#ifndef __ARM_EABI__
++#define CTOR_LISTS_DEFINED_EXTERNALLY
++#endif
++
++#undef FPUTYPE_DEFAULT
++#define FPUTYPE_DEFAULT "vfp"
++
Index: patches/patch-gcc_config_netbsd-elf.h
===================================================================
RCS file: patches/patch-gcc_config_netbsd-elf.h
diff -N patches/patch-gcc_config_netbsd-elf.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-gcc_config_netbsd-elf.h 15 Jun 2018 19:42:13 -0000
@@ -0,0 +1,34 @@
+$NetBSD$
+
+Need NETBSD_SUBTARGET_EXTRA_SPECS for netbsd-eabi.h file.
+
+--- gcc/config/netbsd-elf.h.orig 2017-01-01 12:07:43.000000000 +0000
++++ gcc/config/netbsd-elf.h
+@@ -67,6 +67,9 @@ along with GCC; see the file COPYING3.
+
+ Target-specific code must provide the %(netbsd_entry_point) spec. */
+
++#define NETBSD_LINK_LD_ELF_SO_SPEC \
++ "%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}"
++
+ #define NETBSD_LINK_SPEC_ELF \
+ "%{assert*} %{R*} %{rpath*} \
+ %{shared:-shared} \
+@@ -81,6 +84,17 @@ along with GCC; see the file COPYING3.
+ -dynamic-linker /usr/libexec/ld.elf_so} \
+ %{static:-static}}"
+
++/* Provide the standard list of subtarget extra specs for NetBSD targets. */
++#define NETBSD_SUBTARGET_EXTRA_SPECS \
++ { "netbsd_link_ld_elf_so", NETBSD_LINK_LD_ELF_SO_SPEC }, \
++ { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \
++ { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
++ { "netbsd_entry_point", NETBSD_ENTRY_POINT }, \
++ { "netbsd_endfile_spec", NETBSD_ENDFILE_SPEC },
++
++#undef SUBTARGET_EXTRA_SPECS
++#define SUBTARGET_EXTRA_SPECS NETBSD_SUBTARGET_EXTRA_SPECS
++
+ /* Use --as-needed -lgcc_s for eh support. */
+ #ifdef HAVE_LD_AS_NEEDED
+ #define USE_LD_AS_NEEDED 1
Index: patches/patch-gcc_config_netbsd-protos.h
===================================================================
RCS file: /cvsroot/pkgsrc/lang/gcc7/patches/patch-gcc_config_netbsd-protos.h,v
retrieving revision 1.1
diff -u -r1.1 patch-gcc_config_netbsd-protos.h
--- patches/patch-gcc_config_netbsd-protos.h 3 May 2017 00:21:03 -0000 1.1
+++ patches/patch-gcc_config_netbsd-protos.h 15 Jun 2018 19:42:13 -0000
@@ -1,9 +1,9 @@
$NetBSD: patch-gcc_config_netbsd-protos.h,v 1.1 2017/05/03 00:21:03 maya Exp $
---- /dev/null 2014-12-15 07:13:57.000000000 +0000
+--- gcc/config/netbsd-protos.h.orig 2017-09-29 09:38:08.000000000 +0000
+++ gcc/config/netbsd-protos.h
-@@ -0,0 +1,29 @@
-+/* Prototypes.
+@@ -1,4 +1,33 @@
+ /* Prototypes.
+ Copyright (C) 2001-2014 Free Software Foundation, Inc.
+
+This file is part of GCC.
@@ -32,3 +32,7 @@
+void netbsd_patch_builtins (void);
+
+#endif /* _NETBSD_PROTOS_H_ */
++/* Prototypes.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+
+ This file is part of GCC.
Index: patches/patch-gcc_config_t-netbsd
===================================================================
RCS file: /cvsroot/pkgsrc/lang/gcc7/patches/patch-gcc_config_t-netbsd,v
retrieving revision 1.1
diff -u -r1.1 patch-gcc_config_t-netbsd
--- patches/patch-gcc_config_t-netbsd 3 May 2017 00:21:03 -0000 1.1
+++ patches/patch-gcc_config_t-netbsd 15 Jun 2018 19:42:13 -0000
@@ -1,8 +1,8 @@
$NetBSD: patch-gcc_config_t-netbsd,v 1.1 2017/05/03 00:21:03 maya Exp $
---- /dev/null 2014-12-16 20:23:05.000000000 +0000
+--- gcc/config/t-netbsd.orig 2017-09-29 09:38:08.000000000 +0000
+++ gcc/config/t-netbsd
-@@ -0,0 +1,23 @@
+@@ -1,3 +1,26 @@
+# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
@@ -26,3 +26,6 @@
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
+ # Copyright (C) 2017 Free Software Foundation, Inc.
+ #
+ # This file is part of GCC.
Index: patches/patch-gcc_ginclude_stddef.h
===================================================================
RCS file: patches/patch-gcc_ginclude_stddef.h
diff -N patches/patch-gcc_ginclude_stddef.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-gcc_ginclude_stddef.h 15 Jun 2018 19:42:13 -0000
@@ -0,0 +1,62 @@
+$NetBSD$
+
+handle netbsd/arm not using the same include guards for
+ansi.h as other archs
+
+--- gcc/ginclude/stddef.h.orig 2017-01-01 12:07:43.000000000 +0000
++++ gcc/ginclude/stddef.h
+@@ -46,9 +46,7 @@ see the files COPYING3 and COPYING.RUNTI
+ /* This avoids lossage on SunOS but only if stdtypes.h comes first.
+ There's no way to win with the other order! Sun lossage. */
+
+-/* On 4.3bsd-net2, make sure ansi.h is included, so we have
+- one less case to deal with in the following. */
+-#if defined (__BSD_NET2__) || defined (____386BSD____) || (defined (__FreeBSD__) && (__FreeBSD__ < 5)) || defined(__NetBSD__)
++#if defined(__NetBSD__)
+ #include
+ #endif
+ /* On FreeBSD 5, machine/ansi.h does not exist anymore... */
+@@ -56,11 +54,7 @@ see the files COPYING3 and COPYING.RUNTI
+ #include
+ #endif
+
+-/* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
+- defined if the corresponding type is *not* defined.
+- FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_.
+- NetBSD defines _I386_ANSI_H_ and _X86_64_ANSI_H_ instead of _ANSI_H_ */
+-#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_) || defined(_I386_ANSI_H_)
++#if defined(__NetBSD__)
+ #if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
+ #define _SIZE_T
+ #endif
+@@ -87,7 +81,7 @@ see the files COPYING3 and COPYING.RUNTI
+ #undef _WCHAR_T_
+ #undef _BSD_WCHAR_T_
+ #endif
+-#endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_) || defined(_I386_ANSI_H_) */
++#endif /* defined(__NetBSD__) */
+
+ /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
+ Just ignore it. */
+@@ -359,11 +353,7 @@ typedef __WINT_TYPE__ wint_t;
+ #undef __need_wint_t
+ #endif
+
+-/* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
+- are already defined. */
+-/* BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here. */
+-/* NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here. */
+-#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_) || defined(_I386_ANSI_H_)
++#if defined(__NetBSD__)
+ /* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
+ are probably typos and should be removed before 2.8 is released. */
+ #ifdef _GCC_PTRDIFF_T_
+@@ -391,7 +381,7 @@ typedef __WINT_TYPE__ wint_t;
+ #undef _WCHAR_T_
+ #undef _BSD_WCHAR_T_
+ #endif
+-#endif /* _ANSI_H_ || _MACHINE_ANSI_H_ || _X86_64_ANSI_H_ || _I386_ANSI_H_ */
++#endif /* __NetBSD__ */
+
+ #endif /* __sys_stdtypes_h */
+
Index: patches/patch-libgcc_config.host
===================================================================
RCS file: patches/patch-libgcc_config.host
diff -N patches/patch-libgcc_config.host
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-libgcc_config.host 15 Jun 2018 19:42:13 -0000
@@ -0,0 +1,24 @@
+$NetBSD$
+
+netbsd/arm EABI support
+
+--- libgcc/config.host.orig 2018-01-08 13:39:11.000000000 +0000
++++ libgcc/config.host
+@@ -396,7 +396,16 @@ arm*-*-freebsd*) # ARM Fr
+ tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
+ ;;
+ arm*-*-netbsdelf*)
+- tmake_file="$tmake_file arm/t-arm arm/t-netbsd t-slibgcc-gld-nover"
++ tmake_file="$tmake_file arm/t-arm"
++ case ${host} in
++ arm*-*-netbsdelf-*eabi*)
++ tmake_file="${tmake_file} arm/t-netbsd-eabi"
++ unwind_header=config/arm/unwind-arm.h
++ ;;
++ *)
++ tmake_file="${tmake_file} arm/t-netbsd t-slibgcc-gld-nover"
++ ;;
++ esac
+ ;;
+ arm*-*-linux*) # ARM GNU/Linux with ELF
+ tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix t-crtfm"
Index: patches/patch-libgcc_config_arm_t-netbsd
===================================================================
RCS file: patches/patch-libgcc_config_arm_t-netbsd
diff -N patches/patch-libgcc_config_arm_t-netbsd
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-libgcc_config_arm_t-netbsd 15 Jun 2018 19:42:13 -0000
@@ -0,0 +1,27 @@
+$NetBSD$
+
+Update arm t-netbsd from netbsd's base.
+
+--- libgcc/config/arm/t-netbsd.orig 2011-11-02 15:23:48.000000000 +0000
++++ libgcc/config/arm/t-netbsd
+@@ -1,7 +1,18 @@
++# This list is from t-elf, but with some things removed.
++LIB1ASMFUNCS += _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func \
++ _call_via_rX _interwork_call_via_rX \
++ _arm_fixunsdfsi _arm_fixunssfsi \
++ _arm_floatdidf _arm_floatdisf _arm_floatundidf _arm_floatundisf \
++ _lshrdi3 _ashrdi3 _ashldi3 \
++ _clzsi2 _clzdi2 _ctzsi2
++
+ # Just for these, we omit the frame pointer since it makes such a big
+ # difference. It is then pointless adding debugging.
+ HOST_LIBGCC2_CFLAGS += -fomit-frame-pointer
+
+-LIBGCC2_DEBUG_CFLAGS = -g0
+-
+ LIB2ADD += $(srcdir)/floatunsidf.c $(srcdir)/floatunsisf.c
++
++# Currently there is a bug somewhere in GCC's alias analysis
++# or scheduling code that is breaking _fpmul_parts in fp-bit.c.
++# Disabling function inlining is a workaround for this problem.
++HOST_LIBGCC2_CFLAGS += -fno-inline
Index: patches/patch-libgcc_config_arm_t-netbsd-eabi
===================================================================
RCS file: patches/patch-libgcc_config_arm_t-netbsd-eabi
diff -N patches/patch-libgcc_config_arm_t-netbsd-eabi
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-libgcc_config_arm_t-netbsd-eabi 15 Jun 2018 19:42:13 -0000
@@ -0,0 +1,26 @@
+$NetBSD$
+
+netbsd/arm EABI support
+
+--- libgcc/config/arm/t-netbsd-eabi.orig 2018-06-15 14:49:36.798627201 +0000
++++ libgcc/config/arm/t-netbsd-eabi
+@@ -0,0 +1,19 @@
++# This list is from t-elf, but with lots removed.
++LIB1ASMFUNCS += _dvmd_tls _bb_init_func _call_via_rX _interwork_call_via_rX \
++ _clzsi2 _clzdi2 _ctzsi2
++
++# Derived from t-bpabi
++# Add the BPABI C functions.
++LIB2ADD += $(srcdir)/config/arm/unaligned-funcs.c
++
++LIB2ADDEH = $(srcdir)/config/arm/unwind-arm.c \
++ $(srcdir)/config/arm/libunwind.S \
++ $(srcdir)/config/arm/pr-support.c $(srcdir)/unwind-c.c
++
++# Add the BPABI names.
++SHLIB_MAPFILES += $(srcdir)/config/arm/libgcc-bpabi.ver
++
++# On ARM, specifying -fnon-call-exceptions will needlessly pull in
++# the unwinder in simple programs which use 64-bit division. Omitting
++# the option is safe.
++LIB2_DIVMOD_EXCEPTION_FLAGS := -fexceptions