summaryrefslogtreecommitdiff
path: root/lang/gcc8
diff options
context:
space:
mode:
authormrg <mrg@pkgsrc.org>2018-11-10 11:45:27 +0000
committermrg <mrg@pkgsrc.org>2018-11-10 11:45:27 +0000
commitc6000e1c0dc9461117f03cf524a1117d0e7036a8 (patch)
tree9001c3408e1621bd87deda1584f222f73c4bd74a /lang/gcc8
parent9385e4237338a7ecb4079087c1a880d254732403 (diff)
downloadpkgsrc-c6000e1c0dc9461117f03cf524a1117d0e7036a8.tar.gz
port the arm64 support to GCC 8.
Diffstat (limited to 'lang/gcc8')
-rw-r--r--lang/gcc8/distinfo13
-rw-r--r--lang/gcc8/patches/patch-gcc_config.gcc32
-rw-r--r--lang/gcc8/patches/patch-gcc_config_aarch64_aarch64-builtins.c16
-rw-r--r--lang/gcc8/patches/patch-gcc_config_aarch64_aarch64-netbsd.h104
-rw-r--r--lang/gcc8/patches/patch-gcc_config_aarch64_aarch64.h15
-rw-r--r--lang/gcc8/patches/patch-gcc_config_aarch64_t-aarch64-netbsd28
-rw-r--r--lang/gcc8/patches/patch-gcc_config_netbsd-elf.h37
-rw-r--r--lang/gcc8/patches/patch-gcc_ginclude_stddef.h62
-rw-r--r--lang/gcc8/patches/patch-libgcc_config.host23
9 files changed, 310 insertions, 20 deletions
diff --git a/lang/gcc8/distinfo b/lang/gcc8/distinfo
index 2b946b652e9..55585e8388f 100644
--- a/lang/gcc8/distinfo
+++ b/lang/gcc8/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.5 2018/11/07 04:32:32 maya Exp $
+$NetBSD: distinfo,v 1.6 2018/11/10 11:45:27 mrg Exp $
SHA1 (gcc-8.2.0.tar.xz) = 19926bdb6c4b58891015929853d41aeff019d400
RMD160 (gcc-8.2.0.tar.xz) = 4fba19867980d04bed1e62d46d4787c99f4fd13d
@@ -10,20 +10,25 @@ SHA512 (isl-0.16.1.tar.bz2) = c188667a84dc5bdddb4ab7c35f89c91bf15a8171f4fcaf4130
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) = c57c3668688a96950a706cb9643b40e5631545f9
+SHA1 (patch-gcc_config.gcc) = 4a971d1df7f05cfaefdf462d1b7c6dea1e838713
+SHA1 (patch-gcc_config_aarch64_aarch64-builtins.c) = b10ef4b9ad39e605fc4e2a0c8dffdae677842e94
+SHA1 (patch-gcc_config_aarch64_aarch64-netbsd.h) = ed7bc42813b33c87242f5ef0a304a621b873c9eb
+SHA1 (patch-gcc_config_aarch64_aarch64.h) = 54b90eb2cfedb6c57d01c1a1094c851756648f09
+SHA1 (patch-gcc_config_aarch64_t-aarch64-netbsd) = 0e7feb6f238b0a752ccc50e95e09b017cb368a90
SHA1 (patch-gcc_config_arm_arm.h) = aba0bab2489cb7224d45eca0977156fe4f7a74a8
-SHA1 (patch-gcc_config_netbsd-elf.h) = 0fcfadfe0734f9583fdec7817112a42fb7be0eb3
+SHA1 (patch-gcc_config_netbsd-elf.h) = e392918cce01627d64d4153329775c7ad03b4a45
SHA1 (patch-gcc_config_netbsd-protos.h) = 6d28864b4ccc8c1a63fe28e43601b84b63a00633
SHA1 (patch-gcc_config_t-netbsd) = 802ad5706aa7ca9629f8e237f08fbb1569d28846
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) = 7bd85ac8ade76a28c394f6fbe5d495f91824f79f
SHA1 (patch-gcc_targhooks.c) = b28d8a9696d07bbfb00b7d8c55193ba99447ff1d
SHA1 (patch-isl_configure) = 36b37778ee13c0b364fb24d5864d6a9e65b29b7d
SHA1 (patch-libffi_configure) = bcfbfe8abddc378e2de4a39ad0669583b37e0292
SHA1 (patch-libffi_testsuite_libffi.call_float2.c) = 6321dde308579448c27c2b6e1e30633699dd145f
-SHA1 (patch-libgcc_config.host) = bdd4cd27249c8b62793204428d95c977d58f06fb
+SHA1 (patch-libgcc_config.host) = 8d8fab73ae6b6476f648f73ad9c05436926f5d13
SHA1 (patch-libgcc_crtstuff.c) = e3a3b02a26229992851f195b5701cb1b86c29efe
SHA1 (patch-libgfortran_io_io.h) = d44676239a7f45e42054d24bd5224f43c20055c0
SHA1 (patch-libsanitizer_configure.tgt) = 0a47782f01631d1c91e28a8735865c8571fbcf7d
diff --git a/lang/gcc8/patches/patch-gcc_config.gcc b/lang/gcc8/patches/patch-gcc_config.gcc
index fb35f167abe..8bc9219c1a4 100644
--- a/lang/gcc8/patches/patch-gcc_config.gcc
+++ b/lang/gcc8/patches/patch-gcc_config.gcc
@@ -1,20 +1,38 @@
-$NetBSD: patch-gcc_config.gcc,v 1.1 2018/05/05 04:08:36 maya Exp $
+$NetBSD: patch-gcc_config.gcc,v 1.2 2018/11/10 11:45:27 mrg Exp $
---- gcc/config.gcc.orig 2017-10-21 21:09:53.000000000 +0000
-+++ gcc/config.gcc
-@@ -801,6 +801,11 @@ case ${target} in
+add arm64 support
+
+build cabs* rename support
+
+fix x86 crtstuff.
+
+--- gcc/config.gcc.orig 2018-06-25 19:34:01.000000000 +0000
++++ gcc/config.gcc 2018-11-10 00:20:47.655130032 +0000
+@@ -812,6 +812,9 @@
gas=yes
gnu_ld=yes
use_gcc_stdint=wrap
+ # cabs/cabsf are renamed to __c99_cabs/cabsf
-+ tm_p_file="${tm_p_file} netbsd-protos.h"
+ target_gtfiles="${target_gtfiles} \$(srcdir)/config/netbsd.c"
-+ extra_objs="${extra_objs} netbsd.o"
+ default_gnu_indirect_function=yes
case ${enable_threads} in
"" | yes | posix) thread_file='posix' ;;
esac
-@@ -1498,10 +1503,12 @@ x86_64-*-freebsd*)
+@@ -980,6 +983,13 @@
+ tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-freebsd.h"
+ tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-freebsd"
+ ;;
++aarch64*-*-netbsd*)
++ tm_file="${tm_file} dbxelf.h elfos.h ${nbsd_tm_file}"
++ tm_file="${tm_file} aarch64/aarch64-elf.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"
++ # XXX big endian
++ ;;
+ aarch64*-*-linux*)
+ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h"
+ tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-linux.h"
+@@ -1523,10 +1533,12 @@
i[34567]86-*-netbsdelf*)
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"
diff --git a/lang/gcc8/patches/patch-gcc_config_aarch64_aarch64-builtins.c b/lang/gcc8/patches/patch-gcc_config_aarch64_aarch64-builtins.c
new file mode 100644
index 00000000000..26d06383e5d
--- /dev/null
+++ b/lang/gcc8/patches/patch-gcc_config_aarch64_aarch64-builtins.c
@@ -0,0 +1,16 @@
+$NetBSD: patch-gcc_config_aarch64_aarch64-builtins.c,v 1.1 2018/11/10 11:45:27 mrg Exp $
+
+initialise subtarget builtins so cabs*() are renamed.
+
+--- gcc/config/aarch64/aarch64-builtins.c.orig 2017-01-20 21:03:41.000000000 +0000
++++ gcc/config/aarch64/aarch64-builtins.c 2018-11-10 00:44:41.905576216 +0000
+@@ -991,6 +991,9 @@
+ register them. */
+ if (!TARGET_ILP32)
+ aarch64_init_pauth_hint_builtins ();
++#ifdef SUBTARGET_INIT_BUILTINS
++ SUBTARGET_INIT_BUILTINS;
++#endif
+ }
+
+ tree
diff --git a/lang/gcc8/patches/patch-gcc_config_aarch64_aarch64-netbsd.h b/lang/gcc8/patches/patch-gcc_config_aarch64_aarch64-netbsd.h
new file mode 100644
index 00000000000..a8211484ca0
--- /dev/null
+++ b/lang/gcc8/patches/patch-gcc_config_aarch64_aarch64-netbsd.h
@@ -0,0 +1,104 @@
+$NetBSD: patch-gcc_config_aarch64_aarch64-netbsd.h,v 1.1 2018/11/10 11:45:27 mrg Exp $
+
+arm64 support.
+
+--- /dev/null 2018-11-09 09:25:57.929086649 +0000
++++ gcc/config/aarch64/aarch64-netbsd.h 2018-11-09 09:23:18.308262443 +0000
+@@ -0,0 +1,97 @@
++/* Definitions for AArch64 running NetBSD
++ Copyright (C) 2016-2017 Free Software Foundation, 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
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef GCC_AARCH64_NETBSD_H
++#define GCC_AARCH64_NETBSD_H
++
++#define TARGET_LINKER_BIG_EMULATION "aarch64nbsdb"
++#define TARGET_LINKER_LITTLE_EMULATION "aarch64nbsd"
++
++#if TARGET_BIG_ENDIAN_DEFAULT
++#define TARGET_LINKER_EMULATION TARGET_LINKER_BIG_EMULATION
++#else
++#define TARGET_LINKER_EMULATION TARGET_LINKER_LITTLE_EMULATION
++#endif
++
++#undef SUBTARGET_EXTRA_LINK_SPEC
++#define SUBTARGET_EXTRA_LINK_SPEC " -m" TARGET_LINKER_EMULATION
++
++#define NETBSD_ENTRY_POINT "__start"
++
++#define NETBSD_TARGET_LINK_SPEC "%{h*} \
++ -X %{mbig-endian:-EB -m " TARGET_LINKER_BIG_EMULATION "} \
++ %{mlittle-endian:-EL -m " TARGET_LINKER_LITTLE_EMULATION "} \
++ %(netbsd_link_spec)"
++
++#if TARGET_FIX_ERR_A53_835769_DEFAULT
++#define CA53_ERR_835769_SPEC \
++ " %{!mno-fix-cortex-a53-835769:--fix-cortex-a53-835769}"
++#else
++#define CA53_ERR_835769_SPEC \
++ " %{mfix-cortex-a53-835769:--fix-cortex-a53-835769}"
++#endif
++
++#ifdef TARGET_FIX_ERR_A53_843419_DEFAULT
++#define CA53_ERR_843419_SPEC \
++ " %{!mno-fix-cortex-a53-843419:--fix-cortex-a53-843419}"
++#else
++#define CA53_ERR_843419_SPEC \
++ " %{mfix-cortex-a53-843419:--fix-cortex-a53-843419}"
++#endif
++
++#undef LINK_SPEC
++#define LINK_SPEC NETBSD_LINK_SPEC_ELF \
++ NETBSD_TARGET_LINK_SPEC \
++ CA53_ERR_835769_SPEC \
++ CA53_ERR_843419_SPEC
++
++#undef TARGET_OS_CPP_BUILTINS
++#define TARGET_OS_CPP_BUILTINS() \
++ do \
++ { \
++ NETBSD_OS_CPP_BUILTINS_ELF(); \
++ } \
++ while (0)
++
++#undef SUBTARGET_CPP_SPEC
++#define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
++
++#if 0
++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
++#endif
++
++#if 0
++/* Uninitialized common symbols in non-PIE executables, even with
++ strong definitions in dependent shared libraries, will resolve
++ to COPY relocated symbol in the executable. See PR65780. */
++#undef TARGET_BINDS_LOCAL_P
++#define TARGET_BINDS_LOCAL_P default_binds_local_p_2
++#endif
++
++#if 0
++#undef MCOUNT_NAME
++#define MCOUNT_NAME ".mcount"
++#endif
++
++#undef EXTRA_SPECS
++#define EXTRA_SPECS \
++ { "asm_cpu_spec", ASM_CPU_SPEC }, \
++ NETBSD_SUBTARGET_EXTRA_SPECS
++
++#endif /* GCC_AARCH64_NETBSD_H */
diff --git a/lang/gcc8/patches/patch-gcc_config_aarch64_aarch64.h b/lang/gcc8/patches/patch-gcc_config_aarch64_aarch64.h
new file mode 100644
index 00000000000..4b3132d5ff4
--- /dev/null
+++ b/lang/gcc8/patches/patch-gcc_config_aarch64_aarch64.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-gcc_config_aarch64_aarch64.h,v 1.1 2018/11/10 11:45:27 mrg Exp $
+
+support arm64.
+
+--- gcc/config/aarch64/aarch64.h.orig 2018-02-21 14:05:45.000000000 +0000
++++ gcc/config/aarch64/aarch64.h 2018-11-09 12:07:14.375232698 +0000
+@@ -1000,7 +1000,7 @@
+ #define MCPU_TO_MARCH_SPEC_FUNCTIONS \
+ { "rewrite_mcpu", aarch64_rewrite_mcpu },
+
+-#if defined(__aarch64__)
++#if defined(__aarch64__) && !defined(__NetBSD__)
+ extern const char *host_detect_local_cpu (int argc, const char **argv);
+ #define HAVE_LOCAL_CPU_DETECT
+ # define EXTRA_SPEC_FUNCTIONS \
diff --git a/lang/gcc8/patches/patch-gcc_config_aarch64_t-aarch64-netbsd b/lang/gcc8/patches/patch-gcc_config_aarch64_t-aarch64-netbsd
new file mode 100644
index 00000000000..609060c714f
--- /dev/null
+++ b/lang/gcc8/patches/patch-gcc_config_aarch64_t-aarch64-netbsd
@@ -0,0 +1,28 @@
+$NetBSD: patch-gcc_config_aarch64_t-aarch64-netbsd,v 1.1 2018/11/10 11:45:27 mrg Exp $
+
+arm64 support.
+
+--- /dev/null 2018-11-09 09:25:57.929086649 +0000
++++ gcc/config/aarch64/t-aarch64-netbsd 2018-11-09 09:23:36.784950907 +0000
+@@ -0,0 +1,21 @@
++# Machine description for AArch64 architecture.
++# Copyright (C) 2016-2017 Free Software Foundation, 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
++# <http://www.gnu.org/licenses/>.
++
++LIB1ASMSRC = aarch64/lib1funcs.asm
++LIB1ASMFUNCS = _aarch64_sync_cache_range
diff --git a/lang/gcc8/patches/patch-gcc_config_netbsd-elf.h b/lang/gcc8/patches/patch-gcc_config_netbsd-elf.h
index dab5762cc56..d1f19cab4af 100644
--- a/lang/gcc8/patches/patch-gcc_config_netbsd-elf.h
+++ b/lang/gcc8/patches/patch-gcc_config_netbsd-elf.h
@@ -1,12 +1,13 @@
-$NetBSD: patch-gcc_config_netbsd-elf.h,v 1.1 2018/11/07 04:32:32 maya Exp $
+$NetBSD: patch-gcc_config_netbsd-elf.h,v 1.2 2018/11/10 11:45:27 mrg Exp $
Link PIE executables with crtbeginS/crtendS on NetBSD.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87221
+Add NETBSD_SUBTARGET_EXTRA_SPECS and NETBSD_LINK_LD_ELF_SO_SPEC.
--- gcc/config/netbsd-elf.h.orig 2018-01-03 10:03:58.000000000 +0000
-+++ gcc/config/netbsd-elf.h
-@@ -40,8 +40,11 @@ along with GCC; see the file COPYING3.
++++ gcc/config/netbsd-elf.h 2018-11-10 06:47:49.835868835 +0000
+@@ -40,8 +40,11 @@
%{!p:crt0%O%s}}} \
%:if-exists(crti%O%s) \
%{static:%:if-exists-else(crtbeginT%O%s crtbegin%O%s)} \
@@ -20,7 +21,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87221
#undef STARTFILE_SPEC
#define STARTFILE_SPEC NETBSD_STARTFILE_SPEC
-@@ -52,7 +55,10 @@ along with GCC; see the file COPYING3.
+@@ -52,7 +55,10 @@
C++ file-scope static objects deconstructed after exiting "main". */
#define NETBSD_ENDFILE_SPEC \
@@ -32,3 +33,31 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87221
%:if-exists(crtn%O%s)"
#undef ENDFILE_SPEC
+@@ -67,6 +73,9 @@
+
+ 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 +90,17 @@
+ -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
diff --git a/lang/gcc8/patches/patch-gcc_ginclude_stddef.h b/lang/gcc8/patches/patch-gcc_ginclude_stddef.h
new file mode 100644
index 00000000000..c748f33da1b
--- /dev/null
+++ b/lang/gcc8/patches/patch-gcc_ginclude_stddef.h
@@ -0,0 +1,62 @@
+$NetBSD: patch-gcc_ginclude_stddef.h,v 1.1 2018/11/10 11:45:27 mrg Exp $
+
+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 <machine/ansi.h>
+ #endif
+ /* On FreeBSD 5, machine/ansi.h does not exist anymore... */
+@@ -56,11 +54,7 @@ see the files COPYING3 and COPYING.RUNTI
+ #include <sys/_types.h>
+ #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 */
+
diff --git a/lang/gcc8/patches/patch-libgcc_config.host b/lang/gcc8/patches/patch-libgcc_config.host
index 31c759d99ae..3fa9cfb494d 100644
--- a/lang/gcc8/patches/patch-libgcc_config.host
+++ b/lang/gcc8/patches/patch-libgcc_config.host
@@ -1,10 +1,23 @@
-$NetBSD: patch-libgcc_config.host,v 1.1 2018/05/05 04:08:36 maya Exp $
+$NetBSD: patch-libgcc_config.host,v 1.2 2018/11/10 11:45:27 mrg Exp $
-Add libgcc x86 netbsd config
+Add libgcc x86 and arm64 netbsd config
---- libgcc/config.host.orig 2017-03-10 19:33:27.000000000 +0000
-+++ libgcc/config.host
-@@ -605,10 +605,10 @@ x86_64-*-freebsd*)
+--- libgcc/config.host.orig 2018-04-06 13:04:17.000000000 -0700
++++ libgcc/config.host 2018-11-09 03:33:30.166898124 -0800
+@@ -350,6 +350,12 @@
+ tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
+ tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp"
+ ;;
++aarch64*-*-netbsd*)
++ extra_parts="$extra_parts crtfastmath.o"
++ tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
++ tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
++ md_unwind_header=aarch64/aarch64-unwind.h
++ ;;
+ aarch64*-*-linux*)
+ extra_parts="$extra_parts crtfastmath.o"
+ md_unwind_header=aarch64/linux-unwind.h
+@@ -632,10 +638,10 @@
md_unwind_header=i386/freebsd-unwind.h
;;
i[34567]86-*-netbsdelf*)