pkgsrc-WIP-changes archive

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

gcc10-aux: Fix package



Module Name:	pkgsrc-wip
Committed By:	irvise <irvise%irvise.xyz@localhost>
Pushed By:	irvise
Date:		Sun Oct 31 14:52:33 2021 +0100
Changeset:	87c048c1882ab853d9b4bf4970cab1008fdcd914

Modified Files:
	gcc10-aux/DESCR
	gcc10-aux/Makefile
	gcc10-aux/buildlink3.mk
	gcc10-aux/distinfo
	gcc10-aux/options.mk
	gcc10-aux/patches/patch-gcc_config.gcc
Added Files:
	gcc10-aux/patches/patch-gcc_ada_Makefile.rtl
	gcc10-aux/patches/patch-gcc_ada_adaint.c
	gcc10-aux/patches/patch-gcc_ada_adaint.h
	gcc10-aux/patches/patch-gcc_ada_cstreams.c
	gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.adb
	gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.ads
	gcc10-aux/patches/patch-gcc_ada_libgnarl_s-taprop____posix.adb
	gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi.ads
	gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi____bsd.adb
	gcc10-aux/patches/patch-gcc_ada_libgnat_s-osprim____posix.adb
	gcc10-aux/patches/patch-gcc_ada_s-oscons-tmplt.c
	gcc10-aux/patches/patch-gcc_ada_sysdep.c
	gcc10-aux/patches/patch-gcc_config_darwin-driver.c
	gcc10-aux/patches/patch-gnattools_configure
Removed Files:
	gcc10-aux/patches/patch-ada_adaint.c
	gcc10-aux/patches/patch-ada_adaint.h
	gcc10-aux/patches/patch-ada_configure
	gcc10-aux/patches/patch-ada_configure.ac
	gcc10-aux/patches/patch-ada_cstreams.c
	gcc10-aux/patches/patch-ada_g-socthi.ads
	gcc10-aux/patches/patch-ada_g-socthi__bsd.adb
	gcc10-aux/patches/patch-ada_makefile.rtl
	gcc10-aux/patches/patch-ada_netbsd-symbols
	gcc10-aux/patches/patch-ada_s-oscons-tmplt.c
	gcc10-aux/patches/patch-ada_s-osinte__netbsd.adb
	gcc10-aux/patches/patch-ada_s-osinte__netbsd.ads
	gcc10-aux/patches/patch-ada_s-osprim__posix.adb
	gcc10-aux/patches/patch-ada_s-taprop__posix.adb
	gcc10-aux/patches/patch-ada_sysdep.c

Log Message:
gcc10-aux: Fix package

gcc10-aux has been rebased on gcc10 from -current.
gcc6-aux has been made into an explicit dependency so as to
not rely on the pkgsrc infra. Therefore, USE_LANGUAGES = ada
has been dropped.
pkglint errors have been fixed, mainly renaming and documentation
of packages.
Further fixes to buildlink3.mk and to the Makefile may be needed.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=87c048c1882ab853d9b4bf4970cab1008fdcd914

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

diffstat:
 gcc10-aux/DESCR                                    |   4 +-
 gcc10-aux/Makefile                                 |  25 +-
 gcc10-aux/buildlink3.mk                            |   2 +-
 gcc10-aux/distinfo                                 |  37 +-
 gcc10-aux/options.mk                               |  29 +-
 gcc10-aux/patches/patch-ada_adaint.c               |  82 ---
 gcc10-aux/patches/patch-ada_adaint.h               |  31 -
 gcc10-aux/patches/patch-ada_configure              |  14 -
 gcc10-aux/patches/patch-ada_configure.ac           |  14 -
 gcc10-aux/patches/patch-ada_cstreams.c             |  21 -
 gcc10-aux/patches/patch-ada_g-socthi.ads           |  20 -
 gcc10-aux/patches/patch-ada_g-socthi__bsd.adb      | 359 -----------
 gcc10-aux/patches/patch-ada_makefile.rtl           | 143 -----
 gcc10-aux/patches/patch-ada_netbsd-symbols         |  20 -
 gcc10-aux/patches/patch-ada_s-oscons-tmplt.c       |  89 ---
 gcc10-aux/patches/patch-ada_s-osinte__netbsd.adb   | 143 -----
 gcc10-aux/patches/patch-ada_s-osinte__netbsd.ads   | 666 --------------------
 gcc10-aux/patches/patch-ada_s-osprim__posix.adb    |  20 -
 gcc10-aux/patches/patch-ada_s-taprop__posix.adb    |  19 -
 gcc10-aux/patches/patch-ada_sysdep.c               |  38 --
 gcc10-aux/patches/patch-gcc_ada_Makefile.rtl       | 147 +++++
 gcc10-aux/patches/patch-gcc_ada_adaint.c           |  88 +++
 gcc10-aux/patches/patch-gcc_ada_adaint.h           |  37 ++
 gcc10-aux/patches/patch-gcc_ada_cstreams.c         |  25 +
 .../patch-gcc_ada_libgnarl_s-osinte____netbsd.adb  | 147 +++++
 .../patch-gcc_ada_libgnarl_s-osinte____netbsd.ads  | 670 +++++++++++++++++++++
 .../patch-gcc_ada_libgnarl_s-taprop____posix.adb   |  27 +
 .../patches/patch-gcc_ada_libgnat_g-socthi.ads     |  24 +
 .../patch-gcc_ada_libgnat_g-socthi____bsd.adb      | 363 +++++++++++
 .../patch-gcc_ada_libgnat_s-osprim____posix.adb    |  24 +
 gcc10-aux/patches/patch-gcc_ada_s-oscons-tmplt.c   |  94 +++
 gcc10-aux/patches/patch-gcc_ada_sysdep.c           |  42 ++
 gcc10-aux/patches/patch-gcc_config.gcc             |  45 +-
 gcc10-aux/patches/patch-gcc_config_darwin-driver.c |  15 +
 gcc10-aux/patches/patch-gnattools_configure        |  18 +
 35 files changed, 1797 insertions(+), 1745 deletions(-)

diffs:
diff --git a/gcc10-aux/DESCR b/gcc10-aux/DESCR
index 902190a230..da4045c8b2 100644
--- a/gcc10-aux/DESCR
+++ b/gcc10-aux/DESCR
@@ -1,2 +1,2 @@
-The GNU Compiler Collection (GCC) includes front ends for C, C++, Objective-C,
-Fortran, and Go.
+The GNU Compiler Collection (GCC) with Ada support. Includes front ends for Ada,
+C, C++ and Fortran.
diff --git a/gcc10-aux/Makefile b/gcc10-aux/Makefile
index 74cab739c1..9c569055e8 100644
--- a/gcc10-aux/Makefile
+++ b/gcc10-aux/Makefile
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.10 2021/04/22 12:08:16 adam Exp $
+# $NetBSD: Makefile,v 1.14 2021/10/12 13:46:14 tnn Exp $
 
-GCC_PKGNAME=		gcc10
+GCC_PKGNAME=		gcc10-aux
+PKGREVISION=		1
 .include		"version.mk"
 
 DISTNAME=	gcc-${GCC10_DIST_VERSION}
@@ -12,18 +13,21 @@ CATEGORIES=	lang
 MASTER_SITES=	${MASTER_SITE_GNU:=gcc/gcc-${GCC10_DIST_VERSION}/}
 EXTRACT_SUFX=	.tar.xz
 
-MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+MAINTAINER=	irvise%irvise.xyz@localhost
 HOMEPAGE=	https://gcc.gnu.org/
-COMMENT=	The GNU Compiler Collection (GCC) - 10.0 Release Series
+COMMENT=	The GNU Compiler Collection (GCC) with Ada support v10
 LICENSE=	gnu-gpl-v2 AND gnu-gpl-v3 AND gnu-lgpl-v2 AND gnu-lgpl-v3
 
 DISTFILES=		${DEFAULT_DISTFILES}
 EXTRACT_ONLY=		${DEFAULT_DISTFILES}
 
+# Relocations result in a linker error on AArch64, but not x86.
+MKPIE_SUPPORTED=	no
+
 NOT_FOR_PLATFORM=	Interix-*-*
 
-USE_LANGUAGES=		c99 c++ ada
-USE_TOOLS+=		gmake makeinfo sed:run tar:build
+USE_LANGUAGES=		c99 c++
+USE_TOOLS+=		gcc6-aux gmake makeinfo sed:run tar:build
 USE_TOOLS.NetBSD+=	gsed
 
 GNU_CONFIGURE=		yes
@@ -119,7 +123,10 @@ MAKE_ENV.NetBSD+=	ac_cv_func_newlocale=no
 MAKE_ENV.NetBSD+=	ac_cv_func_uselocale=no
 MAKE_ENV.SunOS+=	ac_cv_func_mkostemp=no
 
-CONFIGURE_ARGS.DragonFly+=	--disable-bootstrap
+.if !empty(PKGSRC_COMPILER:Mclang) || ${OPSYS} == "DragonFly"
+CONFIGURE_ARGS+=	--disable-bootstrap
+CHECK_RELRO_SKIP+=	${GCC_PKGNAME}/lib/*
+.endif
 
 .if !empty(MACHINE_PLATFORM:MNetBSD-*-i386) || !empty(MACHINE_PLATFORM:MLinux-*-i386)
 CONFIGURE_ARGS+=	--with-arch=i486 --with-tune=i486
@@ -190,8 +197,10 @@ post-install:
 
 GENERATE_PLIST+= \
 	cd ${DESTDIR}${PREFIX} && \
-	${FIND} ${GCC_SUBPREFIX} \( -type f -o -type l \) -print | ${SORT};
+	${FIND} ${GCC_SUBPREFIX} \( -type f -o -type l \) -print | ${SORT}
 
+# Add gcc6-aux as an explicit dependency. It is needed to bootstrap.
+.include "../../lang/gcc6-aux/buildlink3.mk"
 .include "../../devel/zlib/buildlink3.mk"
 .include "../../mk/dlopen.buildlink3.mk"
 .include "../../mk/pthread.buildlink3.mk"
diff --git a/gcc10-aux/buildlink3.mk b/gcc10-aux/buildlink3.mk
index 01e4c8840c..83df60bfac 100644
--- a/gcc10-aux/buildlink3.mk
+++ b/gcc10-aux/buildlink3.mk
@@ -7,7 +7,7 @@ GCC10_BUILDLINK3_MK:=
 
 BUILDLINK_API_DEPENDS.gcc10+=	gcc10>=${_GCC_REQD}
 BUILDLINK_ABI_DEPENDS.gcc10+=	gcc10>=10.0
-BUILDLINK_PKGSRCDIR.gcc10=	../../lang/gcc10
+BUILDLINK_PKGSRCDIR.gcc10=	../../wip/gcc10-aux
 BUILDLINK_DEPMETHOD.gcc10?=	build
 
 BUILDLINK_PASSTHRU_DIRS+=	${BUILDLINK_PREFIX.gcc10}/gcc10
diff --git a/gcc10-aux/distinfo b/gcc10-aux/distinfo
index 91c34683e3..3e5ceced03 100644
--- a/gcc10-aux/distinfo
+++ b/gcc10-aux/distinfo
@@ -1,41 +1,40 @@
-$NetBSD$
+$NetBSD: distinfo,v 1.12 2021/10/26 10:51:35 nia Exp $
 
-SHA1 (gcc-10.3.0.tar.xz) = fb51ed1660c065898c75951fb38e1ebad7d49feb
 RMD160 (gcc-10.3.0.tar.xz) = 8edb715cf1159fd8de773d0d5208d2e83ca36402
+BLAKE2s (gcc-10.3.0.tar.xz) = 6d7c42f9386e5e32a3148122471cb207e5f65d7b5f53b3c9adba2d45a4f28715
 SHA512 (gcc-10.3.0.tar.xz) = 2b2dd7453d48a398c29eaebd1422b70341001b8c90a62aee51e83344e7fdd8a8e45f82a4a9165bd7edc76dada912c932f4b6632c5636760fec4c5d7e402b3f86
 Size (gcc-10.3.0.tar.xz) = 76692288 bytes
-SHA1 (isl-0.16.1.tar.bz2) = c5a2b201bf05229647e73203c0bf2d9679d4d21f
 RMD160 (isl-0.16.1.tar.bz2) = 5a99db3fe0d0a1f6bbac1ed4448f2403495c55b2
+BLAKE2s (isl-0.16.1.tar.bz2) = 01c3fc657326e81414986eb7ede6f73e540b97009745ced125cdf7f4a8d80f61
 SHA512 (isl-0.16.1.tar.bz2) = c188667a84dc5bdddb4ab7c35f89c91bf15a8171f4fcaf41301cf285fb7328846d9a367c096012fec4cc69d244f0bc9e95d84c09ec097394cd4093076f2a041b
 Size (isl-0.16.1.tar.bz2) = 1626446 bytes
-SHA1 (patch-ada_adaint.c) = a6a0cca403676f767a1177a36f2e6f508984147c
-SHA1 (patch-ada_adaint.h) = c6f4822ec5599b4faebf5fe072d521407b871c6e
-SHA1 (patch-ada_configure) = 70ba7ec19a72bda7d4ff0cf0d36db4f50432baff
-SHA1 (patch-ada_configure.ac) = 0ee07e9e169a391e4e080757ca1494eed4325dd6
-SHA1 (patch-ada_cstreams.c) = 551d6b84eeb539e74d6a32df16c7ff27a8fbb4eb
-SHA1 (patch-ada_g-socthi.ads) = 25b7a2831a4d319250eb1627aa20b410eb844434
-SHA1 (patch-ada_g-socthi__bsd.adb) = 3471d97d775c37d33ac9b668c083f5577afcb7d8
-SHA1 (patch-ada_makefile.rtl) = 98e3167b5ee6ef63539403d47ca3f39f2314d3f9
-SHA1 (patch-ada_netbsd-symbols) = da3d9c627b71d79bdd38ffd8804edd990ee4b652
-SHA1 (patch-ada_s-oscons-tmplt.c) = dce4ceb3359e323ece8bee637c60ce53b14b5ab0
-SHA1 (patch-ada_s-osinte__netbsd.adb) = 8316d58c868e977d50cd1e5409ed52956c5d6ed9
-SHA1 (patch-ada_s-osinte__netbsd.ads) = 33fa950179a4356c0a91ccd4dfe9cadbce15b9bf
-SHA1 (patch-ada_s-osprim__posix.adb) = 81ed2c90dde6bfedf244cd897d4da051f5a06670
-SHA1 (patch-ada_s-taprop__posix.adb) = 34f8525d577091322b49e4effa24de62059d22d4
-SHA1 (patch-ada_sysdep.c) = d77db0600b77668bb754c9bb9dd3a5fab4962fb7
 SHA1 (patch-contrib_download__prerequisites) = 9cdcde21ab174052911447d20762ddfd40aa8791
 SHA1 (patch-fixincludes_inclhack.def) = 7b00974d3f52a8364190a607f52a5d7e8a6db41a
 SHA1 (patch-gcc_Makefile.in) = c0f97c75ba1d37eae894141edd58bb36b734f651
-SHA1 (patch-gcc_config.gcc) = 6523fd234687e13abd54009a770f1c0acbcd62c7
+SHA1 (patch-gcc_ada_Makefile.rtl) = 1b6a18dce5ffe752be942f6e328d487692f3b33a
+SHA1 (patch-gcc_ada_adaint.c) = 465b3e3d6db193b2729f1d4e1c74eefcc3dc85bf
+SHA1 (patch-gcc_ada_adaint.h) = 57befa67b18f97345db05672f1e53e8ec70e1935
+SHA1 (patch-gcc_ada_cstreams.c) = 047746f1da085917082dafe8b87fdc5e757e1237
+SHA1 (patch-gcc_ada_libgnarl_s-osinte____netbsd.adb) = 84268061686b15a8ef9013242e3d258b82b9f13e
+SHA1 (patch-gcc_ada_libgnarl_s-osinte____netbsd.ads) = 2d1179230289a243bb004b9f16c747cda9761b60
+SHA1 (patch-gcc_ada_libgnarl_s-taprop____posix.adb) = 505d0ba78a21a8a6cc6213a9809c44c284fe2334
+SHA1 (patch-gcc_ada_libgnat_g-socthi.ads) = e2fbc2589814aa630165d3cf4ddc15baf9dce1c9
+SHA1 (patch-gcc_ada_libgnat_g-socthi____bsd.adb) = cbc8aca2b0be1c183cffb0a93091a95b35d78abd
+SHA1 (patch-gcc_ada_libgnat_s-osprim____posix.adb) = 018dce870dd06febeb83719149f10e469c4bcc00
+SHA1 (patch-gcc_ada_s-oscons-tmplt.c) = a48b5ae3c061144b8406e27cbbc084385fef5131
+SHA1 (patch-gcc_ada_sysdep.c) = 5b8705680ee1a2c9c2686d14d4cbbba8c5fb4fb2
+SHA1 (patch-gcc_config.gcc) = 4bf07441b6893e9b510f9ad775b4b95aa23e9791
 SHA1 (patch-gcc_config.host) = 8920ce841f6088b365c9b590e3ea9535bd880b40
 SHA1 (patch-gcc_config_aarch64_aarch64-builtins.c) = 87185f5c2e2dbe4195cb19fe6213d2d616d5519b
 SHA1 (patch-gcc_config_aarch64_aarch64-netbsd.h) = abf19e2445bce1773162bddef16cd7f41eb36827
 SHA1 (patch-gcc_config_aarch64_driver-aarch64.c) = 7e17b49924ddd9ff33d049d6539e4df77d14d3e5
+SHA1 (patch-gcc_config_darwin-driver.c) = fd57dcca96ce5ddc330e7c7b3b811f64856d7611
 SHA1 (patch-gcc_config_sparc_sparc.c) = e9cb956f3769642bcd0ba4a477d16c73dea46014
 SHA1 (patch-gcc_configure) = 6a2d8eeeed2bf08c3c81291178e669dc91c913ce
 SHA1 (patch-gcc_ggc-common.c) = 3e325767922ab7d2079fdb9a3d6b6aa531a2fea5
 SHA1 (patch-gcc_lto_lto.c) = 7bd85ac8ade76a28c394f6fbe5d495f91824f79f
 SHA1 (patch-gcc_targhooks.c) = b28d8a9696d07bbfb00b7d8c55193ba99447ff1d
+SHA1 (patch-gnattools_configure) = aa6181ee8723a1199d84acea1331645205b558cc
 SHA1 (patch-isl_configure) = 5523c76d95b229b3cd25461b4c2b7af24bf2534e
 SHA1 (patch-libffi_configure) = 22006b20d7f655e2455a7ad613d676703b6c1ccc
 SHA1 (patch-libffi_testsuite_libffi.call_float2.c) = 27b84a11378fb648dfaad0c70abedd77a0a1c1a8
diff --git a/gcc10-aux/options.mk b/gcc10-aux/options.mk
index 639ed2a40a..ac908c77ae 100644
--- a/gcc10-aux/options.mk
+++ b/gcc10-aux/options.mk
@@ -1,19 +1,11 @@
-# $NetBSD: options.mk,v 1.1 2020/05/10 15:02:44 maya Exp $
+# $NetBSD: options.mk,v 1.2 2021/10/01 11:56:13 nia Exp $
 
 PKG_OPTIONS_VAR=	PKG_OPTIONS.${GCC_PKGNAME}
-
-###
-### MODIFIED BY FERNANDO OLEO BLANCO 13/05/21
-### Added Ada support
-###
-
-PKG_SUPPORTED_OPTIONS=	nls gcc-inplace-math gcc-c++ gcc-fortran \
+PKG_SUPPORTED_OPTIONS=	nls gcc-inplace-math gcc-c++ gcc-fortran gcc-ada \
 			gcc-go gcc-objc gcc-objc++ gcc-graphite \
-			always-libgcc gcc-ada
-PKG_SUGGESTED_OPTIONS=	gcc-ada \
-			gcc-graphite gcc-inplace-math \
-			gcc-c++ gcc-fortran
-			# gcc-objc gcc-objc++ \
+			always-libgcc
+PKG_SUGGESTED_OPTIONS=	gcc-ada gcc-c++ gcc-fortran \
+			gcc-graphite gcc-inplace-math
 
 .if ${OPSYS} == "NetBSD"
 PKG_SUGGESTED_OPTIONS+=	nls
@@ -134,10 +126,13 @@ DISTFILES+=		${ISL16}.tar.bz2
 
 ###
 ### Optional languages
-### Ada could be added although there is a bootstrapping issue.  See
-### ../gcc34-ada for guidance
 ###
 
+.if !empty(PKG_OPTIONS:Mgcc-ada)
+LANGS+=			ada
+USE_TOOLS+=		perl
+.endif
+
 .if !empty(PKG_OPTIONS:Mgcc-objc++)
 .  if empty(PKG_OPTIONS:Mgcc-c++)
 PKG_OPTIONS+=		gcc-c++
@@ -160,10 +155,6 @@ LANGS+=			go
 LANGS+=			fortran
 .endif
 
-.if !empty(PKG_OPTIONS:Mgcc-ada)
-LANGS+=			ada
-.endif
-
 .if !empty(PKG_OPTIONS:Mgcc-c++)
 LANGS+=			c++
 USE_TOOLS+=		perl
diff --git a/gcc10-aux/patches/patch-ada_adaint.c b/gcc10-aux/patches/patch-ada_adaint.c
deleted file mode 100644
index 81784fe990..0000000000
--- a/gcc10-aux/patches/patch-ada_adaint.c
+++ /dev/null
@@ -1,82 +0,0 @@
---- gcc/ada/adaint.c.orig	2021-04-08 13:56:27.725736525 +0200
-+++ gcc/ada/adaint.c	2021-10-09 17:27:52.413919872 +0200
-@@ -817,7 +817,8 @@
- }
- 
- #if defined (_WIN32) || defined (__linux__) || defined (__sun__) \
--  || defined (__FreeBSD__) || defined(__DragonFly__) || defined (__QNX__)
-+  || defined (__FreeBSD__) || defined(__DragonFly__) || defined (__QNX__) \
-+  || defined (__NetBSD__)
- #define HAS_TARGET_WCHAR_T
- #endif
- 
-@@ -3544,6 +3545,69 @@
-   */
- }
- 
-+#if defined(__NetBSD__)
-+/* It's 2021, and NetBSD still doesn't use symbol versioning in their
-+ * libraries.  They mimic this by having header macros rename the function
-+ * at compile time.  If we don't wrap the functions, the osinte specification
-+ * for NetBSD would need to import e.g. __sigaltstack14 instead of sigaltstack.
-+ * By wrapping, new versions won't break gnat.
-+ */
-+int
-+__gnat_sigemptyset (sigset_t *set) {
-+   return sigemptyset (set);
-+}
-+int
-+__gnat_sigfillset (sigset_t *set) {
-+   return sigfillset (set);
-+}
-+int
-+__gnat_sigaddset (sigset_t *set, int signo) {
-+   return sigaddset (set, signo);
-+}
-+int
-+__gnat_sigdelset (sigset_t *set, int signo) {
-+   return sigdelset (set, signo);
-+}
-+int
-+__gnat_sigismember (sigset_t *set, int signo) {
-+   return sigismember (set, signo);
-+}
-+int
-+__gnat_sigaltstack (const stack_t *ss, stack_t *oss) {
-+   return sigaltstack (ss, oss);
-+}
-+int
-+__gnat_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) {
-+   return sigaction (sig, act, oact);
-+}
-+int
-+__gnat_clock_getres (clockid_t clock_id, struct timespec *res) {
-+   return clock_getres (clock_id, res);
-+}
-+int
-+__gnat_clock_gettime (clockid_t clock_id, struct timespec *tp) {
-+   return clock_gettime (clock_id, tp);
-+}
-+#endif
-+int
-+__gnat_nanosleep (const struct timespec *rqtp, struct timespec *rmtp) {
-+   return nanosleep (rqtp, rmtp);
-+}
-+int
-+__gnat_gettimeofday (struct timeval * tp, void * tzp) {
-+   return gettimeofday (tp, tzp);
-+}
-+
-+int
-+__gnat_select(int nfds, fd_set * readfds, fd_set * writefds,
-+              fd_set * exceptfds, struct timeval * timeout) {
-+   return select (nfds, readfds, writefds, exceptfds, timeout);
-+}
-+int
-+__gnat_socket (int domain, int type, int protocol) {
-+   return socket (domain, type, protocol);
-+}
-+
- #ifdef __cplusplus
- }
- #endif
diff --git a/gcc10-aux/patches/patch-ada_adaint.h b/gcc10-aux/patches/patch-ada_adaint.h
deleted file mode 100644
index 7717a8d649..0000000000
--- a/gcc10-aux/patches/patch-ada_adaint.h
+++ /dev/null
@@ -1,31 +0,0 @@
---- gcc/ada/adaint.h.orig	2021-10-09 19:21:39.117755578 +0200
-+++ gcc/ada/adaint.h	2021-10-09 19:02:38.871872061 +0200
-@@ -345,6 +345,28 @@
- 
- extern const void * __gnat_get_executable_load_address  (void);
- 
-+#if defined(__NetBSD__)
-+#include <signal.h>
-+extern int    __gnat_sigemptyset (sigset_t *);
-+extern int    __gnat_sigfillset  (sigset_t *);
-+extern int    __gnat_sigaddset   (sigset_t *, int);
-+extern int    __gnat_sigdelset   (sigset_t *, int);
-+extern int    __gnat_sigismember (sigset_t *, int);
-+extern int    __gnat_sigaltstack (const stack_t *, stack_t *);
-+extern int    __gnat_sigaction   (int, const struct sigaction *, struct sigaction *);
-+#endif
-+#include <time.h>
-+extern int    __gnat_nanosleep     (const struct timespec *, struct timespec *);
-+extern int    __gnat_gettimeofday  (struct timeval *, void *);
-+#include <sys/select.h>
-+extern int    __gnat_select        (int, fd_set *, fd_set *, fd_set *, struct timeval *);
-+#include <sys/socket.h>
-+extern int    __gnat_socket        (int, int, int);
-+#if defined(__NetBSD__)
-+extern int    __gnat_clock_getres  (clockid_t, struct timespec *);
-+extern int    __gnat_clock_gettime (clockid_t, struct timespec *);
-+#endif
-+
- #ifdef __cplusplus
- }
- #endif
diff --git a/gcc10-aux/patches/patch-ada_configure b/gcc10-aux/patches/patch-ada_configure
deleted file mode 100644
index f903276e38..0000000000
--- a/gcc10-aux/patches/patch-ada_configure
+++ /dev/null
@@ -1,14 +0,0 @@
---- gnattools/configure.orig	2021-08-28 14:19:25.404806918 +0000
-+++ gnattools/configure	2021-08-28 14:25:51.208977452 +0000
-@@ -2079,6 +2079,11 @@
-     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
-     indepsw.adb<indepsw-gnu.adb"
-     ;;
-+  *-*-netbsd*)
-+    TOOLS_TARGET_PAIRS="\
-+    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
-+    indepsw.adb<indepsw-gnu.adb"
-+    ;;
-   *-*-linux*)
-     TOOLS_TARGET_PAIRS="\
-     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
diff --git a/gcc10-aux/patches/patch-ada_configure.ac b/gcc10-aux/patches/patch-ada_configure.ac
deleted file mode 100644
index 609156c5db..0000000000
--- a/gcc10-aux/patches/patch-ada_configure.ac
+++ /dev/null
@@ -1,14 +0,0 @@
---- gnattools/configure.ac.orig	2021-08-28 14:58:27.669166093 +0000
-+++ gnattools/configure.ac	2021-08-28 14:59:57.168648867 +0000
-@@ -80,6 +80,11 @@
-     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
-     indepsw.adb<indepsw-gnu.adb"
-     ;;
-+  *-*-netbsd*)
-+    TOOLS_TARGET_PAIRS="\
-+    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
-+    indepsw.adb<indepsw-gnu.adb"
-+    ;;
-   *-*-linux*)
-     TOOLS_TARGET_PAIRS="\
-     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
diff --git a/gcc10-aux/patches/patch-ada_cstreams.c b/gcc10-aux/patches/patch-ada_cstreams.c
deleted file mode 100644
index 9132500455..0000000000
--- a/gcc10-aux/patches/patch-ada_cstreams.c
+++ /dev/null
@@ -1,21 +0,0 @@
---- gcc/ada/cstreams.c.orig	2021-08-28 18:42:21.323680378 +0000
-+++ gcc/ada/cstreams.c	2021-08-28 18:43:48.045445919 +0000
-@@ -188,7 +188,8 @@
- 	  *p = '\\';
-     }
- 
--#elif defined (__FreeBSD__) || defined (__DragonFly__) || defined (__OpenBSD__)
-+#elif defined (__FreeBSD__) || defined (__DragonFly__) \
-+  || defined (__OpenBSD__) || defined (__NetBSD__)
- 
-   /* Use realpath function which resolves links and references to . and ..
-      on those Unix systems that support it. Note that GNU/Linux provides it but
-@@ -270,7 +271,7 @@
- }
- 
- #elif defined (__linux__) || defined (__sun__) || defined (__FreeBSD__) \
--  || defined (__APPLE__)
-+  || defined (__APPLE__) || defined (__NetBSD__)
- /* section for platforms having ftello/fseeko */
- 
- __int64
diff --git a/gcc10-aux/patches/patch-ada_g-socthi.ads b/gcc10-aux/patches/patch-ada_g-socthi.ads
deleted file mode 100644
index 4d07d2dcf3..0000000000
--- a/gcc10-aux/patches/patch-ada_g-socthi.ads
+++ /dev/null
@@ -1,20 +0,0 @@
---- gcc/ada/libgnat/g-socthi.ads.orig	2021-10-09 18:09:40.607907149 +0200
-+++ gcc/ada/libgnat/g-socthi.ads	2021-10-09 18:24:39.373733909 +0200
-@@ -53,8 +53,6 @@
- 
-    package C renames Interfaces.C;
- 
--   use type System.CRTL.ssize_t;
--
-    function Socket_Errno return Integer renames GNAT.OS_Lib.Errno;
-    --  Returns last socket error number
- 
-@@ -256,7 +254,7 @@
-    pragma Import (C, C_Getsockname, "getsockname");
-    pragma Import (C, C_Getsockopt, "getsockopt");
-    pragma Import (C, C_Listen, "listen");
--   pragma Import (C, C_Select, "select");
-+   pragma Import (C, C_Select, "__gnat_select");
-    pragma Import (C, C_Setsockopt, "setsockopt");
-    pragma Import (C, C_Shutdown, "shutdown");
-    pragma Import (C, C_Socketpair, "socketpair");
diff --git a/gcc10-aux/patches/patch-ada_g-socthi__bsd.adb b/gcc10-aux/patches/patch-ada_g-socthi__bsd.adb
deleted file mode 100644
index b60547ff38..0000000000
--- a/gcc10-aux/patches/patch-ada_g-socthi__bsd.adb
+++ /dev/null
@@ -1,359 +0,0 @@
---- /dev/null	2021-10-09 18:50:23.845256363 +0200
-+++ gcc/ada/libgnat/g-socthi__bsd.adb	2021-10-09 18:07:08.069557825 +0200
-@@ -0,0 +1,356 @@
-+------------------------------------------------------------------------------
-+--                                                                          --
-+--                         GNAT COMPILER COMPONENTS                         --
-+--                                                                          --
-+--                    G N A T . S O C K E T S . T H I N                     --
-+--                                                                          --
-+--                                 B o d y                                  --
-+--                                                                          --
-+--                     Copyright (C) 2001-2018, AdaCore                     --
-+--                                                                          --
-+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
-+-- terms of the  GNU General Public License as published  by the Free Soft- --
-+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
-+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
-+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
-+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
-+--                                                                          --
-+-- As a special exception under Section 7 of GPL version 3, you are granted --
-+-- additional permissions described in the GCC Runtime Library Exception,   --
-+-- version 3.1, as published by the Free Software Foundation.               --
-+--                                                                          --
-+-- You should have received a copy of the GNU General Public License and    --
-+-- a copy of the GCC Runtime Library Exception along with this program;     --
-+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
-+-- <http://www.gnu.org/licenses/>.                                          --
-+--                                                                          --
-+-- GNAT was originally developed  by the GNAT team at  New York University. --
-+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
-+--                                                                          --
-+------------------------------------------------------------------------------
-+
-+--  This package provides a target dependent thin interface to the sockets
-+--  layer for use by the GNAT.Sockets package (g-socket.ads). This package
-+--  should not be directly with'ed by an applications program.
-+
-+--  This is the *BSD version which uses fcntl rather than ioctl
-+--  The constant SCON.Thread_Blocking_IO is always true (for all platforms, not
-+--  just *BSD), so this binding is significantly simpler than the standard
-+--  one it replaces.
-+
-+with GNAT.OS_Lib; use GNAT.OS_Lib;
-+
-+with Interfaces.C; use Interfaces.C;
-+
-+package body GNAT.Sockets.Thin is
-+
-+   function Syscall_Accept
-+     (S       : C.int;
-+      Addr    : System.Address;
-+      Addrlen : not null access C.int) return C.int;
-+   pragma Import (C, Syscall_Accept, "accept");
-+   --  The accept() function accepts a connection on a socket.  An incoming
-+   --  connection is acknowledged and associated with an immediately created
-+   --  socket.  The original socket is returned to the listening state.
-+
-+   function Syscall_Connect
-+     (S       : C.int;
-+      Name    : System.Address;
-+      Namelen : C.int) return C.int;
-+   pragma Import (C, Syscall_Connect, "connect");
-+   --  The connect() system call initiates a connection on a socket.  If the
-+   --  parameter S is of type SOCK_DGRAM then connect() permanently specifies
-+   --  the peer to which datagrams are to be sent.  If S is type SOCK_STREAM
-+   --  then connect() attempts to make a connection with another socket, which
-+   --  is identified by the parameter Name.
-+
-+   function Syscall_Recv
-+     (S     : C.int;
-+      Msg   : System.Address;
-+      Len   : C.int;
-+      Flags : C.int) return C.int;
-+   pragma Import (C, Syscall_Recv, "recv");
-+   --  The recv() function receives a message from a socket.  The call can be
-+   --  used on a connection mode socket or a bound, connectionless socket.  If
-+   --  no messages are available at the socket, the recv() call waits for a
-+   --  message to arrive unless the socket is non-blocking.  If a socket is
-+   --  non-blocking, the call returns a -1 and ERRNO is set to EWOULDBLOCK.
-+
-+   function Syscall_Recvfrom
-+     (S       : C.int;
-+      Msg     : System.Address;
-+      Len     : C.int;
-+      Flags   : C.int;
-+      From    : System.Address;
-+      Fromlen : not null access C.int) return C.int;
-+   pragma Import (C, Syscall_Recvfrom, "recvfrom");
-+   --  The recvfrom() system call receives a message from a socket and captures
-+   --  the address from which the data was sent.  It can be used to receive
-+   --  data on an unconnected socket as well.  If no messages are available,
-+   --  the call waits for a message to arrive on blocking sockets.  For
-+   --  non-blocking sockets without messages, -1 is returned and ERRNO is set
-+   --  to EAGAIN or EWOULDBLOCK.
-+
-+   function Syscall_Recvmsg
-+     (S     : C.int;
-+      Msg   : System.Address;
-+      Flags : C.int) return System.CRTL.ssize_t;
-+   pragma Import (C, Syscall_Recvmsg, "recvmsg");
-+   --  The recvmsg call receives a message from a socket, and can be used to
-+   --  receive data on an unconnected socket as well.  If no messages are
-+   --  available, the call waits for a message to arrive on blocking sockets.
-+   --  For non-blocking sockets without messages, -1 is returned and ERRNO is
-+   --  set to EAGAIN or EWOULDBLOCK.
-+
-+   function Syscall_Sendmsg
-+     (S     : C.int;
-+      Msg   : System.Address;
-+      Flags : C.int) return System.CRTL.ssize_t;
-+   pragma Import (C, Syscall_Sendmsg, "sendmsg");
-+   --  The sendmsg() function sends a message to a socket, and can be used with
-+   --  unconnected sockets as well (the msg is ignored in this case).  The
-+   --  function returns the number of bytes sent when successful, otherwise it
-+   --  returns -1 and ERRNO is set (many possible values).
-+
-+   function Syscall_Sendto
-+     (S     : C.int;
-+      Msg   : System.Address;
-+      Len   : C.int;
-+      Flags : C.int;
-+      To    : System.Address;
-+      Tolen : C.int) return C.int;
-+   pragma Import (C, Syscall_Sendto, "sendto");
-+   --  The sendto() function only works for connected sockets and it initiates
-+   --  the transmission of a message.  A successful call returns the numbers of
-+   --  bytes sent, and a failure returns a -1 and ERRNO is set.
-+
-+   function Syscall_Socket
-+     (Domain   : C.int;
-+      Typ      : C.int;
-+      Protocol : C.int) return C.int;
-+   pragma Import (C, Syscall_Socket, "__gnat_socket");
-+   --  The socket() function is used to create an unbound socket and returns a
-+   --  file descriptor that can be used with other socket functions.  Upon
-+   --  failure, a -1 is returned and ERRNO is set.
-+
-+   procedure Disable_SIGPIPE (S : C.int);
-+   pragma Import (C, Disable_SIGPIPE, "__gnat_disable_sigpipe");
-+
-+   procedure Disable_All_SIGPIPEs;
-+   pragma Import (C, Disable_All_SIGPIPEs, "__gnat_disable_all_sigpipes");
-+   --  Sets the process to ignore all SIGPIPE signals on platforms that
-+   --  don't support Disable_SIGPIPE for particular streams.
-+
-+   function C_Fcntl
-+     (Fd  : C.int;
-+      Cmd : C.int;
-+      Val : C.int) return C.int;
-+   pragma Import (C, C_Fcntl, "fcntl");
-+   --  The ioctl of 64-bit DragonFlyBSD, OpenBSD, and NetBSD does not support
-+   --  setting a socket in non-blocking mode.  fcntl must be used instead.
-+
-+   --------------
-+   -- C_Accept --
-+   --------------
-+
-+   function C_Accept
-+     (S       : C.int;
-+      Addr    : System.Address;
-+      Addrlen : not null access C.int) return C.int
-+   is
-+      R : constant C.int := Syscall_Accept (S, Addr, Addrlen);
-+   begin
-+
-+      Disable_SIGPIPE (R);
-+      return R;
-+   end C_Accept;
-+
-+   ---------------
-+   -- C_Connect --
-+   ---------------
-+
-+   function C_Connect
-+     (S       : C.int;
-+      Name    : System.Address;
-+      Namelen : C.int) return C.int
-+   is
-+   begin
-+      return Syscall_Connect (S, Name, Namelen);
-+   end C_Connect;
-+
-+   ------------------
-+   -- Socket_Ioctl --
-+   ------------------
-+
-+   function Socket_Ioctl
-+     (S   : C.int;
-+      Req : SOSC.IOCTL_Req_T;
-+      Arg : access C.int) return C.int
-+   is
-+   begin
-+      if Req = SOSC.FIONBIO then
-+         declare
-+            use Interfaces;
-+            flags    : constant Unsigned_32 :=
-+                                Unsigned_32 (C_Fcntl (S, SOSC.F_GETFL, 0));
-+            nonblock : constant Unsigned_32 := Unsigned_32 (SOSC.O_NDELAY);
-+            enabled  : constant Boolean := Arg.all = 1;
-+            newval   : C.int := C.int (flags);
-+         begin
-+            if enabled then
-+               newval := C.int (flags or nonblock);
-+            elsif (flags and nonblock) > 0 then
-+               newval := C.int (flags - nonblock);
-+            end if;
-+            return C_Fcntl (Fd => S, Cmd => SOSC.F_SETFL, Val => newval);
-+         end;
-+      end if;
-+
-+      return C_Ioctl (S, Req, Arg);
-+   end Socket_Ioctl;
-+
-+   ------------
-+   -- C_Recv --
-+   ------------
-+
-+   function C_Recv
-+     (S     : C.int;
-+      Msg   : System.Address;
-+      Len   : C.int;
-+      Flags : C.int) return C.int
-+   is
-+   begin
-+      return Syscall_Recv (S, Msg, Len, Flags);
-+   end C_Recv;
-+
-+   ----------------
-+   -- C_Recvfrom --
-+   ----------------
-+
-+   function C_Recvfrom
-+     (S       : C.int;
-+      Msg     : System.Address;
-+      Len     : C.int;
-+      Flags   : C.int;
-+      From    : System.Address;
-+      Fromlen : not null access C.int) return C.int
-+   is
-+   begin
-+      return Syscall_Recvfrom (S, Msg, Len, Flags, From, Fromlen);
-+   end C_Recvfrom;
-+
-+   ---------------
-+   -- C_Recvmsg --
-+   ---------------
-+
-+   function C_Recvmsg
-+     (S     : C.int;
-+      Msg   : System.Address;
-+      Flags : C.int) return System.CRTL.ssize_t
-+   is
-+   begin
-+      return Syscall_Recvmsg (S, Msg, Flags);
-+   end C_Recvmsg;
-+
-+   ---------------
-+   -- C_Sendmsg --
-+   ---------------
-+
-+   function C_Sendmsg
-+     (S     : C.int;
-+      Msg   : System.Address;
-+      Flags : C.int) return System.CRTL.ssize_t
-+   is
-+   begin
-+      return Syscall_Sendmsg (S, Msg, Flags);
-+   end C_Sendmsg;
-+
-+   --------------
-+   -- C_Sendto --
-+   --------------
-+
-+   function C_Sendto
-+     (S     : C.int;
-+      Msg   : System.Address;
-+      Len   : C.int;
-+      Flags : C.int;
-+      To    : System.Address;
-+      Tolen : C.int) return C.int
-+   is
-+   begin
-+      return Syscall_Sendto (S, Msg, Len, Flags, To, Tolen);
-+   end C_Sendto;
-+
-+   --------------
-+   -- C_Socket --
-+   --------------
-+
-+   function C_Socket
-+     (Domain   : C.int;
-+      Typ      : C.int;
-+      Protocol : C.int) return C.int
-+   is
-+      R : constant C.int := Syscall_Socket (Domain, Typ, Protocol);
-+   begin
-+      Disable_SIGPIPE (R);
-+      return R;
-+   end C_Socket;
-+
-+   --------------
-+   -- Finalize --
-+   --------------
-+
-+   procedure Finalize is
-+   begin
-+      null;
-+   end Finalize;
-+
-+   -------------------------
-+   -- Host_Error_Messages --
-+   -------------------------
-+
-+   package body Host_Error_Messages is separate;
-+
-+   ----------------
-+   -- Initialize --
-+   ----------------
-+
-+   procedure Initialize is
-+   begin
-+      Disable_All_SIGPIPEs;
-+   end Initialize;
-+
-+   --------------------
-+   -- Signalling_Fds --
-+   --------------------
-+
-+   package body Signalling_Fds is
-+
-+      --  In this default implementation, we use a C version of these
-+      --  subprograms provided by socket.c.
-+
-+      function C_Create (Fds : not null access Fd_Pair) return C.int;
-+      function C_Read (Rsig : C.int) return C.int;
-+      function C_Write (Wsig : C.int) return C.int;
-+      procedure C_Close (Sig : C.int);
-+
-+      pragma Import (C, C_Create, "__gnat_create_signalling_fds");
-+      pragma Import (C, C_Read,   "__gnat_read_signalling_fd");
-+      pragma Import (C, C_Write,  "__gnat_write_signalling_fd");
-+      pragma Import (C, C_Close,  "__gnat_close_signalling_fd");
-+
-+      function Create
-+        (Fds : not null access Fd_Pair) return C.int renames C_Create;
-+      function Read (Rsig : C.int) return C.int renames C_Read;
-+      function Write (Wsig : C.int) return C.int renames C_Write;
-+      procedure Close (Sig : C.int) renames C_Close;
-+
-+   end Signalling_Fds;
-+
-+   --------------------------
-+   -- Socket_Error_Message --
-+   --------------------------
-+
-+   function Socket_Error_Message (Errno : Integer) return String is separate;
-+
-+end GNAT.Sockets.Thin;
diff --git a/gcc10-aux/patches/patch-ada_makefile.rtl b/gcc10-aux/patches/patch-ada_makefile.rtl
deleted file mode 100644
index e29cb8c144..0000000000
--- a/gcc10-aux/patches/patch-ada_makefile.rtl
+++ /dev/null
@@ -1,143 +0,0 @@
---- gcc/ada/Makefile.rtl.orig	2021-04-08 13:56:27.725736525 +0200
-+++ gcc/ada/Makefile.rtl	2021-10-09 18:43:45.974586137 +0200
-@@ -1739,6 +1739,131 @@
-   MISCLIB = -lutil
- endif
- 
-+# x86 NetBSD
-+ifeq ($(strip $(filter-out %86 netbsd%,$(target_cpu) $(target_os))),)
-+  LIBGNAT_TARGET_PAIRS = \
-+  a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
-+  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
-+  s-intman.adb<libgnarl/s-intman__posix.adb \
-+  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
-+  s-osinte.adb<libgnarl/s-osinte__netbsd.adb \
-+  s-osinte.ads<libgnarl/s-osinte__netbsd.ads \
-+  s-osprim.adb<libgnat/s-osprim__posix.adb \
-+  s-taprop.adb<libgnarl/s-taprop__posix.adb \
-+  s-taspri.ads<libgnarl/s-taspri__posix.ads \
-+  s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
-+  g-socthi.adb<libgnat/g-socthi__bsd.adb \
-+  $(TRASYM_DWARF_UNIX_PAIRS) \
-+  $(ATOMICS_TARGET_PAIRS) \
-+  $(X86_64_TARGET_PAIRS) \
-+  system.ads<libgnat/system-freebsd.ads
-+
-+  GNATLIB_SHARED = gnatlib-shared-dual
-+
-+  EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
-+  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
-+
-+  EH_MECHANISM=-gcc
-+  THREADSLIB= -lpthread -lrt
-+  GMEM_LIB = gmemlib
-+  LIBRARY_VERSION := $(LIB_VERSION)
-+  MISCLIB = -lutil
-+endif
-+
-+
-+# x86-64 NetBSD
-+ifeq ($(strip $(filter-out %86_64 netbsd%,$(target_cpu) $(target_os))),)
-+  LIBGNAT_TARGET_PAIRS = \
-+  a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
-+  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
-+  s-intman.adb<libgnarl/s-intman__posix.adb \
-+  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
-+  s-osinte.adb<libgnarl/s-osinte__netbsd.adb \
-+  s-osinte.ads<libgnarl/s-osinte__netbsd.ads \
-+  s-osprim.adb<libgnat/s-osprim__posix.adb \
-+  s-taprop.adb<libgnarl/s-taprop__posix.adb \
-+  s-taspri.ads<libgnarl/s-taspri__posix.ads \
-+  s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
-+  g-socthi.adb<libgnat/g-socthi__bsd.adb \
-+  $(TRASYM_DWARF_UNIX_PAIRS) \
-+  $(ATOMICS_TARGET_PAIRS) \
-+  $(X86_64_TARGET_PAIRS) \
-+  system.ads<libgnat/system-freebsd.ads
-+
-+  GNATLIB_SHARED = gnatlib-shared-dual
-+
-+  EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
-+  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
-+
-+  EH_MECHANISM=-gcc
-+  THREADSLIB= -lpthread -lrt
-+  GMEM_LIB = gmemlib
-+  LIBRARY_VERSION := $(LIB_VERSION)
-+  MISCLIB = -lutil
-+endif
-+
-+# arm NetBSD
-+ifeq ($(strip $(filter-out %arm netbsd%,$(target_cpu) $(target_os))),)
-+  LIBGNAT_TARGET_PAIRS = \
-+  a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
-+  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
-+  s-intman.adb<libgnarl/s-intman__posix.adb \
-+  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
-+  s-osinte.adb<libgnarl/s-osinte__netbsd.adb \
-+  s-osinte.ads<libgnarl/s-osinte__netbsd.ads \
-+  s-osprim.adb<libgnat/s-osprim__posix.adb \
-+  s-taprop.adb<libgnarl/s-taprop__posix.adb \
-+  s-taspri.ads<libgnarl/s-taspri__posix.ads \
-+  s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
-+  g-socthi.adb<libgnat/g-socthi__bsd.adb \
-+  $(TRASYM_DWARF_UNIX_PAIRS) \
-+  $(ATOMICS_TARGET_PAIRS) \
-+  $(X86_64_TARGET_PAIRS) \
-+  system.ads<libgnat/system-freebsd.ads
-+
-+  GNATLIB_SHARED = gnatlib-shared-dual
-+
-+  EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
-+  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
-+
-+  EH_MECHANISM=-gcc
-+  THREADSLIB= -lpthread -lrt
-+  GMEM_LIB = gmemlib
-+  LIBRARY_VERSION := $(LIB_VERSION)
-+  MISCLIB = -lutil
-+endif
-+
-+# aarch64 NetBSD
-+ifeq ($(strip $(filter-out %aarch64 netbsd%,$(target_cpu) $(target_os))),)
-+  LIBGNAT_TARGET_PAIRS = \
-+  a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
-+  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
-+  s-intman.adb<libgnarl/s-intman__posix.adb \
-+  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
-+  s-osinte.adb<libgnarl/s-osinte__netbsd.adb \
-+  s-osinte.ads<libgnarl/s-osinte__netbsd.ads \
-+  s-osprim.adb<libgnat/s-osprim__posix.adb \
-+  s-taprop.adb<libgnarl/s-taprop__posix.adb \
-+  s-taspri.ads<libgnarl/s-taspri__posix.ads \
-+  s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
-+  g-socthi.adb<libgnat/g-socthi__bsd.adb \
-+  $(TRASYM_DWARF_UNIX_PAIRS) \
-+  $(ATOMICS_TARGET_PAIRS) \
-+  $(X86_64_TARGET_PAIRS) \
-+  system.ads<libgnat/system-freebsd.ads
-+
-+  GNATLIB_SHARED = gnatlib-shared-dual
-+
-+  EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
-+  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
-+
-+  EH_MECHANISM=-gcc
-+  THREADSLIB= -lpthread -lrt
-+  GMEM_LIB = gmemlib
-+  LIBRARY_VERSION := $(LIB_VERSION)
-+  MISCLIB = -lutil
-+endif
-+
- # x86-64 DragonFly
- ifeq ($(strip $(filter-out %86_64 dragonfly%,$(target_cpu) $(target_os))),)
-   LIBGNAT_TARGET_PAIRS = \
-@@ -2502,7 +2627,7 @@
-       s-osprim.adb<libgnat/s-osprim__darwin.adb \
-       $(ATOMICS_TARGET_PAIRS) \
-       system.ads<libgnat/system-darwin-x86.ads
--
-+p
-     ifeq ($(strip $(MULTISUBDIR)),/x86_64)
-       SO_OPTS += -m64
-       LIBGNAT_TARGET_PAIRS += $(X86_64_TARGET_PAIRS)
diff --git a/gcc10-aux/patches/patch-ada_netbsd-symbols b/gcc10-aux/patches/patch-ada_netbsd-symbols
deleted file mode 100644
index 9a7aa703c3..0000000000
--- a/gcc10-aux/patches/patch-ada_netbsd-symbols
+++ /dev/null
@@ -1,20 +0,0 @@
---- gcc/ada/libgnat/s-osprim__posix.adb.orig	2021-08-30 15:32:58.056688539 +0000
-+++ gcc/ada/libgnat/s-osprim__posix.adb	2021-08-30 15:35:17.972574099 +0000
-@@ -47,7 +47,7 @@
-    pragma Convention (C, timespec);
- 
-    function nanosleep (rqtp, rmtp : not null access timespec) return Integer;
--   pragma Import (C, nanosleep, "nanosleep");
-+   pragma Import (C, nanosleep, "__nanosleep50");
- 
-    -----------
-    -- Clock --
-@@ -77,7 +77,7 @@
-       function gettimeofday
-         (Tv : access timeval;
-          Tz : System.Address := System.Null_Address) return Integer;
--      pragma Import (C, gettimeofday, "gettimeofday");
-+      pragma Import (C, gettimeofday, "__gettimeofday50");
- 
-    begin
-       --  The return codes for gettimeofday are as follows (from man pages):
diff --git a/gcc10-aux/patches/patch-ada_s-oscons-tmplt.c b/gcc10-aux/patches/patch-ada_s-oscons-tmplt.c
deleted file mode 100644
index c1d7809d83..0000000000
--- a/gcc10-aux/patches/patch-ada_s-oscons-tmplt.c
+++ /dev/null
@@ -1,89 +0,0 @@
---- gcc/ada/s-oscons-tmplt.c.orig	2021-04-08 13:56:27.913738795 +0200
-+++ gcc/ada/s-oscons-tmplt.c	2021-10-09 18:26:07.630440685 +0200
-@@ -86,16 +86,25 @@
-  ** a number of non-POSIX but useful/required features.
-  **/
- 
--#if defined (__linux__) || defined (__ANDROID__)
-+#if defined (__linux__) || defined (__ANDROID__) \
-+  || defined (__FreeBSD__) || defined (__NetBSD__) \
-+  || defined (__DragonFly__) || defined (__OpenBSD__)
- 
- /* Define _XOPEN_SOURCE to get IOV_MAX */
-+/* We use 520 since NetBSD does not include getaddrinfo flags with only 500 */
- # if !defined (_XOPEN_SOURCE)
--#  define _XOPEN_SOURCE 500
-+#  define _XOPEN_SOURCE 520
- # endif
- 
- /* Define _BSD_SOURCE to get CRTSCTS */
- # define _BSD_SOURCE
- 
-+/* NetBSD requires _NETBSD_SOURCE to be defined in order to include */
-+/* NI_MAX{HOST,SERV} correctly */
-+# if defined (__NetBSD__)
-+#  define _NETBSD_SOURCE
-+# endif
-+
- #endif /* defined (__linux__) */
- 
- /* Include gsocket.h before any system header so it can redefine FD_SETSIZE */
-@@ -158,7 +167,8 @@
- #endif
- 
- #if defined (__linux__) || defined (__ANDROID__) || defined (__QNX__) \
--  || defined (__rtems__)
-+  || defined (__rtems__) || defined (__FreeBSD__) || defined (__NetBSD__) \
-+  || defined (__OpenBSD__) || defined (__DragonFly__)
- # include <pthread.h>
- # include <signal.h>
- #endif
-@@ -406,11 +416,14 @@
- 
- */
- 
--/* ioctl(2) requests are "int" in UNIX, but "unsigned long" on FreeBSD */
-+/* ioctl(2) requests are "int" in UNIX, but "unsigned long" on FreeBSD
-+   and NetBSD
-+*/
- 
--#if defined (__FreeBSD__) || defined (__DragonFly__)
-+#if defined (__FreeBSD__) || defined (__DragonFly__) || defined (__NetBSD__) \
-+  || defined (__OpenBSD__)
- # define CNI CNU
--# define IOCTL_Req_T "Interfaces.C.unsigned"
-+# define IOCTL_Req_T "Interfaces.C.unsigned_long"
- #else
- # define CNI CND
- # define IOCTL_Req_T "Interfaces.C.int"
-@@ -1020,7 +1033,8 @@
- 
- */
- 
--#if defined (__FreeBSD__) || defined (__linux__) || defined (__DragonFly__)
-+#if defined (__FreeBSD__) || defined (__linux__) || defined (__DragonFly__) \
-+  || defined (__NetBSD__) || defined (__OpenBSD__)
- # define PTY_Library "-lutil"
- #else
- # define PTY_Library ""
-@@ -1833,7 +1847,8 @@
- 
- #if defined(__linux__) || defined(__FreeBSD__) \
-  || (defined(_AIX) && defined(_AIXVERSION_530)) \
-- || defined(__DragonFly__) || defined(__QNX__)
-+ || defined(__DragonFly__) || defined(__QNX__) \
-+ || defined (__NetBSD__) || defined (__OpenBSD__)
- /** On these platforms use system provided monotonic clock instead of
-  ** the default CLOCK_REALTIME. We then need to set up cond var attributes
-  ** appropriately (see thread.c).
-@@ -1855,7 +1870,9 @@
- #endif
- 
- #if defined (__APPLE__) || defined (__linux__) || defined (__ANDROID__) \
--  || defined (__QNX__) || defined (__rtems__) || defined (DUMMY)
-+  || defined (__QNX__) || defined (__rtems__) || defined (DUMMY) \
-+  || defined (__FreeBSD__) || defined (__DragonFly__) \
-+  || defined (__NetBSD__) || defined (__OpenBSD__)
- /*
- 
-    --  Sizes of pthread data types
diff --git a/gcc10-aux/patches/patch-ada_s-osinte__netbsd.adb b/gcc10-aux/patches/patch-ada_s-osinte__netbsd.adb
deleted file mode 100644
index 05a9202d9b..0000000000
--- a/gcc10-aux/patches/patch-ada_s-osinte__netbsd.adb
+++ /dev/null
@@ -1,143 +0,0 @@
---- gcc/ada/libgnarl/s-osinte__netbsd.adb.orig	2021-10-08 11:29:30.470090202 +0200
-+++ gcc/ada/libgnarl/s-osinte__netbsd.adb	2021-10-08 11:29:30.472274837 +0200
-@@ -0,0 +1,140 @@
-+------------------------------------------------------------------------------
-+--                                                                          --
-+--                  GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                --
-+--                                                                          --
-+--                   S Y S T E M . O S _ I N T E R F A C E                  --
-+--                                                                          --
-+--                                   B o d y                                --
-+--                                                                          --
-+--          Copyright (C) 1991-2015, Free Software Foundation, Inc.         --
-+--                                                                          --
-+-- GNARL is free software; you can  redistribute it  and/or modify it under --
-+-- terms of the  GNU General Public License as published  by the Free Soft- --
-+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
-+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
-+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
-+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
-+--                                                                          --
-+-- As a special exception under Section 7 of GPL version 3, you are granted --
-+-- additional permissions described in the GCC Runtime Library Exception,   --
-+-- version 3.1, as published by the Free Software Foundation.               --
-+--                                                                          --
-+-- You should have received a copy of the GNU General Public License and    --
-+-- a copy of the GCC Runtime Library Exception along with this program;     --
-+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
-+-- <http://www.gnu.org/licenses/>.                                          --
-+--                                                                          --
-+-- GNARL was developed by the GNARL team at Florida State University. It is --
-+-- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
-+-- State University (http://www.gnat.com).                                  --
-+--                                                                          --
-+------------------------------------------------------------------------------
-+
-+--  This is the NetBSD THREADS version of this package
-+
-+with Interfaces.C; use Interfaces.C;
-+
-+package body System.OS_Interface is
-+
-+   -----------
-+   -- Errno --
-+   -----------
-+
-+   function Errno return int is
-+      type int_ptr is access all int;
-+
-+      function internal_errno return int_ptr;
-+      pragma Import (C, internal_errno, "__errno");
-+
-+   begin
-+      return (internal_errno.all);
-+   end Errno;
-+
-+   --------------------
-+   -- Get_Stack_Base --
-+   --------------------
-+
-+   function Get_Stack_Base (thread : pthread_t) return Address is
-+      pragma Unreferenced (thread);
-+   begin
-+      return Null_Address;
-+   end Get_Stack_Base;
-+
-+   ------------------
-+   -- pthread_init --
-+   ------------------
-+
-+   procedure pthread_init is
-+   begin
-+      null;
-+   end pthread_init;
-+
-+   -----------------------------------
-+   -- pthread_mutexattr_setprotocol --
-+   -----------------------------------
-+
-+   function pthread_mutexattr_setprotocol
-+     (attr     : access pthread_mutexattr_t;
-+      protocol : int) return int is
-+      pragma Unreferenced (attr, protocol);
-+   begin
-+      return 0;
-+   end pthread_mutexattr_setprotocol;
-+
-+   --------------------------------------
-+   -- pthread_mutexattr_setprioceiling --
-+   --------------------------------------
-+
-+   function pthread_mutexattr_setprioceiling
-+     (attr     : access pthread_mutexattr_t;
-+      prioceiling : int) return int is
-+      pragma Unreferenced (attr, prioceiling);
-+   begin
-+      return 0;
-+   end pthread_mutexattr_setprioceiling;
-+
-+   -----------------
-+   -- To_Duration --
-+   -----------------
-+
-+   function To_Duration (TS : timespec) return Duration is
-+   begin
-+      return Duration (TS.ts_sec) + Duration (TS.ts_nsec) / 10#1#E9;
-+   end To_Duration;
-+
-+   ------------------------
-+   -- To_Target_Priority --
-+   ------------------------
-+
-+   function To_Target_Priority
-+     (Prio : System.Any_Priority) return Interfaces.C.int
-+   is
-+   begin
-+      return Interfaces.C.int (Prio);
-+   end To_Target_Priority;
-+
-+   -----------------
-+   -- To_Timespec --
-+   -----------------
-+
-+   function To_Timespec (D : Duration) return timespec is
-+      S : time_t;
-+      F : Duration;
-+
-+   begin
-+      S := time_t (Long_Long_Integer (D));
-+      F := D - Duration (S);
-+
-+      --  If F has negative value due to a round-up, adjust for positive F
-+      --  value.
-+
-+      if F < 0.0 then
-+         S := S - 1;
-+         F := F + 1.0;
-+      end if;
-+
-+      return timespec'(ts_sec => S,
-+                       ts_nsec => long (Long_Long_Integer (F * 10#1#E9)));
-+   end To_Timespec;
-+
-+end System.OS_Interface;
diff --git a/gcc10-aux/patches/patch-ada_s-osinte__netbsd.ads b/gcc10-aux/patches/patch-ada_s-osinte__netbsd.ads
deleted file mode 100644
index e40abac3db..0000000000
--- a/gcc10-aux/patches/patch-ada_s-osinte__netbsd.ads
+++ /dev/null
@@ -1,666 +0,0 @@
---- gcc/ada/libgnarl/s-osinte__netbsd.ads.orig	2021-10-08 11:29:30.503927461 +0200
-+++ gcc/ada/libgnarl/s-osinte__netbsd.ads	2021-10-09 18:31:14.947869872 +0200
-@@ -0,0 +1,663 @@
-+------------------------------------------------------------------------------
-+--                                                                          --
-+--                  GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                --
-+--                                                                          --
-+--                   S Y S T E M . O S _ I N T E R F A C E                  --
-+--                                                                          --
-+--                                   S p e c                                --
-+--                                                                          --
-+--             Copyright (C) 1991-1994, Florida State University            --
-+--          Copyright (C) 1995-2015, Free Software Foundation, Inc.         --
-+--                                                                          --
-+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
-+-- terms of the  GNU General Public License as published  by the Free Soft- --
-+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
-+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
-+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
-+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
-+--                                                                          --
-+-- As a special exception under Section 7 of GPL version 3, you are granted --
-+-- additional permissions described in the GCC Runtime Library Exception,   --
-+-- version 3.1, as published by the Free Software Foundation.               --
-+--                                                                          --
-+-- You should have received a copy of the GNU General Public License and    --
-+-- a copy of the GCC Runtime Library Exception along with this program;     --
-+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
-+-- <http://www.gnu.org/licenses/>.                                          --
-+--                                                                          --
-+-- GNARL was developed by the GNARL team at Florida State University. It is --
-+-- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
-+-- State University (http://www.gnat.com).                                  --
-+--                                                                          --
-+------------------------------------------------------------------------------
-+
-+--  This is the NetBSD PTHREADS version of this package.
-+
-+--  This package encapsulates all direct interfaces to OS services
-+--  that are needed by the tasking run-time (libgnarl).
-+
-+--  PLEASE DO NOT add any with-clauses to this package or remove the pragma
-+--  Preelaborate. This package is designed to be a bottom-level (leaf) package.
-+
-+with Ada.Unchecked_Conversion;
-+
-+with Interfaces.C;
-+with System.OS_Constants;
-+
-+package System.OS_Interface is
-+   pragma Preelaborate;
-+
-+   pragma Linker_Options ("-pthread");
-+
-+   subtype int            is Interfaces.C.int;
-+   subtype short          is Interfaces.C.short;
-+   subtype long           is Interfaces.C.long;
-+   subtype unsigned       is Interfaces.C.unsigned;
-+   subtype unsigned_short is Interfaces.C.unsigned_short;
-+   subtype unsigned_long  is Interfaces.C.unsigned_long;
-+   subtype unsigned_char  is Interfaces.C.unsigned_char;
-+   subtype plain_char     is Interfaces.C.plain_char;
-+   subtype size_t         is Interfaces.C.size_t;
-+   subtype char_array     is Interfaces.C.char_array;
-+   subtype int64          is Interfaces.Integer_64;
-+
-+   -----------
-+   -- Errno --
-+   -----------
-+
-+   function Errno return int;
-+   pragma Inline (Errno);
-+
-+   EAGAIN    : constant := 35;
-+   EINTR     : constant := 4;
-+   EINVAL    : constant := 22;
-+   ENOMEM    : constant := 12;
-+   ETIMEDOUT : constant := 60;
-+
-+   -------------
-+   -- Signals --
-+   -------------
-+
-+   Max_Interrupt : constant := 31;
-+   type Signal is new int range 0 .. Max_Interrupt;
-+   for Signal'Size use int'Size;
-+
-+   SIGHUP     : constant := 1; --  hangup
-+   SIGINT     : constant := 2; --  interrupt (rubout)
-+   SIGQUIT    : constant := 3; --  quit (ASCD FS)
-+   SIGILL     : constant := 4; --  illegal instruction (not reset)
-+   SIGTRAP    : constant := 5; --  trace trap (not reset)
-+   SIGIOT     : constant := 6; --  IOT instruction
-+   SIGABRT    : constant := 6; --  used by abort, replace SIGIOT in the  future
-+   SIGEMT     : constant := 7; --  EMT instruction
-+   SIGFPE     : constant := 8; --  floating point exception
-+   SIGKILL    : constant := 9; --  kill (cannot be caught or ignored)
-+   SIGBUS     : constant := 10; --  bus error
-+   SIGSEGV    : constant := 11; --  segmentation violation
-+   SIGSYS     : constant := 12; --  bad argument to system call
-+   SIGPIPE    : constant := 13; --  write on a pipe with no one to read it
-+   SIGALRM    : constant := 14; --  alarm clock
-+   SIGTERM    : constant := 15; --  software termination signal from kill
-+   SIGURG     : constant := 16; --  urgent condition on IO channel
-+   SIGSTOP    : constant := 17; --  stop (cannot be caught or ignored)
-+   SIGTSTP    : constant := 18; --  user stop requested from tty
-+   SIGCONT    : constant := 19; --  stopped process has been continued
-+   SIGCLD     : constant := 20; --  alias for SIGCHLD
-+   SIGCHLD    : constant := 20; --  child status change
-+   SIGTTIN    : constant := 21; --  background tty read attempted
-+   SIGTTOU    : constant := 22; --  background tty write attempted
-+   SIGIO      : constant := 23; --  I/O possible (Solaris SIGPOLL alias)
-+   SIGXCPU    : constant := 24; --  CPU time limit exceeded
-+   SIGXFSZ    : constant := 25; --  filesize limit exceeded
-+   SIGVTALRM  : constant := 26; --  virtual timer expired
-+   SIGPROF    : constant := 27; --  profiling time alarm
-+   SIGWINCH   : constant := 28; --  window size change
-+   SIGINFO    : constant := 29; --  information request (NetBSD/FreeBSD)
-+   SIGUSR1    : constant := 30; --  user defined signal 1
-+   SIGUSR2    : constant := 31; --  user defined signal 2
-+
-+   SIGADAABORT : constant := SIGABRT;
-+   --  Change this if you want to use another signal for task abort.
-+   --  SIGTERM might be a good one.
-+
-+   type Signal_Set is array (Natural range <>) of Signal;
-+
-+   --  Interrupts that must be unmasked at all times.  NetBSD
-+   --  pthreads will not allow an application to mask out any
-+   --  interrupt needed by the threads library.
-+   Unmasked : constant Signal_Set :=
-+     (SIGTRAP, SIGBUS, SIGTTIN, SIGTTOU, SIGTSTP);
-+
-+   --  NetBSD will uses SIGPROF for timing.  Do not allow a
-+   --  handler to attach to this signal.
-+   Reserved : constant Signal_Set := (0 .. 0 => SIGPROF);
-+
-+   type sigset_t is private;
-+
-+   function sigaddset
-+     (set : access sigset_t;
-+      sig : Signal) return int;
-+   pragma Import (C, sigaddset, "__gnat_sigaddset");
-+
-+   function sigdelset
-+     (set : access sigset_t;
-+      sig : Signal) return int;
-+   pragma Import (C, sigdelset, "__gnat_sigdelset");
-+
-+   function sigfillset (set : access sigset_t) return int;
-+   pragma Import (C, sigfillset, "__gnat_sigfillset");
-+
-+   function sigismember
-+     (set : access sigset_t;
-+      sig : Signal) return int;
-+   pragma Import (C, sigismember, "__gnat_sigismember");
-+
-+   function sigemptyset (set : access sigset_t) return int;
-+   pragma Import (C, sigemptyset, "__gnat_sigemptyset");
-+
-+   --  sigcontext is architecture dependent, so define it private
-+   type struct_sigcontext is private;
-+
-+   --  ??? This is the current definition of struct_sigaction
-+   --  as of 2021/10/02 in signal.h
-+   type old_struct_sigaction is record
-+      sa_handler : System.Address;
-+      sa_mask    : sigset_t;
-+      sa_flags   : int;
-+   end record;
-+   pragma Convention (C, old_struct_sigaction);
-+
-+   --  This is an incorrect struct as of 2021/10/02
-+   type new_struct_sigaction is record
-+      sa_handler : System.Address;
-+      sa_flags   : int;
-+      sa_mask    : sigset_t;
-+   end record;
-+   pragma Convention (C, new_struct_sigaction);
-+
-+   --  Corrected to use old_struct_sigaction 2021/10/02
-+   subtype struct_sigaction is old_struct_sigaction;
-+   type struct_sigaction_ptr is access all struct_sigaction;
-+
-+   SIG_BLOCK   : constant := 1;
-+   SIG_UNBLOCK : constant := 2;
-+   SIG_SETMASK : constant := 3;
-+
-+   SIG_DFL  : constant := 0;
-+   SIG_IGN  : constant := 1;
-+   --  Added for completeness
-+   SIG_ERR  : constant := -1;
-+   SIG_HOLD : constant := 3;
-+
-+   SA_SIGINFO : constant := 16#0040#;
-+   SA_ONSTACK : constant := 16#0001#;
-+
-+   function sigaction
-+     (sig  : Signal;
-+      act  : struct_sigaction_ptr;
-+      oact : struct_sigaction_ptr) return int;
-+   pragma Import (C, sigaction, "__gnat_sigaction");
-+
-+   ----------
-+   -- Time --
-+   ----------
-+
-+   Time_Slice_Supported : constant Boolean := True;
-+   --  Indicates whether time slicing is supported (i.e SCHED_RR is supported)
-+
-+   type timespec is private;
-+
-+   function nanosleep (rqtp, rmtp : access timespec) return int;
-+   pragma Import (C, nanosleep, "__gnat_nanosleep");
-+
-+   type clockid_t is new unsigned;
-+
-+   function clock_getres
-+     (clock_id : clockid_t;
-+      res      : access timespec) return int;
-+   pragma Import (C, clock_getres, "__gnat_clock_getres");
-+
-+   function clock_gettime
-+     (clock_id : clockid_t;
-+      tp       : access timespec)
-+      return int;
-+   pragma Import (C, clock_gettime, "__gnat_clock_gettime");
-+
-+   function To_Duration (TS : timespec) return Duration;
-+   pragma Inline (To_Duration);
-+
-+   function To_Timespec (D : Duration) return timespec;
-+   pragma Inline (To_Timespec);
-+
-+   type struct_timezone is record
-+      tz_minuteswest : int;
-+      tz_dsttime     : int;
-+   end record;
-+   pragma Convention (C, struct_timezone);
-+
-+   -------------------------
-+   -- Priority Scheduling --
-+   -------------------------
-+
-+   SCHED_OTHER : constant := 0;
-+   SCHED_FIFO  : constant := 1;
-+   SCHED_RR    : constant := 2;
-+
-+   function To_Target_Priority
-+     (Prio : System.Any_Priority) return Interfaces.C.int;
-+   --  Maps System.Any_Priority to a POSIX priority
-+
-+   -------------
-+   -- Process --
-+   -------------
-+
-+   type pid_t is private;
-+
-+   function kill (pid : pid_t; sig : Signal) return int;
-+   pragma Import (C, kill, "__gnat_kill");
-+
-+   function getpid return pid_t;
-+   pragma Import (C, getpid, "getpid");
-+
-+   ---------
-+   -- LWP --
-+   ---------
-+
-+   function lwp_self return System.Address;
-+   --  lwp_self does not exist on this thread library, revert to pthread_self
-+   --  which is the closest approximation (with getpid). This function is
-+   --  needed to share s-taprop.adb across POSIX-like targets.
-+   pragma Import (C, lwp_self, "pthread_self");
-+
-+   -------------
-+   -- Threads --
-+   -------------
-+
-+   type Thread_Body is access
-+     function (arg : System.Address) return System.Address;
-+   pragma Convention (C, Thread_Body);
-+
-+   function Thread_Body_Access is new
-+     Ada.Unchecked_Conversion (System.Address, Thread_Body);
-+
-+   type pthread_t           is private;
-+   subtype Thread_Id        is pthread_t;
-+
-+   type pthread_mutex_t      is limited private;
-+   type pthread_cond_t       is limited private;
-+   type pthread_attr_t       is limited private;
-+   type pthread_mutexattr_t  is limited private;
-+   type pthread_condattr_t   is limited private;
-+   type pthread_rwlock_t     is limited private;
-+   type pthread_rwlockattr_t is limited private;
-+   type pthread_key_t        is private;
-+
-+   PTHREAD_CREATE_DETACHED : constant := 1;
-+   PTHREAD_CREATE_JOINABLE : constant := 0;
-+
-+   PTHREAD_SCOPE_PROCESS : constant := 0;
-+   PTHREAD_SCOPE_SYSTEM  : constant := 1;
-+
-+   -----------
-+   -- Stack --
-+   -----------
-+
-+   type stack_t is record
-+      ss_sp    : System.Address;
-+      ss_size  : size_t;
-+      ss_flags : int;
-+   end record;
-+   pragma Convention (C, stack_t);
-+
-+   function sigaltstack
-+     (ss  : not null access stack_t;
-+      oss : access stack_t) return int;
-+   pragma Import (C, sigaltstack, "__gnat_sigaltstack");
-+
-+   Alternate_Stack : aliased System.Address;
-+   --  This is a dummy definition, never used (Alternate_Stack_Size is null)
-+
-+   Alternate_Stack_Size : constant := 0;
-+   --  No alternate signal stack is used on this platform
-+
-+   Stack_Base_Available : constant Boolean := False;
-+   --  Indicates whether the stack base is available on this target. This
-+   --  allows us to share s-osinte.adb between all the FSU run time. Note that
-+   --  this value can only be true if pthread_t has a complete definition that
-+   --  corresponds exactly to the C header files.
-+
-+   function Get_Stack_Base (thread : pthread_t) return Address;
-+   pragma Inline (Get_Stack_Base);
-+   --  returns the stack base of the specified thread. Only call this function
-+   --  when Stack_Base_Available is True.
-+
-+   function Get_Page_Size return int;
-+   pragma Import (C, Get_Page_Size, "_getpagesize");
-+   --  Returns the size of a page
-+
-+   PROT_NONE  : constant := 0;
-+   PROT_READ  : constant := 1;
-+   PROT_WRITE : constant := 2;
-+   PROT_EXEC  : constant := 4;
-+   PROT_ALL   : constant := PROT_READ + PROT_WRITE + PROT_EXEC;
-+   PROT_ON    : constant := PROT_NONE;
-+   PROT_OFF   : constant := PROT_ALL;
-+
-+   function mprotect (addr : Address; len : size_t; prot : int) return int;
-+   pragma Import (C, mprotect);
-+
-+   ---------------------------------------
-+   -- Nonstandard Thread Initialization --
-+   ---------------------------------------
-+
-+   --  FSU_THREADS requires pthread_init, which is nonstandard and this should
-+   --  be invoked during the elaboration of s-taprop.adb.
-+
-+   --  NetBSD does not require this so we provide an empty Ada body
-+
-+   procedure pthread_init;
-+
-+   -------------------------
-+   -- POSIX.1c  Section 3 --
-+   -------------------------
-+
-+   function sigwait
-+     (set : access sigset_t;
-+      sig : access Signal) return int;
-+   pragma Import (C, sigwait, "sigwait");
-+
-+   function pthread_kill
-+     (thread : pthread_t;
-+      sig    : Signal) return int;
-+   pragma Import (C, pthread_kill, "pthread_kill");
-+
-+   function pthread_sigmask
-+     (how  : int;
-+      set  : access sigset_t;
-+      oset : access sigset_t) return int;
-+   pragma Import (C, pthread_sigmask, "pthread_sigmask");
-+
-+   --------------------------
-+   -- POSIX.1c  Section 11 --
-+   --------------------------
-+
-+   function pthread_mutexattr_init
-+     (attr : access pthread_mutexattr_t) return int;
-+   pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init");
-+
-+   function pthread_mutexattr_destroy
-+     (attr : access pthread_mutexattr_t) return int;
-+   pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy");
-+
-+   function pthread_mutex_init
-+     (mutex : access pthread_mutex_t;
-+      attr  : access pthread_mutexattr_t) return int;
-+   pragma Import (C, pthread_mutex_init, "pthread_mutex_init");
-+
-+   function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
-+   pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy");
-+
-+   function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
-+   pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock");
-+
-+   function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
-+   pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock");
-+
-+   function pthread_condattr_init
-+     (attr : access pthread_condattr_t) return int;
-+   pragma Import (C, pthread_condattr_init, "pthread_condattr_init");
-+
-+   function pthread_condattr_destroy
-+     (attr : access pthread_condattr_t) return int;
-+   pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy");
-+
-+   function pthread_cond_init
-+     (cond : access pthread_cond_t;
-+      attr : access pthread_condattr_t) return int;
-+   pragma Import (C, pthread_cond_init, "pthread_cond_init");
-+
-+   function pthread_cond_destroy (cond : access pthread_cond_t) return int;
-+   pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy");
-+
-+   function pthread_cond_signal (cond : access pthread_cond_t) return int;
-+   pragma Import (C, pthread_cond_signal, "pthread_cond_signal");
-+
-+   function pthread_cond_wait
-+     (cond  : access pthread_cond_t;
-+      mutex : access pthread_mutex_t) return int;
-+   pragma Import (C, pthread_cond_wait, "pthread_cond_wait");
-+
-+   function pthread_cond_timedwait
-+     (cond    : access pthread_cond_t;
-+      mutex   : access pthread_mutex_t;
-+      abstime : access timespec) return int;
-+   pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait");
-+
-+   Relative_Timed_Wait : constant Boolean := False;
-+   --  pthread_cond_timedwait requires an absolute delay time
-+
-+   --------------------------
-+   -- POSIX.1c  Section 13 --
-+   --------------------------
-+
-+   PTHREAD_PRIO_NONE    : constant := 0;
-+   PTHREAD_PRIO_INHERIT : constant := 1;
-+   PTHREAD_PRIO_PROTECT : constant := 2;
-+
-+   function pthread_mutexattr_setprotocol
-+     (attr     : access pthread_mutexattr_t;
-+      protocol : int) return int;
-+
-+   function pthread_mutexattr_setprioceiling
-+     (attr     : access pthread_mutexattr_t;
-+      prioceiling : int) return int;
-+
-+   type struct_sched_param is record
-+      sched_priority : int;
-+   end record;
-+   pragma Convention (C, struct_sched_param);
-+
-+   function pthread_getschedparam
-+     (thread : pthread_t;
-+      policy : access int;
-+      param  : access struct_sched_param) return int;
-+   pragma Import (C, pthread_getschedparam, "pthread_getschedparam");
-+
-+   function pthread_setschedparam
-+     (thread : pthread_t;
-+      policy : int;
-+      param  : access struct_sched_param) return int;
-+   pragma Import (C, pthread_setschedparam, "pthread_setschedparam");
-+
-+   function pthread_attr_setscope
-+     (attr            : access pthread_attr_t;
-+      contentionscope : int) return int;
-+   pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope");
-+
-+   function pthread_attr_getscope
-+     (attr            : access pthread_attr_t;
-+      contentionscope : access int) return int;
-+   pragma Import (C, pthread_attr_getscope, "pthread_attr_getscope");
-+
-+   function pthread_attr_setinheritsched
-+     (attr            : access pthread_attr_t;
-+      inheritsched : int) return int;
-+   pragma Import
-+     (C, pthread_attr_setinheritsched, "pthread_attr_setinheritsched");
-+
-+   function pthread_attr_getinheritsched
-+     (attr         : access pthread_attr_t;
-+      inheritsched : access int) return int;
-+   pragma Import
-+     (C, pthread_attr_getinheritsched, "pthread_attr_getinheritsched");
-+
-+   function pthread_attr_setschedpolicy
-+     (attr   : access pthread_attr_t;
-+      policy : int) return int;
-+   pragma Import (C, pthread_attr_setschedpolicy,
-+     "pthread_attr_setschedpolicy");
-+
-+   function pthread_attr_getschedpolicy
-+     (attr   : access pthread_attr_t;
-+      policy : access int) return int;
-+   pragma Import (C, pthread_attr_getschedpolicy,
-+     "pthread_attr_getschedpolicy");
-+
-+   function pthread_attr_setschedparam
-+     (attr        : access pthread_attr_t;
-+      sched_param : int) return int;
-+   pragma Import (C, pthread_attr_setschedparam, "pthread_attr_setschedparam");
-+
-+   function pthread_attr_getschedparam
-+     (attr        : access pthread_attr_t;
-+      sched_param : access int) return int;
-+   pragma Import (C, pthread_attr_getschedparam, "pthread_attr_getschedparam");
-+
-+   function sched_yield return int;
-+   pragma Import (C, sched_yield, "sched_yield");
-+
-+   --------------------------
-+   -- P1003.1c  Section 16 --
-+   --------------------------
-+
-+   function pthread_attr_init (attributes : access pthread_attr_t) return int;
-+   pragma Import (C, pthread_attr_init, "pthread_attr_init");
-+
-+   function pthread_attr_destroy
-+     (attributes : access pthread_attr_t) return int;
-+   pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
-+
-+   function pthread_attr_setdetachstate
-+     (attr        : access pthread_attr_t;
-+      detachstate : int) return int;
-+   pragma Import
-+     (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate");
-+
-+   function pthread_attr_getdetachstate
-+     (attr        : access pthread_attr_t;
-+      detachstate : access int) return int;
-+   pragma Import
-+     (C, pthread_attr_getdetachstate, "pthread_attr_getdetachstate");
-+
-+   function pthread_attr_getstacksize
-+     (attr      : access pthread_attr_t;
-+      stacksize : access size_t) return int;
-+   pragma Import
-+     (C, pthread_attr_getstacksize, "pthread_attr_getstacksize");
-+
-+   function pthread_attr_setstacksize
-+     (attr      : access pthread_attr_t;
-+      stacksize : size_t) return int;
-+   pragma Import
-+     (C, pthread_attr_setstacksize, "pthread_attr_setstacksize");
-+
-+   function pthread_create
-+     (thread        : access pthread_t;
-+      attributes    : access pthread_attr_t;
-+      start_routine : Thread_Body;
-+      arg           : System.Address) return int;
-+   pragma Import (C, pthread_create, "pthread_create");
-+
-+   function pthread_detach (thread : pthread_t) return int;
-+   pragma Import (C, pthread_detach, "pthread_detach");
-+
-+   procedure pthread_exit (status : System.Address);
-+   pragma Import (C, pthread_exit, "pthread_exit");
-+
-+   function pthread_self return pthread_t;
-+   pragma Import (C, pthread_self, "pthread_self");
-+
-+   --------------------------
-+   -- POSIX.1c  Section 17 --
-+   --------------------------
-+
-+   function pthread_setspecific
-+     (key   : pthread_key_t;
-+      value : System.Address) return  int;
-+   pragma Import (C, pthread_setspecific, "pthread_setspecific");
-+
-+   function pthread_getspecific (key : pthread_key_t) return System.Address;
-+   pragma Import (C, pthread_getspecific, "pthread_getspecific");
-+
-+   type destructor_pointer is access procedure (arg : System.Address);
-+   pragma Convention (C, destructor_pointer);
-+
-+   function pthread_key_create
-+     (key        : access pthread_key_t;
-+      destructor : destructor_pointer) return int;
-+   pragma Import (C, pthread_key_create, "pthread_key_create");
-+
-+private
-+
-+   type sigset_t is array (1 .. 4) of unsigned;
-+
-+   --  In NetBSD the component sa_handler turns out to
-+   --  be one a union type, and the selector is a macro:
-+   --  #define sa_handler __sigaction_u._handler
-+   --  #define sa_sigaction __sigaction_u._sigaction
-+
-+   --  Should we add a signal_context type here ???
-+   --  How could it be done independent of the CPU architecture ???
-+   --  sigcontext type is opaque, so it is architecturally neutral.
-+   --  It is always passed as an access type, so define it as an empty record
-+   --  since the contents are not used anywhere.
-+
-+   type struct_sigcontext is null record;
-+   pragma Convention (C, struct_sigcontext);
-+
-+   type pid_t is new int;
-+
-+   type time_t is new int64;
-+
-+   type timespec is record
-+      ts_sec  : time_t;
-+      ts_nsec : long;
-+   end record;
-+   pragma Convention (C, timespec);
-+
-+   type pthread_t     is new System.Address;
-+   type pthread_key_t is new int;
-+
-+   type pthread_attr_t is record
-+      Data : char_array (1 .. System.OS_Constants.PTHREAD_ATTR_SIZE);
-+   end record;
-+   pragma Convention (C, pthread_attr_t);
-+   for pthread_attr_t'Alignment use size_t'Alignment;
-+
-+   type pthread_mutex_t is record
-+      Data : char_array (1 .. System.OS_Constants.PTHREAD_MUTEX_SIZE);
-+   end record;
-+   pragma Convention (C, pthread_mutex_t);
-+   for pthread_mutex_t'Alignment use size_t'Alignment;
-+
-+   type pthread_mutexattr_t is record
-+      Data : char_array (1 .. System.OS_Constants.PTHREAD_MUTEXATTR_SIZE);
-+   end record;
-+   pragma Convention (C, pthread_mutexattr_t);
-+   for pthread_mutexattr_t'Alignment use size_t'Alignment;
-+
-+   type pthread_cond_t is record
-+      Data : char_array (1 .. System.OS_Constants.PTHREAD_COND_SIZE);
-+   end record;
-+   pragma Convention (C, pthread_cond_t);
-+   for pthread_cond_t'Alignment use size_t'Alignment;
-+
-+   type pthread_condattr_t is record
-+      Data : char_array (1 .. System.OS_Constants.PTHREAD_CONDATTR_SIZE);
-+   end record;
-+   pragma Convention (C, pthread_condattr_t);
-+   for pthread_condattr_t'Alignment use size_t'Alignment;
-+
-+   type pthread_rwlock_t is record
-+      Data : char_array (1 .. System.OS_Constants.PTHREAD_RWLOCK_SIZE);
-+   end record;
-+   pragma Convention (C, pthread_rwlock_t);
-+   for pthread_rwlock_t'Alignment use size_t'Alignment;
-+
-+   type pthread_rwlockattr_t is record
-+      Data : char_array (1 .. System.OS_Constants.PTHREAD_RWLOCKATTR_SIZE);
-+   end record;
-+   pragma Convention (C, pthread_rwlockattr_t);
-+   for pthread_rwlockattr_t'Alignment use size_t'Alignment;
-+
-+end System.OS_Interface;
diff --git a/gcc10-aux/patches/patch-ada_s-osprim__posix.adb b/gcc10-aux/patches/patch-ada_s-osprim__posix.adb
deleted file mode 100644
index 78d3533e53..0000000000
--- a/gcc10-aux/patches/patch-ada_s-osprim__posix.adb
+++ /dev/null
@@ -1,20 +0,0 @@
---- gcc/ada/libgnat/s-osprim__posix.adb.orig	2021-10-09 19:24:46.671910328 +0200
-+++ gcc/ada/libgnat/s-osprim__posix.adb	2021-10-09 19:28:33.938823233 +0200
-@@ -47,7 +47,7 @@
-    pragma Convention (C, timespec);
- 
-    function nanosleep (rqtp, rmtp : not null access timespec) return Integer;
--   pragma Import (C, nanosleep, "__nanosleep50");
-+   pragma Import (C, nanosleep, "__gnat_nanosleep");
- 
-    -----------
-    -- Clock --
-@@ -77,7 +77,7 @@
-       function gettimeofday
-         (Tv : access timeval;
-          Tz : System.Address := System.Null_Address) return Integer;
--      pragma Import (C, gettimeofday, "__gettimeofday50");
-+      pragma Import (C, gettimeofday, "__gnat_gettimeofday");
- 
-    begin
-       --  The return codes for gettimeofday are as follows (from man pages):
diff --git a/gcc10-aux/patches/patch-ada_s-taprop__posix.adb b/gcc10-aux/patches/patch-ada_s-taprop__posix.adb
deleted file mode 100644
index 92bfafc130..0000000000
--- a/gcc10-aux/patches/patch-ada_s-taprop__posix.adb
+++ /dev/null
@@ -1,19 +0,0 @@
---- gcc/ada/libgnarl/s-taprop__posix.adb.orig	2021-09-23 19:55:24.471842046 +0000
-+++ gcc/ada/libgnarl/s-taprop__posix.adb	2021-09-23 20:01:31.689253592 +0000
-@@ -654,6 +654,16 @@
-       else
-          Result := pthread_setschedparam
-            (T.Common.LL.Thread, SCHED_OTHER, Param'Access);
-+         if Result /= 0 then
-+            Param.sched_priority := 0;
-+            Result := pthread_setschedparam
-+              (T.Common.LL.Thread, SCHED_OTHER, Param'Access);
-+            if Result /= 0 then
-+               Param.sched_priority := -1;
-+               Result := pthread_setschedparam
-+                 (T.Common.LL.Thread, SCHED_OTHER, Param'Access);
-+            end if;
-+         end if;
-       end if;
- 
-       pragma Assert (Result = 0);
diff --git a/gcc10-aux/patches/patch-ada_sysdep.c b/gcc10-aux/patches/patch-ada_sysdep.c
deleted file mode 100644
index 9818956833..0000000000
--- a/gcc10-aux/patches/patch-ada_sysdep.c
+++ /dev/null
@@ -1,38 +0,0 @@
---- gcc/ada/sysdep.c.orig	2021-08-28 13:11:25.681014624 +0000
-+++ gcc/ada/sysdep.c	2021-08-28 13:21:14.748176113 +0000
-@@ -320,7 +320,7 @@
-   || (defined (__svr4__) && defined (__i386__)) || defined (__Lynx__) \
-   || defined (__CYGWIN__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
-   || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) \
--  || defined (__QNX__)
-+  || defined (__QNX__) || defined (__NetBSD__)
- 
- # ifdef __MINGW32__
- #  if OLD_MINGW
-@@ -373,7 +373,7 @@
-     || defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \
-     || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
-     || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) \
--    || defined (__QNX__)
-+    || defined (__QNX__) || defined (__NetBSD__)
-   char c;
-   int nread;
-   int good_one = 0;
-@@ -394,7 +394,7 @@
-     || defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \
-     || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
-     || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) \
--    || defined (__QNX__)
-+    || defined (__QNX__) || defined (__NetBSD__)
-       eof_ch = termios_rec.c_cc[VEOF];
- 
-       /* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for
-@@ -831,7 +831,7 @@
- 
- #elif defined (__APPLE__) || defined (__FreeBSD__) || defined (__linux__) \
-   || defined (__GLIBC__) || defined (__DragonFly__) || defined (__OpenBSD__) \
--  || defined (__DJGPP__) || defined (__QNX__)
-+  || defined (__DJGPP__) || defined (__QNX__) || defined (__NetBSD__)
- {
-   localtime_r (timer, &tp);
-   *off = tp.tm_gmtoff;
diff --git a/gcc10-aux/patches/patch-gcc_ada_Makefile.rtl b/gcc10-aux/patches/patch-gcc_ada_Makefile.rtl
new file mode 100644
index 0000000000..62b3b30c49
--- /dev/null
+++ b/gcc10-aux/patches/patch-gcc_ada_Makefile.rtl
@@ -0,0 +1,147 @@
+$NetBSD$
+
+Add NetBSD as a target and generate the required files correctly.
+
+--- gcc/ada/Makefile.rtl.orig	2021-04-08 13:56:27.725736525 +0200
++++ gcc/ada/Makefile.rtl	2021-10-09 18:43:45.974586137 +0200
+@@ -1739,6 +1739,131 @@
+   MISCLIB = -lutil
+ endif
+ 
++# x86 NetBSD
++ifeq ($(strip $(filter-out %86 netbsd%,$(target_cpu) $(target_os))),)
++  LIBGNAT_TARGET_PAIRS = \
++  a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
++  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
++  s-intman.adb<libgnarl/s-intman__posix.adb \
++  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
++  s-osinte.adb<libgnarl/s-osinte__netbsd.adb \
++  s-osinte.ads<libgnarl/s-osinte__netbsd.ads \
++  s-osprim.adb<libgnat/s-osprim__posix.adb \
++  s-taprop.adb<libgnarl/s-taprop__posix.adb \
++  s-taspri.ads<libgnarl/s-taspri__posix.ads \
++  s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
++  g-socthi.adb<libgnat/g-socthi__bsd.adb \
++  $(TRASYM_DWARF_UNIX_PAIRS) \
++  $(ATOMICS_TARGET_PAIRS) \
++  $(X86_64_TARGET_PAIRS) \
++  system.ads<libgnat/system-freebsd.ads
++
++  GNATLIB_SHARED = gnatlib-shared-dual
++
++  EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
++  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
++
++  EH_MECHANISM=-gcc
++  THREADSLIB= -lpthread -lrt
++  GMEM_LIB = gmemlib
++  LIBRARY_VERSION := $(LIB_VERSION)
++  MISCLIB = -lutil
++endif
++
++
++# x86-64 NetBSD
++ifeq ($(strip $(filter-out %86_64 netbsd%,$(target_cpu) $(target_os))),)
++  LIBGNAT_TARGET_PAIRS = \
++  a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
++  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
++  s-intman.adb<libgnarl/s-intman__posix.adb \
++  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
++  s-osinte.adb<libgnarl/s-osinte__netbsd.adb \
++  s-osinte.ads<libgnarl/s-osinte__netbsd.ads \
++  s-osprim.adb<libgnat/s-osprim__posix.adb \
++  s-taprop.adb<libgnarl/s-taprop__posix.adb \
++  s-taspri.ads<libgnarl/s-taspri__posix.ads \
++  s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
++  g-socthi.adb<libgnat/g-socthi__bsd.adb \
++  $(TRASYM_DWARF_UNIX_PAIRS) \
++  $(ATOMICS_TARGET_PAIRS) \
++  $(X86_64_TARGET_PAIRS) \
++  system.ads<libgnat/system-freebsd.ads
++
++  GNATLIB_SHARED = gnatlib-shared-dual
++
++  EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
++  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
++
++  EH_MECHANISM=-gcc
++  THREADSLIB= -lpthread -lrt
++  GMEM_LIB = gmemlib
++  LIBRARY_VERSION := $(LIB_VERSION)
++  MISCLIB = -lutil
++endif
++
++# arm NetBSD
++ifeq ($(strip $(filter-out %arm netbsd%,$(target_cpu) $(target_os))),)
++  LIBGNAT_TARGET_PAIRS = \
++  a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
++  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
++  s-intman.adb<libgnarl/s-intman__posix.adb \
++  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
++  s-osinte.adb<libgnarl/s-osinte__netbsd.adb \
++  s-osinte.ads<libgnarl/s-osinte__netbsd.ads \
++  s-osprim.adb<libgnat/s-osprim__posix.adb \
++  s-taprop.adb<libgnarl/s-taprop__posix.adb \
++  s-taspri.ads<libgnarl/s-taspri__posix.ads \
++  s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
++  g-socthi.adb<libgnat/g-socthi__bsd.adb \
++  $(TRASYM_DWARF_UNIX_PAIRS) \
++  $(ATOMICS_TARGET_PAIRS) \
++  $(X86_64_TARGET_PAIRS) \
++  system.ads<libgnat/system-freebsd.ads
++
++  GNATLIB_SHARED = gnatlib-shared-dual
++
++  EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
++  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
++
++  EH_MECHANISM=-gcc
++  THREADSLIB= -lpthread -lrt
++  GMEM_LIB = gmemlib
++  LIBRARY_VERSION := $(LIB_VERSION)
++  MISCLIB = -lutil
++endif
++
++# aarch64 NetBSD
++ifeq ($(strip $(filter-out %aarch64 netbsd%,$(target_cpu) $(target_os))),)
++  LIBGNAT_TARGET_PAIRS = \
++  a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
++  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
++  s-intman.adb<libgnarl/s-intman__posix.adb \
++  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
++  s-osinte.adb<libgnarl/s-osinte__netbsd.adb \
++  s-osinte.ads<libgnarl/s-osinte__netbsd.ads \
++  s-osprim.adb<libgnat/s-osprim__posix.adb \
++  s-taprop.adb<libgnarl/s-taprop__posix.adb \
++  s-taspri.ads<libgnarl/s-taspri__posix.ads \
++  s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
++  g-socthi.adb<libgnat/g-socthi__bsd.adb \
++  $(TRASYM_DWARF_UNIX_PAIRS) \
++  $(ATOMICS_TARGET_PAIRS) \
++  $(X86_64_TARGET_PAIRS) \
++  system.ads<libgnat/system-freebsd.ads
++
++  GNATLIB_SHARED = gnatlib-shared-dual
++
++  EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
++  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
++
++  EH_MECHANISM=-gcc
++  THREADSLIB= -lpthread -lrt
++  GMEM_LIB = gmemlib
++  LIBRARY_VERSION := $(LIB_VERSION)
++  MISCLIB = -lutil
++endif
++
+ # x86-64 DragonFly
+ ifeq ($(strip $(filter-out %86_64 dragonfly%,$(target_cpu) $(target_os))),)
+   LIBGNAT_TARGET_PAIRS = \
+@@ -2502,7 +2627,7 @@
+       s-osprim.adb<libgnat/s-osprim__darwin.adb \
+       $(ATOMICS_TARGET_PAIRS) \
+       system.ads<libgnat/system-darwin-x86.ads
+-
++p
+     ifeq ($(strip $(MULTISUBDIR)),/x86_64)
+       SO_OPTS += -m64
+       LIBGNAT_TARGET_PAIRS += $(X86_64_TARGET_PAIRS)
diff --git a/gcc10-aux/patches/patch-gcc_ada_adaint.c b/gcc10-aux/patches/patch-gcc_ada_adaint.c
new file mode 100644
index 0000000000..7570718d10
--- /dev/null
+++ b/gcc10-aux/patches/patch-gcc_ada_adaint.c
@@ -0,0 +1,88 @@
+$NetBSD$
+
+NetBSD does not use symbol versioning, which requires some functions
+to be preprocessed in C. This patch adds those functions definitions,
+not only for NetBSD, but for any other system too.
+
+--- gcc/ada/adaint.c.orig	2021-04-08 13:56:27.725736525 +0200
++++ gcc/ada/adaint.c	2021-10-09 17:27:52.413919872 +0200
+@@ -817,7 +817,8 @@
+ }
+ 
+ #if defined (_WIN32) || defined (__linux__) || defined (__sun__) \
+-  || defined (__FreeBSD__) || defined(__DragonFly__) || defined (__QNX__)
++  || defined (__FreeBSD__) || defined(__DragonFly__) || defined (__QNX__) \
++  || defined (__NetBSD__)
+ #define HAS_TARGET_WCHAR_T
+ #endif
+ 
+@@ -3544,6 +3545,69 @@
+   */
+ }
+ 
++#if defined(__NetBSD__)
++/* It's 2021, and NetBSD still doesn't use symbol versioning in their
++ * libraries.  They mimic this by having header macros rename the function
++ * at compile time.  If we don't wrap the functions, the osinte specification
++ * for NetBSD would need to import e.g. __sigaltstack14 instead of sigaltstack.
++ * By wrapping, new versions won't break gnat.
++ */
++int
++__gnat_sigemptyset (sigset_t *set) {
++   return sigemptyset (set);
++}
++int
++__gnat_sigfillset (sigset_t *set) {
++   return sigfillset (set);
++}
++int
++__gnat_sigaddset (sigset_t *set, int signo) {
++   return sigaddset (set, signo);
++}
++int
++__gnat_sigdelset (sigset_t *set, int signo) {
++   return sigdelset (set, signo);
++}
++int
++__gnat_sigismember (sigset_t *set, int signo) {
++   return sigismember (set, signo);
++}
++int
++__gnat_sigaltstack (const stack_t *ss, stack_t *oss) {
++   return sigaltstack (ss, oss);
++}
++int
++__gnat_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) {
++   return sigaction (sig, act, oact);
++}
++int
++__gnat_clock_getres (clockid_t clock_id, struct timespec *res) {
++   return clock_getres (clock_id, res);
++}
++int
++__gnat_clock_gettime (clockid_t clock_id, struct timespec *tp) {
++   return clock_gettime (clock_id, tp);
++}
++#endif
++int
++__gnat_nanosleep (const struct timespec *rqtp, struct timespec *rmtp) {
++   return nanosleep (rqtp, rmtp);
++}
++int
++__gnat_gettimeofday (struct timeval * tp, struct timezone * tzp) {
++   return gettimeofday (tp, tzp);
++}
++
++int
++__gnat_select(int nfds, fd_set * readfds, fd_set * writefds,
++              fd_set * exceptfds, struct timeval * timeout) {
++   return select (nfds, readfds, writefds, exceptfds, timeout);
++}
++int
++__gnat_socket (int domain, int type, int protocol) {
++   return socket (domain, type, protocol);
++}
++
+ #ifdef __cplusplus
+ }
+ #endif
diff --git a/gcc10-aux/patches/patch-gcc_ada_adaint.h b/gcc10-aux/patches/patch-gcc_ada_adaint.h
new file mode 100644
index 0000000000..1f9ee9b358
--- /dev/null
+++ b/gcc10-aux/patches/patch-gcc_ada_adaint.h
@@ -0,0 +1,37 @@
+$NetBSD$
+
+Due to the lack of symbol versioning in NetBSD, some functions need
+to be exported from C to be used correctly. This patch addresses
+that issue and makes sure that other systems also work correclty.
+
+--- gcc/ada/adaint.h.orig	2021-10-09 19:21:39.117755578 +0200
++++ gcc/ada/adaint.h	2021-10-09 19:02:38.871872061 +0200
+@@ -345,6 +345,28 @@
+ 
+ extern const void * __gnat_get_executable_load_address  (void);
+ 
++#if defined(__NetBSD__)
++#include <signal.h>
++extern int    __gnat_sigemptyset (sigset_t *);
++extern int    __gnat_sigfillset  (sigset_t *);
++extern int    __gnat_sigaddset   (sigset_t *, int);
++extern int    __gnat_sigdelset   (sigset_t *, int);
++extern int    __gnat_sigismember (sigset_t *, int);
++extern int    __gnat_sigaltstack (const stack_t *, stack_t *);
++extern int    __gnat_sigaction   (int, const struct sigaction *, struct sigaction *);
++#endif
++#include <time.h>
++extern int    __gnat_nanosleep     (const struct timespec *, struct timespec *);
++extern int    __gnat_gettimeofday  (struct timeval *, struct timezone *);
++#include <sys/select.h>
++extern int    __gnat_select        (int, fd_set *, fd_set *, fd_set *, struct timeval *);
++#include <sys/socket.h>
++extern int    __gnat_socket        (int, int, int);
++#if defined(__NetBSD__)
++extern int    __gnat_clock_getres  (clockid_t, struct timespec *);
++extern int    __gnat_clock_gettime (clockid_t, struct timespec *);
++#endif
++
+ #ifdef __cplusplus
+ }
+ #endif
diff --git a/gcc10-aux/patches/patch-gcc_ada_cstreams.c b/gcc10-aux/patches/patch-gcc_ada_cstreams.c
new file mode 100644
index 0000000000..07eaedb1bd
--- /dev/null
+++ b/gcc10-aux/patches/patch-gcc_ada_cstreams.c
@@ -0,0 +1,25 @@
+$NetBSD$
+
+Add missing defines
+
+--- gcc/ada/cstreams.c.orig	2021-08-28 18:42:21.323680378 +0000
++++ gcc/ada/cstreams.c	2021-08-28 18:43:48.045445919 +0000
+@@ -188,7 +188,8 @@
+ 	  *p = '\\';
+     }
+ 
+-#elif defined (__FreeBSD__) || defined (__DragonFly__) || defined (__OpenBSD__)
++#elif defined (__FreeBSD__) || defined (__DragonFly__) \
++  || defined (__OpenBSD__) || defined (__NetBSD__)
+ 
+   /* Use realpath function which resolves links and references to . and ..
+      on those Unix systems that support it. Note that GNU/Linux provides it but
+@@ -270,7 +271,7 @@
+ }
+ 
+ #elif defined (__linux__) || defined (__sun__) || defined (__FreeBSD__) \
+-  || defined (__APPLE__)
++  || defined (__APPLE__) || defined (__NetBSD__)
+ /* section for platforms having ftello/fseeko */
+ 
+ __int64
diff --git a/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.adb b/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.adb
new file mode 100644
index 0000000000..8883c76a2a
--- /dev/null
+++ b/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.adb
@@ -0,0 +1,147 @@
+$NetBSD$
+
+Add NetBSD interface.
+
+--- gcc/ada/libgnarl/s-osinte__netbsd.adb.orig	2021-10-08 11:29:30.470090202 +0200
++++ gcc/ada/libgnarl/s-osinte__netbsd.adb	2021-10-08 11:29:30.472274837 +0200
+@@ -0,0 +1,140 @@
++------------------------------------------------------------------------------
++--                                                                          --
++--                  GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                --
++--                                                                          --
++--                   S Y S T E M . O S _ I N T E R F A C E                  --
++--                                                                          --
++--                                   B o d y                                --
++--                                                                          --
++--          Copyright (C) 1991-2015, Free Software Foundation, Inc.         --
++--                                                                          --
++-- GNARL is free software; you can  redistribute it  and/or modify it under --
++-- terms of the  GNU General Public License as published  by the Free Soft- --
++-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
++-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
++-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
++-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
++--                                                                          --
++-- As a special exception under Section 7 of GPL version 3, you are granted --
++-- additional permissions described in the GCC Runtime Library Exception,   --
++-- version 3.1, as published by the Free Software Foundation.               --
++--                                                                          --
++-- You should have received a copy of the GNU General Public License and    --
++-- a copy of the GCC Runtime Library Exception along with this program;     --
++-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
++-- <http://www.gnu.org/licenses/>.                                          --
++--                                                                          --
++-- GNARL was developed by the GNARL team at Florida State University. It is --
++-- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
++-- State University (http://www.gnat.com).                                  --
++--                                                                          --
++------------------------------------------------------------------------------
++
++--  This is the NetBSD THREADS version of this package
++
++with Interfaces.C; use Interfaces.C;
++
++package body System.OS_Interface is
++
++   -----------
++   -- Errno --
++   -----------
++
++   function Errno return int is
++      type int_ptr is access all int;
++
++      function internal_errno return int_ptr;
++      pragma Import (C, internal_errno, "__errno");
++
++   begin
++      return (internal_errno.all);
++   end Errno;
++
++   --------------------
++   -- Get_Stack_Base --
++   --------------------
++
++   function Get_Stack_Base (thread : pthread_t) return Address is
++      pragma Unreferenced (thread);
++   begin
++      return Null_Address;
++   end Get_Stack_Base;
++
++   ------------------
++   -- pthread_init --
++   ------------------
++
++   procedure pthread_init is
++   begin
++      null;
++   end pthread_init;
++
++   -----------------------------------
++   -- pthread_mutexattr_setprotocol --
++   -----------------------------------
++
++   function pthread_mutexattr_setprotocol
++     (attr     : access pthread_mutexattr_t;
++      protocol : int) return int is
++      pragma Unreferenced (attr, protocol);
++   begin
++      return 0;
++   end pthread_mutexattr_setprotocol;
++
++   --------------------------------------
++   -- pthread_mutexattr_setprioceiling --
++   --------------------------------------
++
++   function pthread_mutexattr_setprioceiling
++     (attr     : access pthread_mutexattr_t;
++      prioceiling : int) return int is
++      pragma Unreferenced (attr, prioceiling);
++   begin
++      return 0;
++   end pthread_mutexattr_setprioceiling;
++
++   -----------------
++   -- To_Duration --
++   -----------------
++
++   function To_Duration (TS : timespec) return Duration is
++   begin
++      return Duration (TS.ts_sec) + Duration (TS.ts_nsec) / 10#1#E9;
++   end To_Duration;
++
++   ------------------------
++   -- To_Target_Priority --
++   ------------------------
++
++   function To_Target_Priority
++     (Prio : System.Any_Priority) return Interfaces.C.int
++   is
++   begin
++      return Interfaces.C.int (Prio);
++   end To_Target_Priority;
++
++   -----------------
++   -- To_Timespec --
++   -----------------
++
++   function To_Timespec (D : Duration) return timespec is
++      S : time_t;
++      F : Duration;
++
++   begin
++      S := time_t (Long_Long_Integer (D));
++      F := D - Duration (S);
++
++      --  If F has negative value due to a round-up, adjust for positive F
++      --  value.
++
++      if F < 0.0 then
++         S := S - 1;
++         F := F + 1.0;
++      end if;
++
++      return timespec'(ts_sec => S,
++                       ts_nsec => long (Long_Long_Integer (F * 10#1#E9)));
++   end To_Timespec;
++
++end System.OS_Interface;
diff --git a/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.ads b/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.ads
new file mode 100644
index 0000000000..0f85cae6cc
--- /dev/null
+++ b/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-osinte____netbsd.ads
@@ -0,0 +1,670 @@
+$NetBSD$
+
+Add NetBSD interface.
+
+--- gcc/ada/libgnarl/s-osinte__netbsd.ads.orig	2021-10-08 11:29:30.503927461 +0200
++++ gcc/ada/libgnarl/s-osinte__netbsd.ads	2021-10-09 18:31:14.947869872 +0200
+@@ -0,0 +1,663 @@
++------------------------------------------------------------------------------
++--                                                                          --
++--                  GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                --
++--                                                                          --
++--                   S Y S T E M . O S _ I N T E R F A C E                  --
++--                                                                          --
++--                                   S p e c                                --
++--                                                                          --
++--             Copyright (C) 1991-1994, Florida State University            --
++--          Copyright (C) 1995-2015, Free Software Foundation, Inc.         --
++--                                                                          --
++-- GNAT is free software;  you can  redistribute it  and/or modify it under --
++-- terms of the  GNU General Public License as published  by the Free Soft- --
++-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
++-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
++-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
++-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
++--                                                                          --
++-- As a special exception under Section 7 of GPL version 3, you are granted --
++-- additional permissions described in the GCC Runtime Library Exception,   --
++-- version 3.1, as published by the Free Software Foundation.               --
++--                                                                          --
++-- You should have received a copy of the GNU General Public License and    --
++-- a copy of the GCC Runtime Library Exception along with this program;     --
++-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
++-- <http://www.gnu.org/licenses/>.                                          --
++--                                                                          --
++-- GNARL was developed by the GNARL team at Florida State University. It is --
++-- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
++-- State University (http://www.gnat.com).                                  --
++--                                                                          --
++------------------------------------------------------------------------------
++
++--  This is the NetBSD PTHREADS version of this package.
++
++--  This package encapsulates all direct interfaces to OS services
++--  that are needed by the tasking run-time (libgnarl).
++
++--  PLEASE DO NOT add any with-clauses to this package or remove the pragma
++--  Preelaborate. This package is designed to be a bottom-level (leaf) package.
++
++with Ada.Unchecked_Conversion;
++
++with Interfaces.C;
++with System.OS_Constants;
++
++package System.OS_Interface is
++   pragma Preelaborate;
++
++   pragma Linker_Options ("-pthread");
++
++   subtype int            is Interfaces.C.int;
++   subtype short          is Interfaces.C.short;
++   subtype long           is Interfaces.C.long;
++   subtype unsigned       is Interfaces.C.unsigned;
++   subtype unsigned_short is Interfaces.C.unsigned_short;
++   subtype unsigned_long  is Interfaces.C.unsigned_long;
++   subtype unsigned_char  is Interfaces.C.unsigned_char;
++   subtype plain_char     is Interfaces.C.plain_char;
++   subtype size_t         is Interfaces.C.size_t;
++   subtype char_array     is Interfaces.C.char_array;
++   subtype int64          is Interfaces.Integer_64;
++
++   -----------
++   -- Errno --
++   -----------
++
++   function Errno return int;
++   pragma Inline (Errno);
++
++   EAGAIN    : constant := 35;
++   EINTR     : constant := 4;
++   EINVAL    : constant := 22;
++   ENOMEM    : constant := 12;
++   ETIMEDOUT : constant := 60;
++
++   -------------
++   -- Signals --
++   -------------
++
++   Max_Interrupt : constant := 31;
++   type Signal is new int range 0 .. Max_Interrupt;
++   for Signal'Size use int'Size;
++
++   SIGHUP     : constant := 1; --  hangup
++   SIGINT     : constant := 2; --  interrupt (rubout)
++   SIGQUIT    : constant := 3; --  quit (ASCD FS)
++   SIGILL     : constant := 4; --  illegal instruction (not reset)
++   SIGTRAP    : constant := 5; --  trace trap (not reset)
++   SIGIOT     : constant := 6; --  IOT instruction
++   SIGABRT    : constant := 6; --  used by abort, replace SIGIOT in the  future
++   SIGEMT     : constant := 7; --  EMT instruction
++   SIGFPE     : constant := 8; --  floating point exception
++   SIGKILL    : constant := 9; --  kill (cannot be caught or ignored)
++   SIGBUS     : constant := 10; --  bus error
++   SIGSEGV    : constant := 11; --  segmentation violation
++   SIGSYS     : constant := 12; --  bad argument to system call
++   SIGPIPE    : constant := 13; --  write on a pipe with no one to read it
++   SIGALRM    : constant := 14; --  alarm clock
++   SIGTERM    : constant := 15; --  software termination signal from kill
++   SIGURG     : constant := 16; --  urgent condition on IO channel
++   SIGSTOP    : constant := 17; --  stop (cannot be caught or ignored)
++   SIGTSTP    : constant := 18; --  user stop requested from tty
++   SIGCONT    : constant := 19; --  stopped process has been continued
++   SIGCLD     : constant := 20; --  alias for SIGCHLD
++   SIGCHLD    : constant := 20; --  child status change
++   SIGTTIN    : constant := 21; --  background tty read attempted
++   SIGTTOU    : constant := 22; --  background tty write attempted
++   SIGIO      : constant := 23; --  I/O possible (Solaris SIGPOLL alias)
++   SIGXCPU    : constant := 24; --  CPU time limit exceeded
++   SIGXFSZ    : constant := 25; --  filesize limit exceeded
++   SIGVTALRM  : constant := 26; --  virtual timer expired
++   SIGPROF    : constant := 27; --  profiling time alarm
++   SIGWINCH   : constant := 28; --  window size change
++   SIGINFO    : constant := 29; --  information request (NetBSD/FreeBSD)
++   SIGUSR1    : constant := 30; --  user defined signal 1
++   SIGUSR2    : constant := 31; --  user defined signal 2
++
++   SIGADAABORT : constant := SIGABRT;
++   --  Change this if you want to use another signal for task abort.
++   --  SIGTERM might be a good one.
++
++   type Signal_Set is array (Natural range <>) of Signal;
++
++   --  Interrupts that must be unmasked at all times.  NetBSD
++   --  pthreads will not allow an application to mask out any
++   --  interrupt needed by the threads library.
++   Unmasked : constant Signal_Set :=
++     (SIGTRAP, SIGBUS, SIGTTIN, SIGTTOU, SIGTSTP);
++
++   --  NetBSD will uses SIGPROF for timing.  Do not allow a
++   --  handler to attach to this signal.
++   Reserved : constant Signal_Set := (0 .. 0 => SIGPROF);
++
++   type sigset_t is private;
++
++   function sigaddset
++     (set : access sigset_t;
++      sig : Signal) return int;
++   pragma Import (C, sigaddset, "__gnat_sigaddset");
++
++   function sigdelset
++     (set : access sigset_t;
++      sig : Signal) return int;
++   pragma Import (C, sigdelset, "__gnat_sigdelset");
++
++   function sigfillset (set : access sigset_t) return int;
++   pragma Import (C, sigfillset, "__gnat_sigfillset");
++
++   function sigismember
++     (set : access sigset_t;
++      sig : Signal) return int;
++   pragma Import (C, sigismember, "__gnat_sigismember");
++
++   function sigemptyset (set : access sigset_t) return int;
++   pragma Import (C, sigemptyset, "__gnat_sigemptyset");
++
++   --  sigcontext is architecture dependent, so define it private
++   type struct_sigcontext is private;
++
++   --  ??? This is the current definition of struct_sigaction
++   --  as of 2021/10/02 in signal.h
++   type old_struct_sigaction is record
++      sa_handler : System.Address;
++      sa_mask    : sigset_t;
++      sa_flags   : int;
++   end record;
++   pragma Convention (C, old_struct_sigaction);
++
++   --  This is an incorrect struct as of 2021/10/02
++   type new_struct_sigaction is record
++      sa_handler : System.Address;
++      sa_flags   : int;
++      sa_mask    : sigset_t;
++   end record;
++   pragma Convention (C, new_struct_sigaction);
++
++   --  Corrected to use old_struct_sigaction 2021/10/02
++   subtype struct_sigaction is old_struct_sigaction;
++   type struct_sigaction_ptr is access all struct_sigaction;
++
++   SIG_BLOCK   : constant := 1;
++   SIG_UNBLOCK : constant := 2;
++   SIG_SETMASK : constant := 3;
++
++   SIG_DFL  : constant := 0;
++   SIG_IGN  : constant := 1;
++   --  Added for completeness
++   SIG_ERR  : constant := -1;
++   SIG_HOLD : constant := 3;
++
++   SA_SIGINFO : constant := 16#0040#;
++   SA_ONSTACK : constant := 16#0001#;
++
++   function sigaction
++     (sig  : Signal;
++      act  : struct_sigaction_ptr;
++      oact : struct_sigaction_ptr) return int;
++   pragma Import (C, sigaction, "__gnat_sigaction");
++
++   ----------
++   -- Time --
++   ----------
++
++   Time_Slice_Supported : constant Boolean := True;
++   --  Indicates whether time slicing is supported (i.e SCHED_RR is supported)
++
++   type timespec is private;
++
++   function nanosleep (rqtp, rmtp : access timespec) return int;
++   pragma Import (C, nanosleep, "__gnat_nanosleep");
++
++   type clockid_t is new unsigned;
++
++   function clock_getres
++     (clock_id : clockid_t;
++      res      : access timespec) return int;
++   pragma Import (C, clock_getres, "__gnat_clock_getres");
++
++   function clock_gettime
++     (clock_id : clockid_t;
++      tp       : access timespec)
++      return int;
++   pragma Import (C, clock_gettime, "__gnat_clock_gettime");
++
++   function To_Duration (TS : timespec) return Duration;
++   pragma Inline (To_Duration);
++
++   function To_Timespec (D : Duration) return timespec;
++   pragma Inline (To_Timespec);
++
++   type struct_timezone is record
++      tz_minuteswest : int;
++      tz_dsttime     : int;
++   end record;
++   pragma Convention (C, struct_timezone);
++
++   -------------------------
++   -- Priority Scheduling --
++   -------------------------
++
++   SCHED_OTHER : constant := 0;
++   SCHED_FIFO  : constant := 1;
++   SCHED_RR    : constant := 2;
++
++   function To_Target_Priority
++     (Prio : System.Any_Priority) return Interfaces.C.int;
++   --  Maps System.Any_Priority to a POSIX priority
++
++   -------------
++   -- Process --
++   -------------
++
++   type pid_t is private;
++
++   function kill (pid : pid_t; sig : Signal) return int;
++   pragma Import (C, kill, "__gnat_kill");
++
++   function getpid return pid_t;
++   pragma Import (C, getpid, "getpid");
++
++   ---------
++   -- LWP --
++   ---------
++
++   function lwp_self return System.Address;
++   --  lwp_self does not exist on this thread library, revert to pthread_self
++   --  which is the closest approximation (with getpid). This function is
++   --  needed to share s-taprop.adb across POSIX-like targets.
++   pragma Import (C, lwp_self, "pthread_self");
++
++   -------------
++   -- Threads --
++   -------------
++
++   type Thread_Body is access
++     function (arg : System.Address) return System.Address;
++   pragma Convention (C, Thread_Body);
++
++   function Thread_Body_Access is new
++     Ada.Unchecked_Conversion (System.Address, Thread_Body);
++
++   type pthread_t           is private;
++   subtype Thread_Id        is pthread_t;
++
++   type pthread_mutex_t      is limited private;
++   type pthread_cond_t       is limited private;
++   type pthread_attr_t       is limited private;
++   type pthread_mutexattr_t  is limited private;
++   type pthread_condattr_t   is limited private;
++   type pthread_rwlock_t     is limited private;
++   type pthread_rwlockattr_t is limited private;
++   type pthread_key_t        is private;
++
++   PTHREAD_CREATE_DETACHED : constant := 1;
++   PTHREAD_CREATE_JOINABLE : constant := 0;
++
++   PTHREAD_SCOPE_PROCESS : constant := 0;
++   PTHREAD_SCOPE_SYSTEM  : constant := 1;
++
++   -----------
++   -- Stack --
++   -----------
++
++   type stack_t is record
++      ss_sp    : System.Address;
++      ss_size  : size_t;
++      ss_flags : int;
++   end record;
++   pragma Convention (C, stack_t);
++
++   function sigaltstack
++     (ss  : not null access stack_t;
++      oss : access stack_t) return int;
++   pragma Import (C, sigaltstack, "__gnat_sigaltstack");
++
++   Alternate_Stack : aliased System.Address;
++   --  This is a dummy definition, never used (Alternate_Stack_Size is null)
++
++   Alternate_Stack_Size : constant := 0;
++   --  No alternate signal stack is used on this platform
++
++   Stack_Base_Available : constant Boolean := False;
++   --  Indicates whether the stack base is available on this target. This
++   --  allows us to share s-osinte.adb between all the FSU run time. Note that
++   --  this value can only be true if pthread_t has a complete definition that
++   --  corresponds exactly to the C header files.
++
++   function Get_Stack_Base (thread : pthread_t) return Address;
++   pragma Inline (Get_Stack_Base);
++   --  returns the stack base of the specified thread. Only call this function
++   --  when Stack_Base_Available is True.
++
++   function Get_Page_Size return int;
++   pragma Import (C, Get_Page_Size, "_getpagesize");
++   --  Returns the size of a page
++
++   PROT_NONE  : constant := 0;
++   PROT_READ  : constant := 1;
++   PROT_WRITE : constant := 2;
++   PROT_EXEC  : constant := 4;
++   PROT_ALL   : constant := PROT_READ + PROT_WRITE + PROT_EXEC;
++   PROT_ON    : constant := PROT_NONE;
++   PROT_OFF   : constant := PROT_ALL;
++
++   function mprotect (addr : Address; len : size_t; prot : int) return int;
++   pragma Import (C, mprotect);
++
++   ---------------------------------------
++   -- Nonstandard Thread Initialization --
++   ---------------------------------------
++
++   --  FSU_THREADS requires pthread_init, which is nonstandard and this should
++   --  be invoked during the elaboration of s-taprop.adb.
++
++   --  NetBSD does not require this so we provide an empty Ada body
++
++   procedure pthread_init;
++
++   -------------------------
++   -- POSIX.1c  Section 3 --
++   -------------------------
++
++   function sigwait
++     (set : access sigset_t;
++      sig : access Signal) return int;
++   pragma Import (C, sigwait, "sigwait");
++
++   function pthread_kill
++     (thread : pthread_t;
++      sig    : Signal) return int;
++   pragma Import (C, pthread_kill, "pthread_kill");
++
++   function pthread_sigmask
++     (how  : int;
++      set  : access sigset_t;
++      oset : access sigset_t) return int;
++   pragma Import (C, pthread_sigmask, "pthread_sigmask");
++
++   --------------------------
++   -- POSIX.1c  Section 11 --
++   --------------------------
++
++   function pthread_mutexattr_init
++     (attr : access pthread_mutexattr_t) return int;
++   pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init");
++
++   function pthread_mutexattr_destroy
++     (attr : access pthread_mutexattr_t) return int;
++   pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy");
++
++   function pthread_mutex_init
++     (mutex : access pthread_mutex_t;
++      attr  : access pthread_mutexattr_t) return int;
++   pragma Import (C, pthread_mutex_init, "pthread_mutex_init");
++
++   function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
++   pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy");
++
++   function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
++   pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock");
++
++   function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
++   pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock");
++
++   function pthread_condattr_init
++     (attr : access pthread_condattr_t) return int;
++   pragma Import (C, pthread_condattr_init, "pthread_condattr_init");
++
++   function pthread_condattr_destroy
++     (attr : access pthread_condattr_t) return int;
++   pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy");
++
++   function pthread_cond_init
++     (cond : access pthread_cond_t;
++      attr : access pthread_condattr_t) return int;
++   pragma Import (C, pthread_cond_init, "pthread_cond_init");
++
++   function pthread_cond_destroy (cond : access pthread_cond_t) return int;
++   pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy");
++
++   function pthread_cond_signal (cond : access pthread_cond_t) return int;
++   pragma Import (C, pthread_cond_signal, "pthread_cond_signal");
++
++   function pthread_cond_wait
++     (cond  : access pthread_cond_t;
++      mutex : access pthread_mutex_t) return int;
++   pragma Import (C, pthread_cond_wait, "pthread_cond_wait");
++
++   function pthread_cond_timedwait
++     (cond    : access pthread_cond_t;
++      mutex   : access pthread_mutex_t;
++      abstime : access timespec) return int;
++   pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait");
++
++   Relative_Timed_Wait : constant Boolean := False;
++   --  pthread_cond_timedwait requires an absolute delay time
++
++   --------------------------
++   -- POSIX.1c  Section 13 --
++   --------------------------
++
++   PTHREAD_PRIO_NONE    : constant := 0;
++   PTHREAD_PRIO_INHERIT : constant := 1;
++   PTHREAD_PRIO_PROTECT : constant := 2;
++
++   function pthread_mutexattr_setprotocol
++     (attr     : access pthread_mutexattr_t;
++      protocol : int) return int;
++
++   function pthread_mutexattr_setprioceiling
++     (attr     : access pthread_mutexattr_t;
++      prioceiling : int) return int;
++
++   type struct_sched_param is record
++      sched_priority : int;
++   end record;
++   pragma Convention (C, struct_sched_param);
++
++   function pthread_getschedparam
++     (thread : pthread_t;
++      policy : access int;
++      param  : access struct_sched_param) return int;
++   pragma Import (C, pthread_getschedparam, "pthread_getschedparam");
++
++   function pthread_setschedparam
++     (thread : pthread_t;
++      policy : int;
++      param  : access struct_sched_param) return int;
++   pragma Import (C, pthread_setschedparam, "pthread_setschedparam");
++
++   function pthread_attr_setscope
++     (attr            : access pthread_attr_t;
++      contentionscope : int) return int;
++   pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope");
++
++   function pthread_attr_getscope
++     (attr            : access pthread_attr_t;
++      contentionscope : access int) return int;
++   pragma Import (C, pthread_attr_getscope, "pthread_attr_getscope");
++
++   function pthread_attr_setinheritsched
++     (attr            : access pthread_attr_t;
++      inheritsched : int) return int;
++   pragma Import
++     (C, pthread_attr_setinheritsched, "pthread_attr_setinheritsched");
++
++   function pthread_attr_getinheritsched
++     (attr         : access pthread_attr_t;
++      inheritsched : access int) return int;
++   pragma Import
++     (C, pthread_attr_getinheritsched, "pthread_attr_getinheritsched");
++
++   function pthread_attr_setschedpolicy
++     (attr   : access pthread_attr_t;
++      policy : int) return int;
++   pragma Import (C, pthread_attr_setschedpolicy,
++     "pthread_attr_setschedpolicy");
++
++   function pthread_attr_getschedpolicy
++     (attr   : access pthread_attr_t;
++      policy : access int) return int;
++   pragma Import (C, pthread_attr_getschedpolicy,
++     "pthread_attr_getschedpolicy");
++
++   function pthread_attr_setschedparam
++     (attr        : access pthread_attr_t;
++      sched_param : int) return int;
++   pragma Import (C, pthread_attr_setschedparam, "pthread_attr_setschedparam");
++
++   function pthread_attr_getschedparam
++     (attr        : access pthread_attr_t;
++      sched_param : access int) return int;
++   pragma Import (C, pthread_attr_getschedparam, "pthread_attr_getschedparam");
++
++   function sched_yield return int;
++   pragma Import (C, sched_yield, "sched_yield");
++
++   --------------------------
++   -- P1003.1c  Section 16 --
++   --------------------------
++
++   function pthread_attr_init (attributes : access pthread_attr_t) return int;
++   pragma Import (C, pthread_attr_init, "pthread_attr_init");
++
++   function pthread_attr_destroy
++     (attributes : access pthread_attr_t) return int;
++   pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
++
++   function pthread_attr_setdetachstate
++     (attr        : access pthread_attr_t;
++      detachstate : int) return int;
++   pragma Import
++     (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate");
++
++   function pthread_attr_getdetachstate
++     (attr        : access pthread_attr_t;
++      detachstate : access int) return int;
++   pragma Import
++     (C, pthread_attr_getdetachstate, "pthread_attr_getdetachstate");
++
++   function pthread_attr_getstacksize
++     (attr      : access pthread_attr_t;
++      stacksize : access size_t) return int;
++   pragma Import
++     (C, pthread_attr_getstacksize, "pthread_attr_getstacksize");
++
++   function pthread_attr_setstacksize
++     (attr      : access pthread_attr_t;
++      stacksize : size_t) return int;
++   pragma Import
++     (C, pthread_attr_setstacksize, "pthread_attr_setstacksize");
++
++   function pthread_create
++     (thread        : access pthread_t;
++      attributes    : access pthread_attr_t;
++      start_routine : Thread_Body;
++      arg           : System.Address) return int;
++   pragma Import (C, pthread_create, "pthread_create");
++
++   function pthread_detach (thread : pthread_t) return int;
++   pragma Import (C, pthread_detach, "pthread_detach");
++
++   procedure pthread_exit (status : System.Address);
++   pragma Import (C, pthread_exit, "pthread_exit");
++
++   function pthread_self return pthread_t;
++   pragma Import (C, pthread_self, "pthread_self");
++
++   --------------------------
++   -- POSIX.1c  Section 17 --
++   --------------------------
++
++   function pthread_setspecific
++     (key   : pthread_key_t;
++      value : System.Address) return  int;
++   pragma Import (C, pthread_setspecific, "pthread_setspecific");
++
++   function pthread_getspecific (key : pthread_key_t) return System.Address;
++   pragma Import (C, pthread_getspecific, "pthread_getspecific");
++
++   type destructor_pointer is access procedure (arg : System.Address);
++   pragma Convention (C, destructor_pointer);
++
++   function pthread_key_create
++     (key        : access pthread_key_t;
++      destructor : destructor_pointer) return int;
++   pragma Import (C, pthread_key_create, "pthread_key_create");
++
++private
++
++   type sigset_t is array (1 .. 4) of unsigned;
++
++   --  In NetBSD the component sa_handler turns out to
++   --  be one a union type, and the selector is a macro:
++   --  #define sa_handler __sigaction_u._handler
++   --  #define sa_sigaction __sigaction_u._sigaction
++
++   --  Should we add a signal_context type here ???
++   --  How could it be done independent of the CPU architecture ???
++   --  sigcontext type is opaque, so it is architecturally neutral.
++   --  It is always passed as an access type, so define it as an empty record
++   --  since the contents are not used anywhere.
++
++   type struct_sigcontext is null record;
++   pragma Convention (C, struct_sigcontext);
++
++   type pid_t is new int;
++
++   type time_t is new int64;
++
++   type timespec is record
++      ts_sec  : time_t;
++      ts_nsec : long;
++   end record;
++   pragma Convention (C, timespec);
++
++   type pthread_t     is new System.Address;
++   type pthread_key_t is new int;
++
++   type pthread_attr_t is record
++      Data : char_array (1 .. System.OS_Constants.PTHREAD_ATTR_SIZE);
++   end record;
++   pragma Convention (C, pthread_attr_t);
++   for pthread_attr_t'Alignment use size_t'Alignment;
++
++   type pthread_mutex_t is record
++      Data : char_array (1 .. System.OS_Constants.PTHREAD_MUTEX_SIZE);
++   end record;
++   pragma Convention (C, pthread_mutex_t);
++   for pthread_mutex_t'Alignment use size_t'Alignment;
++
++   type pthread_mutexattr_t is record
++      Data : char_array (1 .. System.OS_Constants.PTHREAD_MUTEXATTR_SIZE);
++   end record;
++   pragma Convention (C, pthread_mutexattr_t);
++   for pthread_mutexattr_t'Alignment use size_t'Alignment;
++
++   type pthread_cond_t is record
++      Data : char_array (1 .. System.OS_Constants.PTHREAD_COND_SIZE);
++   end record;
++   pragma Convention (C, pthread_cond_t);
++   for pthread_cond_t'Alignment use size_t'Alignment;
++
++   type pthread_condattr_t is record
++      Data : char_array (1 .. System.OS_Constants.PTHREAD_CONDATTR_SIZE);
++   end record;
++   pragma Convention (C, pthread_condattr_t);
++   for pthread_condattr_t'Alignment use size_t'Alignment;
++
++   type pthread_rwlock_t is record
++      Data : char_array (1 .. System.OS_Constants.PTHREAD_RWLOCK_SIZE);
++   end record;
++   pragma Convention (C, pthread_rwlock_t);
++   for pthread_rwlock_t'Alignment use size_t'Alignment;
++
++   type pthread_rwlockattr_t is record
++      Data : char_array (1 .. System.OS_Constants.PTHREAD_RWLOCKATTR_SIZE);
++   end record;
++   pragma Convention (C, pthread_rwlockattr_t);
++   for pthread_rwlockattr_t'Alignment use size_t'Alignment;
++
++end System.OS_Interface;
diff --git a/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-taprop____posix.adb b/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-taprop____posix.adb
new file mode 100644
index 0000000000..431e6c6b7d
--- /dev/null
+++ b/gcc10-aux/patches/patch-gcc_ada_libgnarl_s-taprop____posix.adb
@@ -0,0 +1,27 @@
+$NetBSD$
+
+When using SCHED_OTHER, the minimum and maximum in NetBSD is -1.
+In most other OSs it is 0. Change the behaviour to try to set the
+params using the default priority, if that fails, use 0, otherwise
+use -1. If none are valid, the tasking system will fail if assertions
+are on.
+
+--- gcc/ada/libgnarl/s-taprop__posix.adb.orig	2021-09-23 19:55:24.471842046 +0000
++++ gcc/ada/libgnarl/s-taprop__posix.adb	2021-09-23 20:01:31.689253592 +0000
+@@ -654,6 +654,16 @@
+       else
+          Result := pthread_setschedparam
+            (T.Common.LL.Thread, SCHED_OTHER, Param'Access);
++         if Result /= 0 then
++            Param.sched_priority := 0;
++            Result := pthread_setschedparam
++              (T.Common.LL.Thread, SCHED_OTHER, Param'Access);
++            if Result /= 0 then
++               Param.sched_priority := -1;
++               Result := pthread_setschedparam
++                 (T.Common.LL.Thread, SCHED_OTHER, Param'Access);
++            end if;
++         end if;
+       end if;
+ 
+       pragma Assert (Result = 0);
diff --git a/gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi.ads b/gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi.ads
new file mode 100644
index 0000000000..2b01a29d42
--- /dev/null
+++ b/gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi.ads
@@ -0,0 +1,24 @@
+$NetBSD$
+
+Fix symbol to make it use the C processed one.
+
+--- gcc/ada/libgnat/g-socthi.ads.orig	2021-10-09 18:09:40.607907149 +0200
++++ gcc/ada/libgnat/g-socthi.ads	2021-10-09 18:24:39.373733909 +0200
+@@ -53,8 +53,6 @@
+ 
+    package C renames Interfaces.C;
+ 
+-   use type System.CRTL.ssize_t;
+-
+    function Socket_Errno return Integer renames GNAT.OS_Lib.Errno;
+    --  Returns last socket error number
+ 
+@@ -256,7 +254,7 @@
+    pragma Import (C, C_Getsockname, "getsockname");
+    pragma Import (C, C_Getsockopt, "getsockopt");
+    pragma Import (C, C_Listen, "listen");
+-   pragma Import (C, C_Select, "select");
++   pragma Import (C, C_Select, "__gnat_select");
+    pragma Import (C, C_Setsockopt, "setsockopt");
+    pragma Import (C, C_Shutdown, "shutdown");
+    pragma Import (C, C_Socketpair, "socketpair");
diff --git a/gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi____bsd.adb b/gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi____bsd.adb
new file mode 100644
index 0000000000..c965233eed
--- /dev/null
+++ b/gcc10-aux/patches/patch-gcc_ada_libgnat_g-socthi____bsd.adb
@@ -0,0 +1,363 @@
+$NetBSD$
+
+Create a g-socthi package that is common to all *BSD systems.
+
+--- /dev/null	2021-10-09 18:50:23.845256363 +0200
++++ gcc/ada/libgnat/g-socthi__bsd.adb	2021-10-09 18:07:08.069557825 +0200
+@@ -0,0 +1,356 @@
++------------------------------------------------------------------------------
++--                                                                          --
++--                         GNAT COMPILER COMPONENTS                         --
++--                                                                          --
++--                    G N A T . S O C K E T S . T H I N                     --
++--                                                                          --
++--                                 B o d y                                  --
++--                                                                          --
++--                     Copyright (C) 2001-2018, AdaCore                     --
++--                                                                          --
++-- GNAT is free software;  you can  redistribute it  and/or modify it under --
++-- terms of the  GNU General Public License as published  by the Free Soft- --
++-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
++-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
++-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
++-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
++--                                                                          --
++-- As a special exception under Section 7 of GPL version 3, you are granted --
++-- additional permissions described in the GCC Runtime Library Exception,   --
++-- version 3.1, as published by the Free Software Foundation.               --
++--                                                                          --
++-- You should have received a copy of the GNU General Public License and    --
++-- a copy of the GCC Runtime Library Exception along with this program;     --
++-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
++-- <http://www.gnu.org/licenses/>.                                          --
++--                                                                          --
++-- GNAT was originally developed  by the GNAT team at  New York University. --
++-- Extensive contributions were provided by Ada Core Technologies Inc.      --
++--                                                                          --
++------------------------------------------------------------------------------
++
++--  This package provides a target dependent thin interface to the sockets
++--  layer for use by the GNAT.Sockets package (g-socket.ads). This package
++--  should not be directly with'ed by an applications program.
++
++--  This is the *BSD version which uses fcntl rather than ioctl
++--  The constant SCON.Thread_Blocking_IO is always true (for all platforms, not
++--  just *BSD), so this binding is significantly simpler than the standard
++--  one it replaces.
++
++with GNAT.OS_Lib; use GNAT.OS_Lib;
++
++with Interfaces.C; use Interfaces.C;
++
++package body GNAT.Sockets.Thin is
++
++   function Syscall_Accept
++     (S       : C.int;
++      Addr    : System.Address;
++      Addrlen : not null access C.int) return C.int;
++   pragma Import (C, Syscall_Accept, "accept");
++   --  The accept() function accepts a connection on a socket.  An incoming
++   --  connection is acknowledged and associated with an immediately created
++   --  socket.  The original socket is returned to the listening state.
++
++   function Syscall_Connect
++     (S       : C.int;
++      Name    : System.Address;
++      Namelen : C.int) return C.int;
++   pragma Import (C, Syscall_Connect, "connect");
++   --  The connect() system call initiates a connection on a socket.  If the
++   --  parameter S is of type SOCK_DGRAM then connect() permanently specifies
++   --  the peer to which datagrams are to be sent.  If S is type SOCK_STREAM
++   --  then connect() attempts to make a connection with another socket, which
++   --  is identified by the parameter Name.
++
++   function Syscall_Recv
++     (S     : C.int;
++      Msg   : System.Address;
++      Len   : C.int;
++      Flags : C.int) return C.int;
++   pragma Import (C, Syscall_Recv, "recv");
++   --  The recv() function receives a message from a socket.  The call can be
++   --  used on a connection mode socket or a bound, connectionless socket.  If
++   --  no messages are available at the socket, the recv() call waits for a
++   --  message to arrive unless the socket is non-blocking.  If a socket is
++   --  non-blocking, the call returns a -1 and ERRNO is set to EWOULDBLOCK.
++
++   function Syscall_Recvfrom
++     (S       : C.int;
++      Msg     : System.Address;
++      Len     : C.int;
++      Flags   : C.int;
++      From    : System.Address;
++      Fromlen : not null access C.int) return C.int;
++   pragma Import (C, Syscall_Recvfrom, "recvfrom");
++   --  The recvfrom() system call receives a message from a socket and captures
++   --  the address from which the data was sent.  It can be used to receive
++   --  data on an unconnected socket as well.  If no messages are available,
++   --  the call waits for a message to arrive on blocking sockets.  For
++   --  non-blocking sockets without messages, -1 is returned and ERRNO is set
++   --  to EAGAIN or EWOULDBLOCK.
++
++   function Syscall_Recvmsg
++     (S     : C.int;
++      Msg   : System.Address;
++      Flags : C.int) return System.CRTL.ssize_t;
++   pragma Import (C, Syscall_Recvmsg, "recvmsg");
++   --  The recvmsg call receives a message from a socket, and can be used to
++   --  receive data on an unconnected socket as well.  If no messages are
++   --  available, the call waits for a message to arrive on blocking sockets.
++   --  For non-blocking sockets without messages, -1 is returned and ERRNO is
++   --  set to EAGAIN or EWOULDBLOCK.
++
++   function Syscall_Sendmsg
++     (S     : C.int;
++      Msg   : System.Address;
++      Flags : C.int) return System.CRTL.ssize_t;
++   pragma Import (C, Syscall_Sendmsg, "sendmsg");
++   --  The sendmsg() function sends a message to a socket, and can be used with
++   --  unconnected sockets as well (the msg is ignored in this case).  The
++   --  function returns the number of bytes sent when successful, otherwise it
++   --  returns -1 and ERRNO is set (many possible values).
++
++   function Syscall_Sendto
++     (S     : C.int;
++      Msg   : System.Address;
++      Len   : C.int;
++      Flags : C.int;
++      To    : System.Address;
++      Tolen : C.int) return C.int;
++   pragma Import (C, Syscall_Sendto, "sendto");
++   --  The sendto() function only works for connected sockets and it initiates
++   --  the transmission of a message.  A successful call returns the numbers of
++   --  bytes sent, and a failure returns a -1 and ERRNO is set.
++
++   function Syscall_Socket
++     (Domain   : C.int;
++      Typ      : C.int;
++      Protocol : C.int) return C.int;
++   pragma Import (C, Syscall_Socket, "__gnat_socket");
++   --  The socket() function is used to create an unbound socket and returns a
++   --  file descriptor that can be used with other socket functions.  Upon
++   --  failure, a -1 is returned and ERRNO is set.
++
++   procedure Disable_SIGPIPE (S : C.int);
++   pragma Import (C, Disable_SIGPIPE, "__gnat_disable_sigpipe");
++
++   procedure Disable_All_SIGPIPEs;
++   pragma Import (C, Disable_All_SIGPIPEs, "__gnat_disable_all_sigpipes");
++   --  Sets the process to ignore all SIGPIPE signals on platforms that
++   --  don't support Disable_SIGPIPE for particular streams.
++
++   function C_Fcntl
++     (Fd  : C.int;
++      Cmd : C.int;
++      Val : C.int) return C.int;
++   pragma Import (C, C_Fcntl, "fcntl");
++   --  The ioctl of 64-bit DragonFlyBSD, OpenBSD, and NetBSD does not support
++   --  setting a socket in non-blocking mode.  fcntl must be used instead.
++
++   --------------
++   -- C_Accept --
++   --------------
++
++   function C_Accept
++     (S       : C.int;
++      Addr    : System.Address;
++      Addrlen : not null access C.int) return C.int
++   is
++      R : constant C.int := Syscall_Accept (S, Addr, Addrlen);
++   begin
++
++      Disable_SIGPIPE (R);
++      return R;
++   end C_Accept;
++
++   ---------------
++   -- C_Connect --
++   ---------------
++
++   function C_Connect
++     (S       : C.int;
++      Name    : System.Address;
++      Namelen : C.int) return C.int
++   is
++   begin
++      return Syscall_Connect (S, Name, Namelen);
++   end C_Connect;
++
++   ------------------
++   -- Socket_Ioctl --
++   ------------------
++
++   function Socket_Ioctl
++     (S   : C.int;
++      Req : SOSC.IOCTL_Req_T;
++      Arg : access C.int) return C.int
++   is
++   begin
++      if Req = SOSC.FIONBIO then
++         declare
++            use Interfaces;
++            flags    : constant Unsigned_32 :=
++                                Unsigned_32 (C_Fcntl (S, SOSC.F_GETFL, 0));
++            nonblock : constant Unsigned_32 := Unsigned_32 (SOSC.O_NDELAY);
++            enabled  : constant Boolean := Arg.all = 1;
++            newval   : C.int := C.int (flags);
++         begin
++            if enabled then
++               newval := C.int (flags or nonblock);
++            elsif (flags and nonblock) > 0 then
++               newval := C.int (flags - nonblock);
++            end if;
++            return C_Fcntl (Fd => S, Cmd => SOSC.F_SETFL, Val => newval);
++         end;
++      end if;
++
++      return C_Ioctl (S, Req, Arg);
++   end Socket_Ioctl;
++
++   ------------
++   -- C_Recv --
++   ------------
++
++   function C_Recv
++     (S     : C.int;
++      Msg   : System.Address;
++      Len   : C.int;
++      Flags : C.int) return C.int
++   is
++   begin
++      return Syscall_Recv (S, Msg, Len, Flags);
++   end C_Recv;
++
++   ----------------
++   -- C_Recvfrom --
++   ----------------
++
++   function C_Recvfrom
++     (S       : C.int;
++      Msg     : System.Address;
++      Len     : C.int;
++      Flags   : C.int;
++      From    : System.Address;
++      Fromlen : not null access C.int) return C.int
++   is
++   begin
++      return Syscall_Recvfrom (S, Msg, Len, Flags, From, Fromlen);
++   end C_Recvfrom;
++
++   ---------------
++   -- C_Recvmsg --
++   ---------------
++
++   function C_Recvmsg
++     (S     : C.int;
++      Msg   : System.Address;
++      Flags : C.int) return System.CRTL.ssize_t
++   is
++   begin
++      return Syscall_Recvmsg (S, Msg, Flags);
++   end C_Recvmsg;
++
++   ---------------
++   -- C_Sendmsg --
++   ---------------
++
++   function C_Sendmsg
++     (S     : C.int;
++      Msg   : System.Address;
++      Flags : C.int) return System.CRTL.ssize_t
++   is
++   begin
++      return Syscall_Sendmsg (S, Msg, Flags);
++   end C_Sendmsg;
++
++   --------------
++   -- C_Sendto --
++   --------------
++
++   function C_Sendto
++     (S     : C.int;
++      Msg   : System.Address;
++      Len   : C.int;
++      Flags : C.int;
++      To    : System.Address;
++      Tolen : C.int) return C.int
++   is
++   begin
++      return Syscall_Sendto (S, Msg, Len, Flags, To, Tolen);
++   end C_Sendto;
++
++   --------------
++   -- C_Socket --
++   --------------
++
++   function C_Socket
++     (Domain   : C.int;
++      Typ      : C.int;
++      Protocol : C.int) return C.int
++   is
++      R : constant C.int := Syscall_Socket (Domain, Typ, Protocol);
++   begin
++      Disable_SIGPIPE (R);
++      return R;
++   end C_Socket;
++
++   --------------
++   -- Finalize --
++   --------------
++
++   procedure Finalize is
++   begin
++      null;
++   end Finalize;
++
++   -------------------------
++   -- Host_Error_Messages --
++   -------------------------
++
++   package body Host_Error_Messages is separate;
++
++   ----------------
++   -- Initialize --
++   ----------------
++
++   procedure Initialize is
++   begin
++      Disable_All_SIGPIPEs;
++   end Initialize;
++
++   --------------------
++   -- Signalling_Fds --
++   --------------------
++
++   package body Signalling_Fds is
++
++      --  In this default implementation, we use a C version of these
++      --  subprograms provided by socket.c.
++
++      function C_Create (Fds : not null access Fd_Pair) return C.int;
++      function C_Read (Rsig : C.int) return C.int;
++      function C_Write (Wsig : C.int) return C.int;
++      procedure C_Close (Sig : C.int);
++
++      pragma Import (C, C_Create, "__gnat_create_signalling_fds");
++      pragma Import (C, C_Read,   "__gnat_read_signalling_fd");
++      pragma Import (C, C_Write,  "__gnat_write_signalling_fd");
++      pragma Import (C, C_Close,  "__gnat_close_signalling_fd");
++
++      function Create
++        (Fds : not null access Fd_Pair) return C.int renames C_Create;
++      function Read (Rsig : C.int) return C.int renames C_Read;
++      function Write (Wsig : C.int) return C.int renames C_Write;
++      procedure Close (Sig : C.int) renames C_Close;
++
++   end Signalling_Fds;
++
++   --------------------------
++   -- Socket_Error_Message --
++   --------------------------
++
++   function Socket_Error_Message (Errno : Integer) return String is separate;
++
++end GNAT.Sockets.Thin;
diff --git a/gcc10-aux/patches/patch-gcc_ada_libgnat_s-osprim____posix.adb b/gcc10-aux/patches/patch-gcc_ada_libgnat_s-osprim____posix.adb
new file mode 100644
index 0000000000..f8c310536b
--- /dev/null
+++ b/gcc10-aux/patches/patch-gcc_ada_libgnat_s-osprim____posix.adb
@@ -0,0 +1,24 @@
+$NetBSD$
+
+Use C preprocessed symbols.
+
+--- gcc/ada/libgnat/s-osprim__posix.adb.orig	2021-10-09 19:24:46.671910328 +0200
++++ gcc/ada/libgnat/s-osprim__posix.adb	2021-10-09 19:28:33.938823233 +0200
+@@ -47,7 +47,7 @@
+    pragma Convention (C, timespec);
+ 
+    function nanosleep (rqtp, rmtp : not null access timespec) return Integer;
+-   pragma Import (C, nanosleep, "nanosleep");
++   pragma Import (C, nanosleep, "__gnat_nanosleep");
+ 
+    -----------
+    -- Clock --
+@@ -77,7 +77,7 @@
+       function gettimeofday
+         (Tv : access timeval;
+          Tz : System.Address := System.Null_Address) return Integer;
+-      pragma Import (C, gettimeofday, "gettimeofday");
++      pragma Import (C, gettimeofday, "__gnat_gettimeofday");
+ 
+    begin
+       --  The return codes for gettimeofday are as follows (from man pages):
diff --git a/gcc10-aux/patches/patch-gcc_ada_s-oscons-tmplt.c b/gcc10-aux/patches/patch-gcc_ada_s-oscons-tmplt.c
new file mode 100644
index 0000000000..143fbd9c58
--- /dev/null
+++ b/gcc10-aux/patches/patch-gcc_ada_s-oscons-tmplt.c
@@ -0,0 +1,94 @@
+$NetBSD$
+
+Add NetBSD to some defined parts and bump the version of
+_XOPEN_SOURCE and add _NETBSD_SOURCE.
+
+--- gcc/ada/s-oscons-tmplt.c.orig	2021-04-08 13:56:27.913738795 +0200
++++ gcc/ada/s-oscons-tmplt.c	2021-10-09 18:26:07.630440685 +0200
+@@ -86,16 +86,25 @@
+  ** a number of non-POSIX but useful/required features.
+  **/
+ 
+-#if defined (__linux__) || defined (__ANDROID__)
++#if defined (__linux__) || defined (__ANDROID__) \
++  || defined (__FreeBSD__) || defined (__NetBSD__) \
++  || defined (__DragonFly__) || defined (__OpenBSD__)
+ 
+ /* Define _XOPEN_SOURCE to get IOV_MAX */
++/* We use 520 since NetBSD does not include getaddrinfo flags with only 500 */
+ # if !defined (_XOPEN_SOURCE)
+-#  define _XOPEN_SOURCE 500
++#  define _XOPEN_SOURCE 520
+ # endif
+ 
+ /* Define _BSD_SOURCE to get CRTSCTS */
+ # define _BSD_SOURCE
+ 
++/* NetBSD requires _NETBSD_SOURCE to be defined in order to include */
++/* NI_MAX{HOST,SERV} correctly */
++# if defined (__NetBSD__)
++#  define _NETBSD_SOURCE
++# endif
++
+ #endif /* defined (__linux__) */
+ 
+ /* Include gsocket.h before any system header so it can redefine FD_SETSIZE */
+@@ -158,7 +167,8 @@
+ #endif
+ 
+ #if defined (__linux__) || defined (__ANDROID__) || defined (__QNX__) \
+-  || defined (__rtems__)
++  || defined (__rtems__) || defined (__FreeBSD__) || defined (__NetBSD__) \
++  || defined (__OpenBSD__) || defined (__DragonFly__)
+ # include <pthread.h>
+ # include <signal.h>
+ #endif
+@@ -406,11 +416,14 @@
+ 
+ */
+ 
+-/* ioctl(2) requests are "int" in UNIX, but "unsigned long" on FreeBSD */
++/* ioctl(2) requests are "int" in UNIX, but "unsigned long" on FreeBSD
++   and NetBSD
++*/
+ 
+-#if defined (__FreeBSD__) || defined (__DragonFly__)
++#if defined (__FreeBSD__) || defined (__DragonFly__) || defined (__NetBSD__) \
++  || defined (__OpenBSD__)
+ # define CNI CNU
+-# define IOCTL_Req_T "Interfaces.C.unsigned"
++# define IOCTL_Req_T "Interfaces.C.unsigned_long"
+ #else
+ # define CNI CND
+ # define IOCTL_Req_T "Interfaces.C.int"
+@@ -1020,7 +1033,8 @@
+ 
+ */
+ 
+-#if defined (__FreeBSD__) || defined (__linux__) || defined (__DragonFly__)
++#if defined (__FreeBSD__) || defined (__linux__) || defined (__DragonFly__) \
++  || defined (__NetBSD__) || defined (__OpenBSD__)
+ # define PTY_Library "-lutil"
+ #else
+ # define PTY_Library ""
+@@ -1833,7 +1847,8 @@
+ 
+ #if defined(__linux__) || defined(__FreeBSD__) \
+  || (defined(_AIX) && defined(_AIXVERSION_530)) \
+- || defined(__DragonFly__) || defined(__QNX__)
++ || defined(__DragonFly__) || defined(__QNX__) \
++ || defined (__NetBSD__) || defined (__OpenBSD__)
+ /** On these platforms use system provided monotonic clock instead of
+  ** the default CLOCK_REALTIME. We then need to set up cond var attributes
+  ** appropriately (see thread.c).
+@@ -1855,7 +1870,9 @@
+ #endif
+ 
+ #if defined (__APPLE__) || defined (__linux__) || defined (__ANDROID__) \
+-  || defined (__QNX__) || defined (__rtems__) || defined (DUMMY)
++  || defined (__QNX__) || defined (__rtems__) || defined (DUMMY) \
++  || defined (__FreeBSD__) || defined (__DragonFly__) \
++  || defined (__NetBSD__) || defined (__OpenBSD__)
+ /*
+ 
+    --  Sizes of pthread data types
diff --git a/gcc10-aux/patches/patch-gcc_ada_sysdep.c b/gcc10-aux/patches/patch-gcc_ada_sysdep.c
new file mode 100644
index 0000000000..7277c3eb1e
--- /dev/null
+++ b/gcc10-aux/patches/patch-gcc_ada_sysdep.c
@@ -0,0 +1,42 @@
+$NetBSD$
+
+Add NetBSD to some defined sections.
+
+--- gcc/ada/sysdep.c.orig	2021-08-28 13:11:25.681014624 +0000
++++ gcc/ada/sysdep.c	2021-08-28 13:21:14.748176113 +0000
+@@ -320,7 +320,7 @@
+   || (defined (__svr4__) && defined (__i386__)) || defined (__Lynx__) \
+   || defined (__CYGWIN__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
+   || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) \
+-  || defined (__QNX__)
++  || defined (__QNX__) || defined (__NetBSD__)
+ 
+ # ifdef __MINGW32__
+ #  if OLD_MINGW
+@@ -373,7 +373,7 @@
+     || defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \
+     || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
+     || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) \
+-    || defined (__QNX__)
++    || defined (__QNX__) || defined (__NetBSD__)
+   char c;
+   int nread;
+   int good_one = 0;
+@@ -394,7 +394,7 @@
+     || defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \
+     || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
+     || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) \
+-    || defined (__QNX__)
++    || defined (__QNX__) || defined (__NetBSD__)
+       eof_ch = termios_rec.c_cc[VEOF];
+ 
+       /* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for
+@@ -831,7 +831,7 @@
+ 
+ #elif defined (__APPLE__) || defined (__FreeBSD__) || defined (__linux__) \
+   || defined (__GLIBC__) || defined (__DragonFly__) || defined (__OpenBSD__) \
+-  || defined (__DJGPP__) || defined (__QNX__)
++  || defined (__DJGPP__) || defined (__QNX__) || defined (__NetBSD__)
+ {
+   localtime_r (timer, &tp);
+   *off = tp.tm_gmtoff;
diff --git a/gcc10-aux/patches/patch-gcc_config.gcc b/gcc10-aux/patches/patch-gcc_config.gcc
index b2b44ad1f8..3256b1c243 100644
--- a/gcc10-aux/patches/patch-gcc_config.gcc
+++ b/gcc10-aux/patches/patch-gcc_config.gcc
@@ -1,11 +1,13 @@
-$NetBSD: patch-gcc_config.gcc,v 1.1 2021/04/24 09:35:31 mrg Exp $
+$NetBSD: patch-gcc_config.gcc,v 1.2 2021/09/23 09:53:21 adam Exp $
 
-Match what is in NetBSD src.  Fixes at least aarch64eb, and
+Match what is in NetBSD src. Fixes at least aarch64eb, and
 probably several others.
 
---- gcc/config.gcc.orig	2021-04-08 04:56:28.033740243 -0700
-+++ gcc/config.gcc	2021-04-24 00:16:20.082096330 -0700
-@@ -462,6 +462,16 @@
+Allow builds on Darwin 21.
+
+--- gcc/config.gcc.orig	2021-04-08 11:56:28.000000000 +0000
++++ gcc/config.gcc
+@@ -462,6 +462,16 @@ m32r*-*-*)
          cpu_type=m32r
  	extra_options="${extra_options} g.opt"
          ;;
@@ -22,7 +24,16 @@ probably several others.
  m68k-*-*)
  	extra_headers=math-68881.h
  	extra_options="${extra_options} m68k/m68k-tables.opt"
-@@ -877,6 +887,11 @@
+@@ -691,7 +701,7 @@ case ${target} in
+       *-*-darwin[4-9]* | *-*-darwin1[0-9]*)
+         macos_min=`expr $darwin_maj - 4`
+         ;;
+-      *-*-darwin20*)
++      *-*-darwin2[01]*)
+         # Darwin 20 corresponds to macOS 11.
+         macos_maj=11
+         def_ld64=609.0
+@@ -877,6 +887,11 @@ case ${target} in
    case ${enable_threads} in
      "" | yes | posix) thread_file='posix' ;;
    esac
@@ -34,7 +45,7 @@ probably several others.
    nbsd_tm_file="netbsd.h netbsd-stdint.h netbsd-elf.h"
    default_use_cxa_atexit=yes
    target_has_targetdm=yes
-@@ -1111,6 +1126,11 @@
+@@ -1111,6 +1126,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"
@@ -46,7 +57,7 @@ probably several others.
  	;;
  aarch64*-*-linux*)
  	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h"
-@@ -1252,7 +1272,6 @@
+@@ -1252,7 +1272,6 @@ arm*-*-freebsd*)                # ARM Fr
  	with_tls=${with_tls:-gnu}
  	;;
  arm*-*-netbsdelf*)
@@ -54,7 +65,7 @@ probably several others.
  	tmake_file="${tmake_file} arm/t-arm"
  	tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h"
  	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
-@@ -1261,26 +1280,33 @@
+@@ -1261,26 +1280,33 @@ arm*-*-netbsdelf*)
  	esac
  	case ${target} in
  	arm*-*-netbsdelf-*eabi*)
@@ -95,7 +106,7 @@ probably several others.
  	;;
  arm*-*-linux-* | arm*-*-uclinuxfdpiceabi)
  	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"
-@@ -1928,6 +1954,7 @@
+@@ -1928,6 +1954,7 @@ i[34567]86-*-netbsdelf*)
  	;;
  x86_64-*-netbsd*)
  	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${nbsd_tm_file} i386/x86-64.h i386/netbsd64.h"
@@ -103,7 +114,7 @@ probably several others.
  	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
  	;;
  i[34567]86-*-openbsd*)
-@@ -2250,6 +2277,16 @@
+@@ -2250,6 +2277,16 @@ ia64*-*-elf*)
  		target_cpu_default="${target_cpu_default}|MASK_GNU_LD"
  	fi
  	;;
@@ -120,7 +131,7 @@ probably several others.
  ia64*-*-freebsd*)
  	tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file} ia64/sysv4.h ia64/freebsd.h"
  	target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
-@@ -2362,8 +2399,25 @@
+@@ -2362,8 +2399,25 @@ m68k-*-elf* | fido-*-elf*)
  		;;
  	esac
  	;;
@@ -147,7 +158,7 @@ probably several others.
  	default_cf_cpu=5475
  	tm_file="${tm_file} dbxelf.h elfos.h ${nbsd_tm_file} m68k/netbsd-elf.h"
  	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
-@@ -2503,6 +2557,26 @@
+@@ -2503,6 +2557,26 @@ riscv*-*-freebsd*)
  	# automatically detect that GAS supports it, yet we require it.
  	gcc_cv_initfini_array=yes
  	;;
@@ -174,7 +185,7 @@ probably several others.
  mips*-*-netbsd*)			# NetBSD/mips, either endian.
  	target_cpu_default="MASK_ABICALLS"
  	tm_file="elfos.h ${tm_file} mips/elf.h ${nbsd_tm_file} mips/netbsd.h"
-@@ -2918,11 +2992,24 @@
+@@ -2918,11 +2992,24 @@ powerpc*-*-freebsd*)
  		;;
  	esac
  	;;
@@ -203,7 +214,7 @@ probably several others.
  	;;
  powerpc-*-eabisimaltivec*)
  	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/eabisim.h rs6000/eabialtivec.h"
-@@ -3394,9 +3481,11 @@
+@@ -3394,9 +3481,11 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd*
  sparc64-*-netbsd*)
  	tm_file="sparc/biarch64.h ${tm_file}"
  	tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h ${nbsd_tm_file} sparc/netbsd-elf.h"
@@ -215,7 +226,7 @@ probably several others.
  	;;
  sparc64-*-openbsd*)
  	tm_file="sparc/openbsd1-64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp64-elf.h"
-@@ -3911,6 +4000,9 @@
+@@ -3911,6 +4000,9 @@ if test x$with_cpu = x ; then
      frv550-*-*linux*)
        with_cpu=fr550
        ;;
@@ -225,7 +236,7 @@ probably several others.
      m68k*-*-*)
        case "$with_arch" in
  	"cf")
-@@ -4421,7 +4513,7 @@
+@@ -4421,7 +4513,7 @@ case "${target}" in
  		esac
  		;;
  
diff --git a/gcc10-aux/patches/patch-gcc_config_darwin-driver.c b/gcc10-aux/patches/patch-gcc_config_darwin-driver.c
new file mode 100644
index 0000000000..3b27d791c3
--- /dev/null
+++ b/gcc10-aux/patches/patch-gcc_config_darwin-driver.c
@@ -0,0 +1,15 @@
+$NetBSD: patch-gcc_config_darwin-driver.c,v 1.1 2021/10/13 12:38:52 adam Exp $
+
+Allow macOS 12.
+
+--- gcc/config/darwin-driver.c.orig	2021-10-13 11:50:13.000000000 +0000
++++ gcc/config/darwin-driver.c
+@@ -64,7 +64,7 @@ validate_macosx_version_min (const char 
+ 
+   major = strtoul (version_str, &end, 10);
+ 
+-  if (major < 10 || major > 11 ) /* MacOS 10 and 11 are known. */
++  if (major < 10 || major > 12 ) /* MacOS 10 and 11 and 12 are known. */
+     return NULL;
+ 
+   /* Skip a separating period, if there's one.  */
diff --git a/gcc10-aux/patches/patch-gnattools_configure b/gcc10-aux/patches/patch-gnattools_configure
new file mode 100644
index 0000000000..97a33dbc56
--- /dev/null
+++ b/gcc10-aux/patches/patch-gnattools_configure
@@ -0,0 +1,18 @@
+$NetBSD$
+
+Include NetBSD in the gnat tools configure.
+
+--- gnattools/configure.orig	2021-08-28 14:19:25.404806918 +0000
++++ gnattools/configure	2021-08-28 14:25:51.208977452 +0000
+@@ -2079,6 +2079,11 @@
+     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
+     indepsw.adb<indepsw-gnu.adb"
+     ;;
++  *-*-netbsd*)
++    TOOLS_TARGET_PAIRS="\
++    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
++    indepsw.adb<indepsw-gnu.adb"
++    ;;
+   *-*-linux*)
+     TOOLS_TARGET_PAIRS="\
+     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \


Home | Main Index | Thread Index | Old Index