pkgsrc-WIP-changes archive

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

Add gcc9snapshot.



Module Name:	pkgsrc-wip
Committed By:	Maya Rashish <maya%NetBSD.org@localhost>
Pushed By:	coypu
Date:		Tue Jan 22 05:15:46 2019 +0200
Changeset:	6cf8909ba7ced02e5782fde84673da38eb3002a9

Added Files:
	gcc9snapshot/DESCR
	gcc9snapshot/Makefile
	gcc9snapshot/buildlink3.mk
	gcc9snapshot/distinfo
	gcc9snapshot/files/netbsd-d.c
	gcc9snapshot/options.mk
	gcc9snapshot/patches/patch-contrib_download__prerequisites
	gcc9snapshot/patches/patch-gcc_Makefile.in
	gcc9snapshot/patches/patch-gcc_config.gcc
	gcc9snapshot/patches/patch-gcc_config_arm_arm.h
	gcc9snapshot/patches/patch-gcc_config_netbsd-protos.h
	gcc9snapshot/patches/patch-gcc_config_t-netbsd
	gcc9snapshot/patches/patch-gcc_config_x-netbsd
	gcc9snapshot/patches/patch-gcc_configure
	gcc9snapshot/patches/patch-gcc_d_d-builtins.cc
	gcc9snapshot/patches/patch-gcc_d_d-system.h
	gcc9snapshot/patches/patch-gcc_d_dmd_globals.h
	gcc9snapshot/patches/patch-gcc_ggc-common.c
	gcc9snapshot/patches/patch-gcc_lto_lto.c
	gcc9snapshot/patches/patch-isl_configure
	gcc9snapshot/patches/patch-libffi_configure
	gcc9snapshot/patches/patch-libffi_testsuite_libffi.call_float2.c
	gcc9snapshot/patches/patch-libgcc_config.host
	gcc9snapshot/patches/patch-libgcc_crtstuff.c
	gcc9snapshot/patches/patch-libgfortran_io_io.h
	gcc9snapshot/patches/patch-libphobos_configure.tgt
	gcc9snapshot/patches/patch-libphobos_libdruntime_core_stdc_assert__.d
	gcc9snapshot/patches/patch-libphobos_libdruntime_core_stdc_wchar_.d
	gcc9snapshot/patches/patch-libphobos_libdruntime_core_sys_netbsd_dlfcn.d
	gcc9snapshot/patches/patch-libphobos_libdruntime_core_sys_netbsd_execinfo.d
	gcc9snapshot/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h
	gcc9snapshot/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc
	gcc9snapshot/version.mk

Log Message:
Add gcc9snapshot.

gcc-d is only buildable if you use GNU install.

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

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

diffstat:
 gcc9snapshot/DESCR                                 |   4 +
 gcc9snapshot/Makefile                              | 180 +++++++++++++++++++++
 gcc9snapshot/buildlink3.mk                         |  31 ++++
 gcc9snapshot/distinfo                              |  36 +++++
 gcc9snapshot/files/netbsd-d.c                      |  39 +++++
 gcc9snapshot/options.mk                            | 135 ++++++++++++++++
 .../patches/patch-contrib_download__prerequisites  |  15 ++
 gcc9snapshot/patches/patch-gcc_Makefile.in         |  15 ++
 gcc9snapshot/patches/patch-gcc_config.gcc          |  40 +++++
 gcc9snapshot/patches/patch-gcc_config_arm_arm.h    |  20 +++
 .../patches/patch-gcc_config_netbsd-protos.h       |  38 +++++
 gcc9snapshot/patches/patch-gcc_config_t-netbsd     |  22 +++
 gcc9snapshot/patches/patch-gcc_config_x-netbsd     |  15 ++
 gcc9snapshot/patches/patch-gcc_configure           |  13 ++
 gcc9snapshot/patches/patch-gcc_d_d-builtins.cc     |  13 ++
 gcc9snapshot/patches/patch-gcc_d_d-system.h        |  14 ++
 gcc9snapshot/patches/patch-gcc_d_dmd_globals.h     |  12 ++
 gcc9snapshot/patches/patch-gcc_ggc-common.c        |  71 ++++++++
 gcc9snapshot/patches/patch-gcc_lto_lto.c           |  19 +++
 gcc9snapshot/patches/patch-isl_configure           |  24 +++
 gcc9snapshot/patches/patch-libffi_configure        |  13 ++
 .../patch-libffi_testsuite_libffi.call_float2.c    |  13 ++
 gcc9snapshot/patches/patch-libgcc_config.host      |  19 +++
 gcc9snapshot/patches/patch-libgcc_crtstuff.c       |  13 ++
 gcc9snapshot/patches/patch-libgfortran_io_io.h     |  18 +++
 gcc9snapshot/patches/patch-libphobos_configure.tgt |  15 ++
 ...atch-libphobos_libdruntime_core_stdc_assert__.d |  18 +++
 .../patch-libphobos_libdruntime_core_stdc_wchar_.d |  20 +++
 ...h-libphobos_libdruntime_core_sys_netbsd_dlfcn.d |  13 ++
 ...ibphobos_libdruntime_core_sys_netbsd_execinfo.d | 111 +++++++++++++
 ...libstdc++-v3_config_os_bsd_netbsd_ctype__base.h |  54 +++++++
 ..._config_os_bsd_netbsd_ctype__configure__char.cc |  81 ++++++++++
 gcc9snapshot/version.mk                            |   2 +
 33 files changed, 1146 insertions(+)

diffs:
diff --git a/gcc9snapshot/DESCR b/gcc9snapshot/DESCR
new file mode 100644
index 0000000000..e1291cbc05
--- /dev/null
+++ b/gcc9snapshot/DESCR
@@ -0,0 +1,4 @@
+The GNU Compiler Collection (GCC) includes front ends for C, C++, Objective-C,
+Fortran, and Go.
+
+This package provides the development version of version 8.x.
diff --git a/gcc9snapshot/Makefile b/gcc9snapshot/Makefile
new file mode 100644
index 0000000000..a9c87f7fcd
--- /dev/null
+++ b/gcc9snapshot/Makefile
@@ -0,0 +1,180 @@
+# $NetBSD: Makefile,v 1.3 2014/12/10 06:10:46 keckhardt Exp $
+
+GCC_PKGNAME=		gcc9snapshot
+.include		"version.mk"
+
+DISTNAME=	gcc-${GCC9S_DIST_VERSION}
+PKGNAME=	${GCC_PKGNAME}-${GCC9S_DIST_VERSION}
+## When bumping the PKGREVISION of this package the PKGREVISION of
+## lang/gcc7-libs needs to be bump to be at least 1 more than the
+## PKGREVISION of this package!
+CATEGORIES=	lang
+#MASTER_SITES=	${MASTER_SITE_GNU:=gcc/snapshots/${GCC9S_DIST_VERSION}/}
+MASTER_SITES+=	ftp://ftp.fu-berlin.de/unix/languages/gcc/snapshots/${GCC9S_DIST_VERSION}/
+EXTRACT_SUFX=	.tar.xz
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	http://gcc.gnu.org/
+COMMENT=	The GNU Compiler Collection (GCC) - 9.0 Release Series
+LICENSE=	gnu-gpl-v2 AND gnu-gpl-v3 AND gnu-lgpl-v2 AND gnu-lgpl-v3
+
+DISTFILES=		${DEFAULT_DISTFILES}
+EXTRACT_ONLY=		${DEFAULT_DISTFILES}
+
+NOT_FOR_PLATFORM=	Interix-*-*
+
+USE_LANGUAGES=		c c++
+USE_TOOLS+=		gmake makeinfo sed:run tar:build
+USE_TOOLS.NetBSD+=	gsed
+
+GNU_CONFIGURE=		yes
+## Build outside ${WRKSRC}
+OBJDIR=			../build
+CONFIGURE_DIRS=		${OBJDIR}
+CONFIGURE_SCRIPT=	../${DISTNAME}/configure
+GCC_SUBPREFIX=		${GCC_PKGNAME}
+GCC_PREFIX=		${PREFIX}/${GCC_SUBPREFIX}
+GNU_CONFIGURE_PREFIX=	${GCC_PREFIX}
+INFO_FILES=		yes
+
+UNLIMIT_RESOURCES+=	datasize
+UNLIMIT_RESOURCES+=	stacksize
+
+SUBST_CLASSES+=		vars
+SUBST_MESSAGE.vars=	Setting target machine name path in ${SUBST_FILES.vars}
+SUBST_STAGE.vars=	pre-configure
+SUBST_FILES.vars=	gcc/Makefile.in
+SUBST_VARS.vars=	GCC_TARGET_MACHINE
+
+
+.include "../../mk/bsd.prefs.mk"
+
+LANGS=			c
+
+# In some cases LINKER_RPATH_FLAG needs a trailing space.
+LINKER_RPATH_FLAG:=	${LINKER_RPATH_FLAG:S/-rpath/& /}
+
+## The Library rpath to use in end programs.
+LDFLAGS_FOR_TARGET=	${LDFLAGS:M${COMPILER_RPATH_FLAG}*:N*/usr/lib*}
+
+# The "-static-libstdc++ -static-libgcc" flags are normally added to the
+# boot-ldflags by configure but because we are supply the boot-ldflags
+# we mash supply them.
+BOOT_LDFLAGS=		-static-libstdc++ -static-libgcc ${LDFLAGS_FOR_TARGET}
+# Needed on Darwin when LDFLAGS point to a SDK
+BOOT_LDFLAGS+=		${LDFLAGS:M-Wl,-syslibroot*}
+# GCC does not understand this option; remove it, or stage build will fail
+BUILDLINK_TRANSFORM+=	rm:-stdlib=libc++
+
+.include "options.mk"
+
+## For graphite support.
+.if !empty(PKG_OPTIONS:Mgcc-graphite)
+
+post-extract:
+	${TAR} -jxf ${DISTDIR}/${ISL16}.tar.bz2 -C ${WRKSRC}
+	${MV} ${WRKSRC}/${ISL16} ${WRKSRC}/isl
+.endif
+
+.if !empty(MACHINE_PLATFORM:MNetBSD-*-*)
+# on NetBSD, use the native SSP code in libc
+CONFIGURE_ARGS+=	--disable-libssp
+.else
+CONFIGURE_ARGS+=	--enable-libssp
+.endif
+
+## For target librarys and libjava programs.
+CONFIGURE_ENV+=		LDFLAGS_FOR_TARGET=${LDFLAGS_FOR_TARGET:Q}
+
+CONFIGURE_ARGS+=	--enable-languages=${LANGS:Q}
+CONFIGURE_ARGS+=	--enable-shared
+CONFIGURE_ARGS+=	--enable-long-long
+CONFIGURE_ARGS+=	--with-local-prefix=${GCC_PREFIX:Q}
+CONFIGURE_ARGS+=	--enable-threads=posix
+CONFIGURE_ARGS+=	--with-boot-ldflags=${BOOT_LDFLAGS:Q}
+.if ${OPSYS} == "NetBSD"
+CONFIGURE_ARGS+=	--with-gnu-ld --with-ld=/usr/bin/ld
+CONFIGURE_ARGS+=	--with-gnu-as --with-as=/usr/bin/as
+MAKE_ENV+=		ac_cv_func_clock_gettime=yes
+MAKE_ENV+=		ac_cv_func_gethostbyname_r=no
+MAKE_ENV+=		ac_cv_func_freelocale=no
+MAKE_ENV+=		ac_cv_func_newlocale=no
+MAKE_ENV+=		ac_cv_func_uselocale=no
+.endif
+.if ${OPSYS} == "DragonFly"
+CONFIGURE_ARGS+=	--disable-bootstrap
+.endif
+
+.if !empty(MACHINE_PLATFORM:MNetBSD-*-i386) || !empty(MACHINE_PLATFORM:MLinux-*-i386)
+CONFIGURE_ARGS+=	--with-arch=i486 --with-tune=i486
+.endif
+
+.if !empty(MACHINE_PLATFORM:MNetBSD-*-x86_64) || !empty(MACHINE_PLATFORM:MLinux-*-x86_64)
+CONFIGURE_ARGS+=	--with-arch=nocona --with-tune=nocona --with-fpmath=sse
+.endif
+
+.if !empty(MACHINE_PLATFORM:MDarwin-[0-8].*-*)
+CONFIGURE_ARGS+=	--with-dwarf2
+.endif
+
+
+# ${WRKSRC}/fixincludes/ looks for sed and compiles the path to sed into
+# a binary so we need to make sure we give it the installed sed and not
+# the tool wrapped one.
+MAKE_ENV+=		ac_cv_path_SED=${TOOLS_SED}
+MAKE_ENV+=		lt_cv_path_SED=${TOOLS_SED}
+
+# Determine whether to use binutils
+.if ${OPSYS} == "SunOS"
+.  if exists(/usr/sfw/bin/gobjdump)
+CONFIGURE_ENV+=		OBJDUMP=/usr/sfw/bin/gobjdump
+.  endif
+.  if exists(/usr/bin/ld)
+CONFIGURE_ARGS+=	--without-gnu-ld --with-ld=/usr/bin/ld
+.  else
+CONFIGURE_ARGS+=	--without-gnu-ld --with-ld=/usr/ccs/bin/ld
+.  endif
+.  if exists(/usr/sfw/bin/gas)
+CONFIGURE_ARGS+=	--with-gnu-as --with-as=/usr/sfw/bin/gas
+.  elif exists(/usr/ccs/bin/as)
+CONFIGURE_ARGS+=	--without-gnu-as --with-as=/usr/ccs/bin/as
+.  else
+BUILDLINK_DEPMETHOD.binutils=	full
+.    include "../../devel/binutils/buildlink3.mk"
+CONFIGURE_ARGS+=	--with-gnu-as --with-as=${PREFIX}/bin/gas
+.  endif
+.endif
+
+pre-configure:
+	${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}
+	${CP} ${FILESDIR}/netbsd-d.c ${WRKSRC}/gcc/config/
+
+TEST_TARGET=	-j ${MAKE_JOBS} -k check || ${TRUE}
+pre-test:
+	${RUN} 							\
+	if runtest --version >/dev/null 2>/dev/null ; then	\
+		: ;						\
+	else							\
+	  ${ECHO} "ERROR: Please install devel/dejagnu in order to run the test suite." ; \
+	  exit 1 ;						\
+	fi
+post-test:
+	${RUN} cd ${WRKSRC} && cd ${OBJDIR} &&		\
+	${SHELL} ${WRKSRC}/contrib/test_summary >${WRKDIR}/test_summary.log
+	@${INFO_MSG} "Test summary are available in ${WRKDIR}/test_summary.log"
+
+post-install:
+	${TEST} -f ${DESTDIR}${GCC_PREFIX}/bin/cc || \
+		( cd ${DESTDIR}${GCC_PREFIX}/bin ; ${LN} -f gcc cc )
+.if !empty(MACHINE_PLATFORM:MSunOS-*-*86*) && ${OS_VERSION} != "5.11"
+	${SH} files/values.c ${DESTDIR}${GCC_PREFIX}/bin/gcc -m32 || ${TRUE}
+	${SH} files/values.c ${DESTDIR}${GCC_PREFIX}/bin/gcc -m64 || ${TRUE}
+.endif
+
+GENERATE_PLIST+= \
+	cd ${DESTDIR}${PREFIX} && 					\
+	${FIND} ${GCC_SUBPREFIX} \( -type f -o -type l \) -print | ${SORT} ;
+
+.include "../../mk/dlopen.buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/gcc9snapshot/buildlink3.mk b/gcc9snapshot/buildlink3.mk
new file mode 100644
index 0000000000..bc93ca3864
--- /dev/null
+++ b/gcc9snapshot/buildlink3.mk
@@ -0,0 +1,31 @@
+# $NetBSD: buildlink3.mk,v 1.1 2014/10/19 10:6:56 keckhardt Exp $
+
+BUILDLINK_TREE+=	gcc7snapshot
+
+.if !defined(GCC7_BUILDLINK3_MK)
+GCC6SNAPSHOT_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.gcc7snapshot+=	gcc6>=${_GCC_REQD}
+BUILDLINK_ABI_DEPENDS.gcc7snapshot+=	gcc6>=7.0
+BUILDLINK_PKGSRCDIR.gcc7snapshot=	../../wip/gcc7snapshot
+BUILDLINK_DEPMETHOD.gcc7snapshot?=	build
+
+BUILDLINK_FILES.gcc7snapshot=		#empty
+BUILDLINK_AUTO_VARS.gcc7snapshot=	no
+
+# Packages that link against shared libraries need a full dependency.
+#.if defined(_USE_GCC_SHLIB)
+#DEPENDS+=	{gcc7, gcc7-libs}>=${_GCC_REQD}:../../lang/gcc7-libs
+#ABI_DEPENDS+=	{gcc7,gcc7-libs}>=7.0:../../lang/gcc7-libs
+#.endif
+
+pkgbase := gcc7snapshot
+.include "../../mk/pkg-build-options.mk"
+.if !empty(PKG_BUILD_OPTIONS.gcc7snapshot:Mgcc-java)
+.include "../../devel/zlib/buildlink3.mk"
+.endif
+
+.include "../../mk/dlopen.buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
+.endif # GCC7SNAPSHOT_BUILDLINK3_MK
+BUILDLINK_TREE+=	-gcc7snapshot
diff --git a/gcc9snapshot/distinfo b/gcc9snapshot/distinfo
new file mode 100644
index 0000000000..5ecb621f63
--- /dev/null
+++ b/gcc9snapshot/distinfo
@@ -0,0 +1,36 @@
+$NetBSD: distinfo,v 1.23 2015/05/06 05:25:00 keckhardt Exp $
+
+SHA1 (gcc-9-20190120.tar.xz) = 26c75649cfb069261b88d845679f4292c5a9b6a7
+RMD160 (gcc-9-20190120.tar.xz) = 10d981b9ee1148a268709542dd71e0c1576e4b34
+SHA512 (gcc-9-20190120.tar.xz) = d4e90ba52ed8eca5257ba76c69994f05c9fc30779cb21d82ce314d55b9e39a41877fafa4734d9af2399299ee5bedf7bd72336121ed4bd7b4c55799889ab15a32
+Size (gcc-9-20190120.tar.xz) = 68207640 bytes
+SHA1 (isl-0.16.1.tar.bz2) = c5a2b201bf05229647e73203c0bf2d9679d4d21f
+RMD160 (isl-0.16.1.tar.bz2) = 5a99db3fe0d0a1f6bbac1ed4448f2403495c55b2
+SHA512 (isl-0.16.1.tar.bz2) = c188667a84dc5bdddb4ab7c35f89c91bf15a8171f4fcaf41301cf285fb7328846d9a367c096012fec4cc69d244f0bc9e95d84c09ec097394cd4093076f2a041b
+Size (isl-0.16.1.tar.bz2) = 1626446 bytes
+SHA1 (patch-contrib_download__prerequisites) = 86c6c16e0e3e3a0bcb38579a8b4004f603fac1ca
+SHA1 (patch-gcc_Makefile.in) = c0f97c75ba1d37eae894141edd58bb36b734f651
+SHA1 (patch-gcc_config.gcc) = 8df363dc630f5cb81b1819bebf516ded346cd0a5
+SHA1 (patch-gcc_config_arm_arm.h) = ef381dbb70cab2f76f6ad190eaa5519240ae1a02
+SHA1 (patch-gcc_config_netbsd-protos.h) = 5c788878832f3b48d83941d2b36401abe8ece91c
+SHA1 (patch-gcc_config_t-netbsd) = cb39774b614f1de64684cf2f4df337e7b40427d6
+SHA1 (patch-gcc_config_x-netbsd) = 9dc75bfab8331b5223efc382aae5f577fb6e1b7b
+SHA1 (patch-gcc_configure) = 15fb7af267b79965f83bc64ce8aad1279b0ea52d
+SHA1 (patch-gcc_d_d-builtins.cc) = 89c48c8e04c1137fdff9e3c548b9fd20add9229c
+SHA1 (patch-gcc_d_d-system.h) = 554f67dae8729819edf1bcc0e63d9303374d30f0
+SHA1 (patch-gcc_d_dmd_globals.h) = 701a302323e669e2eb703dd35557120f6580c6f9
+SHA1 (patch-gcc_ggc-common.c) = a5d2dba635859f5d680c3f80d7c30b42461c752b
+SHA1 (patch-gcc_lto_lto.c) = 7bd85ac8ade76a28c394f6fbe5d495f91824f79f
+SHA1 (patch-isl_configure) = 36b37778ee13c0b364fb24d5864d6a9e65b29b7d
+SHA1 (patch-libffi_configure) = bcfbfe8abddc378e2de4a39ad0669583b37e0292
+SHA1 (patch-libffi_testsuite_libffi.call_float2.c) = 6321dde308579448c27c2b6e1e30633699dd145f
+SHA1 (patch-libgcc_config.host) = bdd4cd27249c8b62793204428d95c977d58f06fb
+SHA1 (patch-libgcc_crtstuff.c) = e3a3b02a26229992851f195b5701cb1b86c29efe
+SHA1 (patch-libgfortran_io_io.h) = d44676239a7f45e42054d24bd5224f43c20055c0
+SHA1 (patch-libphobos_configure.tgt) = 7827878e76dc7014a6d470432e8f9807a7db568e
+SHA1 (patch-libphobos_libdruntime_core_stdc_assert__.d) = 5ba87194c78d2573269b90cfd62605de9b9dee8c
+SHA1 (patch-libphobos_libdruntime_core_stdc_wchar_.d) = 3ef87a04e90a6b33484dcadb7b2efbf075269a20
+SHA1 (patch-libphobos_libdruntime_core_sys_netbsd_dlfcn.d) = fb2760fc27d4c95af10ce0c9f7666badc6f8a770
+SHA1 (patch-libphobos_libdruntime_core_sys_netbsd_execinfo.d) = b4608d535788698ef51c0bb7aaf31a329b78c63e
+SHA1 (patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h) = 1b907114f8b3477400fabc7b84ca5c16cd9c2930
+SHA1 (patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc) = d498ce411dfcd57652f87957778fab66dd4ab9a0
diff --git a/gcc9snapshot/files/netbsd-d.c b/gcc9snapshot/files/netbsd-d.c
new file mode 100644
index 0000000000..f4765664a0
--- /dev/null
+++ b/gcc9snapshot/files/netbsd-d.c
@@ -0,0 +1,39 @@
+/* netbsd support needed only by D front-end.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "memmodel.h"
+#include "tm_p.h"
+#include "d/d-target.h"
+#include "d/d-target-def.h"
+
+/* Implement TARGET_D_OS_VERSIONS for netbsd targets.  */
+
+static void
+netbsd_d_os_builtins (void)
+{
+  d_add_builtin_version ("Posix");
+  d_add_builtin_version ("NetBSD");
+}
+
+#undef TARGET_D_OS_VERSIONS
+#define TARGET_D_OS_VERSIONS netbsd_d_os_builtins
+
+struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;
diff --git a/gcc9snapshot/options.mk b/gcc9snapshot/options.mk
new file mode 100644
index 0000000000..ed6079d168
--- /dev/null
+++ b/gcc9snapshot/options.mk
@@ -0,0 +1,135 @@
+# $NetBSD: options.mk,v 1.2 2014/12/10 06:10:46 keckhardt Exp $
+
+PKG_OPTIONS_VAR=	PKG_OPTIONS.${GCC_PKGNAME}
+PKG_SUPPORTED_OPTIONS=	nls gcc-inplace-math gcc-c++ gcc-fortran \
+			gcc-go gcc-d gcc-objc gcc-objc++ gcc-graphite
+PKG_SUGGESTED_OPTIONS=	gcc-c++ gcc-fortran gcc-objc gcc-objc++ \
+			gcc-graphite gcc-inplace-math
+
+.if ${OPSYS} == "NetBSD"
+PKG_SUGGESTED_OPTIONS+=	nls
+.elif ${OPSYS} == "Linux"
+PKG_SUGGESTED_OPTIONS+=	nls
+.elif ${OPSYS} == "DragonFly"
+PKG_SUGGESTED_OPTIONS+=	nls
+.elif ${OPSYS} == "SunOS"
+PKG_SUGGESTED_OPTIONS+=	gcc-inplace-math
+.else
+.endif
+
+###
+### Determine if multilib is avalible.
+###
+MULTILIB_SUPPORTED?=	unknown
+.if !empty(MACHINE_PLATFORM:MLinux-*-x86_64)
+.  if exists(/usr/include/gnu/stubs-64.h) && \
+     !exists(/usr/include/gnu/stubs-32.h)
+MULTILIB_SUPPORTED=	No
+.  else
+MULTILIB_SUPPORTED=	Yes
+.  endif
+.endif
+.if !empty(MULTILIB_SUPPORTED:M[Yy][Ee][Ss])
+PKG_SUPPORTED_OPTIONS+=	gcc-multilib
+PKG_SUGGESTED_OPTIONS+=	gcc-multilib
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+###
+### Native Language Support
+###
+.if !empty(PKG_OPTIONS:Mnls)
+USE_TOOLS+=		msgfmt
+CONFIGURE_ARGS+=	--enable-nls
+CONFIGURE_ARGS+=	--with-libiconv-prefix=${BUILDLINK_PREFIX.iconv}
+MAKE_ENV+=		ICONVPREFIX=${BUILDLINK_PREFIX.iconv}
+.include "../../converters/libiconv/buildlink3.mk"
+.include "../../devel/gettext-lib/buildlink3.mk"
+.else
+CONFIGURE_ARGS+=	--disable-nls
+.endif
+
+###
+### Multilib Support
+###
+.if (!empty(MULTILIB_SUPPORTED:M[Yy][Ee][Ss]) && \
+      empty(PKG_OPTIONS:Mgcc-multilib) ) || \
+    !empty(MULTILIB_SUPPORTED:M[Nn][Oo])
+CONFIGURE_ARGS+=	--disable-multilib
+.endif
+
+###
+### Build math libraries in place
+###
+.if !empty(PKG_OPTIONS:Mgcc-inplace-math)
+.  include "../../devel/gmp/inplace.mk"
+.  include "../../math/mpcomplex/inplace.mk"
+.  include "../../math/mpfr/inplace.mk"
+.else
+CONFIGURE_ARGS+=	--with-gmp=${BUILDLINK_PREFIX.gmp}
+CONFIGURE_ARGS+=	--with-mpc=${BUILDLINK_PREFIX.mpcomplex}
+CONFIGURE_ARGS+=	--with-mpfr=${BUILDLINK_PREFIX.mpfr}
+LIBS.SunOS+=		-lgmp
+.  include "../../devel/gmp/buildlink3.mk"
+.  include "../../math/mpcomplex/buildlink3.mk"
+.  include "../../math/mpfr/buildlink3.mk"
+.endif
+
+
+###
+### Graphite Support
+###
+.if !empty(PKG_OPTIONS:Mgcc-graphite)
+ISL16 =		isl-0.16.1
+SITES.${ISL16}.tar.bz2 = ${MASTER_SITE_GNU:=gcc/infrastructure/}
+DISTFILES +=	${ISL16}.tar.bz2
+.endif
+
+###
+### Optional languages
+### Ada could be added although there is a bootstrapping issue.  See
+### ../gcc34-ada for guidance
+###
+
+.if !empty(PKG_OPTIONS:Mgcc-objc++)
+.  if empty(PKG_OPTIONS:Mgcc-c++)
+PKG_OPTIONS+=		gcc-c++
+.  endif
+.  if empty(PKG_OPTIONS:Mgcc-objc)
+PKG_OPTIONS+=		gcc-objc
+.  endif
+LANGS+=			obj-c++
+.endif
+
+.if !empty(PKG_OPTIONS:Mgcc-objc)
+LANGS+=			objc
+.endif
+
+.if !empty(PKG_OPTIONS:Mgcc-d)
+LANGS+=			d
+.endif
+
+USE_TOOLS+=		unzip zip:run gmake:run
+CONFIGURE_ARGS+=	--with-system-zlib
+
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../lang/python/application.mk"
+
+.if !empty(PKG_OPTIONS:Mgcc-go)
+LANGS+=			go
+.endif
+
+.if !empty(PKG_OPTIONS:Mgcc-fortran)
+LANGS+=			fortran
+.endif
+
+.if !empty(PKG_OPTIONS:Mgcc-c++)
+LANGS+=			c++
+USE_TOOLS+=		perl
+CONFIGURE_ARGS+=	--enable-__cxa_atexit
+CONFIGURE_ARGS+=	--with-gxx-include-dir=${GCC_PREFIX}/include/c++/
+.else
+CONFIGURE_ARGS+=	--disable-build-with-cxx
+CONFIGURE_ARGS+=	--disable-build-poststage1-with-cxx
+.endif
diff --git a/gcc9snapshot/patches/patch-contrib_download__prerequisites b/gcc9snapshot/patches/patch-contrib_download__prerequisites
new file mode 100644
index 0000000000..8caf26d142
--- /dev/null
+++ b/gcc9snapshot/patches/patch-contrib_download__prerequisites
@@ -0,0 +1,15 @@
+$NetBSD: patch-contrib_download__prerequisites,v 1.1 2017/05/03 00:21:03 maya Exp $
+
+Non-portable test
+
+--- contrib/download_prerequisites.orig	2017-04-11 16:34:07.000000000 +0000
++++ contrib/download_prerequisites
+@@ -122,7 +122,7 @@ md5_check() {
+   md5_checksum_output=$(md5 -r "${file_to_check}")
+   # Grab the text before the first space
+   md5_checksum_detected="${md5_checksum_output%% *}"
+-  [ "${md5_checksum_expected}" == "${md5_checksum_detected}" ] \
++  [ "${md5_checksum_expected}" = "${md5_checksum_detected}" ] \
+     || die "Cannot verify integrity of possibly corrupted file ${file_to_check}"
+   echo "${file_to_check}: OK"
+ }
diff --git a/gcc9snapshot/patches/patch-gcc_Makefile.in b/gcc9snapshot/patches/patch-gcc_Makefile.in
new file mode 100644
index 0000000000..d52bcf4057
--- /dev/null
+++ b/gcc9snapshot/patches/patch-gcc_Makefile.in
@@ -0,0 +1,15 @@
+$NetBSD: patch-gcc_Makefile.in,v 1.1 2017/05/03 00:21:03 maya Exp $
+
+Add gcc libdir to a programs rpath so that _this gcc's_ support libraries
+are found.
+
+--- gcc/Makefile.in.orig	2017-04-18 18:10:27.000000000 +0000
++++ gcc/Makefile.in
+@@ -2112,6 +2112,7 @@ prefix.o: $(BASEVER)
+ # Language-independent files.
+ 
+ DRIVER_DEFINES = \
++  -DLINK_LIBGCC_SPEC="\"%D $(LINKER_RPATH_FLAG) $(prefix)//lib/%M $(LINKER_RPATH_FLAG) $(libdir)/%M \"" \
+   -DSTANDARD_STARTFILE_PREFIX=\"$(unlibsubdir)/\" \
+   -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
+   -DSTANDARD_LIBEXEC_PREFIX=\"$(libexecdir)/gcc/\" \
diff --git a/gcc9snapshot/patches/patch-gcc_config.gcc b/gcc9snapshot/patches/patch-gcc_config.gcc
new file mode 100644
index 0000000000..c99431ee79
--- /dev/null
+++ b/gcc9snapshot/patches/patch-gcc_config.gcc
@@ -0,0 +1,40 @@
+$NetBSD$
+
+--- gcc/config.gcc.orig	2019-01-17 12:34:28.000000000 +0000
++++ gcc/config.gcc
+@@ -838,15 +838,22 @@ case ${target} in
+ *-*-netbsd*)
+   tm_p_file="${tm_p_file} netbsd-protos.h"
+   tmake_file="t-netbsd t-slibgcc"
++  d_target_objs="${d_target_objs} netbsd-d.o"
+   extra_objs="${extra_objs} netbsd.o"
+   gas=yes
+   gnu_ld=yes
+   use_gcc_stdint=wrap
++  # cabs/cabsf are renamed to __c99_cabs/cabsf
++  tm_p_file="${tm_p_file} netbsd-protos.h"
++  target_gtfiles="${target_gtfiles} \$(srcdir)/config/netbsd.c"
++  extra_objs="${extra_objs} netbsd.o"
++  default_gnu_indirect_function=yes
+   case ${enable_threads} in
+     "" | yes | posix) thread_file='posix' ;;
+   esac
+   nbsd_tm_file="netbsd.h netbsd-stdint.h netbsd-elf.h"
+   default_use_cxa_atexit=yes
++  target_has_targetdm=yes
+   ;;
+ *-*-openbsd*)
+   tmake_file="t-openbsd"
+@@ -1650,10 +1657,12 @@ x86_64-*-freebsd*)
+ i[34567]86-*-netbsdelf*)
+ 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${nbsd_tm_file} i386/netbsd-elf.h"
+ 	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++	tmake_file="${tmake_file} i386/t-crtstuff"
+ 	;;
+ 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"
+ 	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++	tmake_file="${tmake_file} i386/t-crtstuff"
+ 	;;
+ i[34567]86-*-openbsd*)
+ 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h"
diff --git a/gcc9snapshot/patches/patch-gcc_config_arm_arm.h b/gcc9snapshot/patches/patch-gcc_config_arm_arm.h
new file mode 100644
index 0000000000..d8ab77aeba
--- /dev/null
+++ b/gcc9snapshot/patches/patch-gcc_config_arm_arm.h
@@ -0,0 +1,20 @@
+$NetBSD: patch-gcc_config_arm_arm.h,v 1.1 2017/05/03 00:21:03 maya Exp $
+
+driver-arm.o is only included for freebsd/arm and linux/arm, and
+it is responsible for the definition of host_detect_local_cpu.
+
+Without it, we get an undefined reference.
+
+GCC bugzilla #77800
+
+--- gcc/config/arm/arm.h.orig	2017-06-16 21:04:23.000000000 +0000
++++ gcc/config/arm/arm.h
+@@ -2203,7 +2203,7 @@ extern const char *arm_target_thumb_only
+ 
+ /* -mcpu=native handling only makes sense with compiler running on
+    an ARM chip.  */
+-#if defined(__arm__)
++#if defined(__arm__) && (defined(__FreeBSD__) || defined(__linux__))
+ extern const char *host_detect_local_cpu (int argc, const char **argv);
+ #define HAVE_LOCAL_CPU_DETECT
+ # define MCPU_MTUNE_NATIVE_FUNCTIONS			\
diff --git a/gcc9snapshot/patches/patch-gcc_config_netbsd-protos.h b/gcc9snapshot/patches/patch-gcc_config_netbsd-protos.h
new file mode 100644
index 0000000000..48de81472d
--- /dev/null
+++ b/gcc9snapshot/patches/patch-gcc_config_netbsd-protos.h
@@ -0,0 +1,38 @@
+$NetBSD: patch-gcc_config_netbsd-protos.h,v 1.1 2017/05/03 00:21:03 maya Exp $
+
+--- gcc/config/netbsd-protos.h.orig	2019-01-01 12:31:55.000000000 +0000
++++ gcc/config/netbsd-protos.h
+@@ -1,4 +1,33 @@
+ /* Prototypes.
++   Copyright (C) 2001-2014 Free Software Foundation, Inc.
++
++This file is part of GCC.
++
++GCC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 3, or (at your option)
++any later version.
++
++GCC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GCC; see the file COPYING3.  If not see
++<http://www.gnu.org/licenses/>.  */
++
++#ifndef _NETBSD_PROTOS_H_
++#define _NETBSD_PROTOS_H_
++
++double __c99_cabs (double complex);
++float __c99_cabsf (float complex);
++long double __c99_cabsl (long double complex);
++
++void netbsd_patch_builtins (void);
++
++#endif /* _NETBSD_PROTOS_H_ */
++/* Prototypes.
+    Copyright (C) 2017-2019 Free Software Foundation, Inc.
+ 
+ This file is part of GCC.
diff --git a/gcc9snapshot/patches/patch-gcc_config_t-netbsd b/gcc9snapshot/patches/patch-gcc_config_t-netbsd
new file mode 100644
index 0000000000..e6a691a5fc
--- /dev/null
+++ b/gcc9snapshot/patches/patch-gcc_config_t-netbsd
@@ -0,0 +1,22 @@
+$NetBSD: patch-gcc_config_t-netbsd,v 1.1 2017/05/03 00:21:03 maya Exp $
+
+--- gcc/config/t-netbsd.orig	2019-01-01 12:31:55.000000000 +0000
++++ gcc/config/t-netbsd
+@@ -1,4 +1,4 @@
+-# Copyright (C) 2017-2019 Free Software Foundation, Inc.
++# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ #
+ # This file is part of GCC.
+ #
+@@ -16,6 +16,11 @@
+ # along with GCC; see the file COPYING3.  If not see
+ # <http://www.gnu.org/licenses/>.
+ 
++
+ netbsd.o: $(srcdir)/config/netbsd.c
+ 	$(COMPILE) $<
+ 	$(POSTCOMPILE)
++
++netbsd-d.o: config/netbsd-d.c
++	$(COMPILE) $<
++	$(POSTCOMPILE)
diff --git a/gcc9snapshot/patches/patch-gcc_config_x-netbsd b/gcc9snapshot/patches/patch-gcc_config_x-netbsd
new file mode 100644
index 0000000000..74391e8675
--- /dev/null
+++ b/gcc9snapshot/patches/patch-gcc_config_x-netbsd
@@ -0,0 +1,15 @@
+$NetBSD: patch-gcc_config_x-netbsd,v 1.1 2017/05/03 00:21:03 maya Exp $
+
+Add host hooks for NetBSD - needed for working precompiled headers.
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58397
+
+--- gcc/config/x-netbsd.orig	2018-11-26 21:21:16.000000000 +0000
++++ gcc/config/x-netbsd
+@@ -2,3 +2,7 @@ host-netbsd.o : $(srcdir)/config/host-ne
+   coretypes.h hosthooks.h hosthooks-def.h $(HOOKS_H)
+ 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+ 		$(srcdir)/config/host-netbsd.c
++host-netbsd.o : $(srcdir)/config/host-netbsd.c $(CONFIG_H) $(SYSTEM_H) \
++  coretypes.h hosthooks.h hosthooks-def.h $(HOOKS_H)
++	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
++		$(srcdir)/config/host-netbsd.c
diff --git a/gcc9snapshot/patches/patch-gcc_configure b/gcc9snapshot/patches/patch-gcc_configure
new file mode 100644
index 0000000000..4d1ded0e9b
--- /dev/null
+++ b/gcc9snapshot/patches/patch-gcc_configure
@@ -0,0 +1,13 @@
+$NetBSD: patch-gcc_configure,v 1.1 2017/05/03 00:21:03 maya Exp $
+
+--- gcc/configure.orig	2015-09-30 23:06:11.000000000 +0000
++++ gcc/configure
+@@ -28321,7 +28321,7 @@ case "$target" in
+       gcc_cv_target_dl_iterate_phdr=no
+     fi
+     ;;
+-  *-*-dragonfly* | *-*-freebsd*)
++  *-*-dragonfly* | *-*-freebsd* | *-*-netbsd* )
+     if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then
+       gcc_cv_target_dl_iterate_phdr=yes
+     else
diff --git a/gcc9snapshot/patches/patch-gcc_d_d-builtins.cc b/gcc9snapshot/patches/patch-gcc_d_d-builtins.cc
new file mode 100644
index 0000000000..d67ab5b606
--- /dev/null
+++ b/gcc9snapshot/patches/patch-gcc_d_d-builtins.cc
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- gcc/d/d-builtins.cc.orig	2019-01-20 18:53:13.000000000 +0000
++++ gcc/d/d-builtins.cc
+@@ -382,6 +382,8 @@ d_add_builtin_version (const char* ident
+     global.params.isWindows = true;
+   else if (strcmp (ident, "FreeBSD") == 0)
+     global.params.isFreeBSD = true;
++  else if (strcmp (ident, "NetBSD") == 0)
++    global.params.isNetBSD = true;
+   else if (strcmp (ident, "OpenBSD") == 0)
+     global.params.isOpenBSD = true;
+   else if (strcmp (ident, "Solaris") == 0)
diff --git a/gcc9snapshot/patches/patch-gcc_d_d-system.h b/gcc9snapshot/patches/patch-gcc_d_d-system.h
new file mode 100644
index 0000000000..d7fe85164c
--- /dev/null
+++ b/gcc9snapshot/patches/patch-gcc_d_d-system.h
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- gcc/d/d-system.h.orig	2019-01-01 12:31:55.000000000 +0000
++++ gcc/d/d-system.h
+@@ -24,7 +24,8 @@
+ 
+ /* Used by the dmd front-end to determine if we have POSIX-style IO.  */
+ #define POSIX (__linux__ || __GLIBC__ || __gnu_hurd__ || __APPLE__ \
+-	       || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __sun)
++	       || __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ \
++	       || __sun)
+ 
+ /* Forward assert invariants to gcc_assert.  */
+ #undef assert
diff --git a/gcc9snapshot/patches/patch-gcc_d_dmd_globals.h b/gcc9snapshot/patches/patch-gcc_d_dmd_globals.h
new file mode 100644
index 0000000000..f0bc599c84
--- /dev/null
+++ b/gcc9snapshot/patches/patch-gcc_d_dmd_globals.h
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- gcc/d/dmd/globals.h.orig	2019-01-09 17:59:55.000000000 +0000
++++ gcc/d/dmd/globals.h
+@@ -84,6 +84,7 @@ struct Param
+     bool isOSX;         // generate code for Mac OSX
+     bool isWindows;     // generate code for Windows
+     bool isFreeBSD;     // generate code for FreeBSD
++    bool isNetBSD;      // generate code for NetBSD
+     bool isOpenBSD;     // generate code for OpenBSD
+     bool isSolaris;     // generate code for Solaris
+     bool hasObjectiveC; // target supports Objective-C
diff --git a/gcc9snapshot/patches/patch-gcc_ggc-common.c b/gcc9snapshot/patches/patch-gcc_ggc-common.c
new file mode 100644
index 0000000000..f566a0e072
--- /dev/null
+++ b/gcc9snapshot/patches/patch-gcc_ggc-common.c
@@ -0,0 +1,71 @@
+$NetBSD: patch-gcc_ggc-common.c,v 1.1 2017/05/03 00:21:03 maya Exp $
+
+--- gcc/ggc-common.c.orig	2014-12-10 03:45:40.000000000 +0000
++++ gcc/ggc-common.c
+@@ -603,6 +603,8 @@ gt_pch_restore (FILE *f)
+   size_t i;
+   struct mmap_info mmi;
+   int result;
++  struct line_maps * old_line_table = line_table;
++  location_t old_input_loc = input_location;
+ 
+   /* Delete any deletable objects.  This makes ggc_pch_read much
+      faster, as it can be sure that no GCable objects remain other
+@@ -616,32 +618,50 @@ gt_pch_restore (FILE *f)
+   /* Read in all the scalar variables.  */
+   for (rt = gt_pch_scalar_rtab; *rt; rt++)
+     for (rti = *rt; rti->base != NULL; rti++)
+-      if (fread (rti->base, rti->stride, 1, f) != 1)
++      if (fread (rti->base, rti->stride, 1, f) != 1) {
++        line_table = old_line_table;
++        input_location = old_input_loc;
+ 	fatal_error (input_location, "can%'t read PCH file: %m");
++      }
+ 
+   /* Read in all the global pointers, in 6 easy loops.  */
+   for (rt = gt_ggc_rtab; *rt; rt++)
+     for (rti = *rt; rti->base != NULL; rti++)
+       for (i = 0; i < rti->nelt; i++)
+ 	if (fread ((char *)rti->base + rti->stride * i,
+-		   sizeof (void *), 1, f) != 1)
++		   sizeof (void *), 1, f) != 1) {
++          line_table = old_line_table;
++          input_location = old_input_loc;
+ 	  fatal_error (input_location, "can%'t read PCH file: %m");
++        }
+ 
+-  if (fread (&mmi, sizeof (mmi), 1, f) != 1)
++  if (fread (&mmi, sizeof (mmi), 1, f) != 1) {
++    line_table = old_line_table;
++    input_location = old_input_loc;
+     fatal_error (input_location, "can%'t read PCH file: %m");
++  }
+ 
+   result = host_hooks.gt_pch_use_address (mmi.preferred_base, mmi.size,
+ 					  fileno (f), mmi.offset);
+-  if (result < 0)
++  if (result < 0) {
++    line_table = old_line_table;
++    input_location = old_input_loc;
+     fatal_error (input_location, "had to relocate PCH");
++  }
+   if (result == 0)
+     {
+       if (fseek (f, mmi.offset, SEEK_SET) != 0
+-	  || fread (mmi.preferred_base, mmi.size, 1, f) != 1)
++	  || fread (mmi.preferred_base, mmi.size, 1, f) != 1) {
++        line_table = old_line_table;
++        input_location = old_input_loc;
+ 	fatal_error (input_location, "can%'t read PCH file: %m");
++      }
+     }
+-  else if (fseek (f, mmi.offset + mmi.size, SEEK_SET) != 0)
+-    fatal_error (input_location, "can%'t read PCH file: %m");
++  else if (fseek (f, mmi.offset + mmi.size, SEEK_SET) != 0) {
++        line_table = old_line_table;
++        input_location = old_input_loc;
++        fatal_error (input_location, "can%'t read PCH file: %m");
++  }
+ 
+   ggc_pch_read (f, mmi.preferred_base);
+ 
diff --git a/gcc9snapshot/patches/patch-gcc_lto_lto.c b/gcc9snapshot/patches/patch-gcc_lto_lto.c
new file mode 100644
index 0000000000..24548d1d2f
--- /dev/null
+++ b/gcc9snapshot/patches/patch-gcc_lto_lto.c
@@ -0,0 +1,19 @@
+$NetBSD$
+
+Better fallback for netbsd<8 lacking WALLSIG.
+
+--- gcc/lto/lto.c.orig	2018-01-03 21:42:12.000000000 +0000
++++ gcc/lto/lto.c
+@@ -2321,7 +2321,11 @@ wait_for_child ()
+   do
+     {
+ #ifndef WCONTINUED
+-#define WCONTINUED 0
++#  ifdef WALLSIG
++#    define WCONTINUED WALLSIG
++#  else
++#    define WCONTINUED 0
++#  endif
+ #endif
+       int w = waitpid (0, &status, WUNTRACED | WCONTINUED);
+       if (w == -1)
diff --git a/gcc9snapshot/patches/patch-isl_configure b/gcc9snapshot/patches/patch-isl_configure
new file mode 100644
index 0000000000..bf7b06f067
--- /dev/null
+++ b/gcc9snapshot/patches/patch-isl_configure
@@ -0,0 +1,24 @@
+$NetBSD: patch-isl_configure,v 1.1 2017/05/03 00:21:03 maya Exp $
+
+Make test portable
+
+--- isl/configure.orig	2016-01-14 17:26:10.000000000 +0000
++++ isl/configure
+@@ -17561,7 +17561,7 @@ else
+ fi
+ 
+ 
+- if test "x$with_int" == "ximath-32"; then
++ if test "x$with_int" = "ximath-32"; then
+   SMALL_INT_OPT_TRUE=
+   SMALL_INT_OPT_FALSE='#'
+ else
+@@ -17569,7 +17569,7 @@ else
+   SMALL_INT_OPT_FALSE=
+ fi
+ 
+-if test "x$with_int" == "ximath-32"; then :
++if test "x$with_int" = "ximath-32"; then :
+ 
+ 
+ $as_echo "#define USE_SMALL_INT_OPT /**/" >>confdefs.h
diff --git a/gcc9snapshot/patches/patch-libffi_configure b/gcc9snapshot/patches/patch-libffi_configure
new file mode 100644
index 0000000000..e6b73fc732
--- /dev/null
+++ b/gcc9snapshot/patches/patch-libffi_configure
@@ -0,0 +1,13 @@
+$NetBSD: patch-libffi_configure,v 1.1 2017/05/03 00:21:03 maya Exp $
+
+--- libffi/configure.orig	2013-06-01 17:03:49.000000000 +0000
++++ libffi/configure
+@@ -12689,7 +12689,7 @@ case "$target" in
+ $as_echo "#define FFI_EXEC_TRAMPOLINE_TABLE 1" >>confdefs.h
+ 
+      ;;
+-     *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*)
++     *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-netbsd* | *-*-openbsd* | *-pc-solaris*)
+ 
+ $as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h
+ 
diff --git a/gcc9snapshot/patches/patch-libffi_testsuite_libffi.call_float2.c b/gcc9snapshot/patches/patch-libffi_testsuite_libffi.call_float2.c
new file mode 100644
index 0000000000..8145b80c0b
--- /dev/null
+++ b/gcc9snapshot/patches/patch-libffi_testsuite_libffi.call_float2.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-libffi_testsuite_libffi.call_float2.c,v 1.1 2017/05/03 00:21:03 maya Exp $
+
+--- libffi/testsuite/libffi.call/float2.c.orig	2013-06-01 17:08:18.000000000 +0000
++++ libffi/testsuite/libffi.call/float2.c
+@@ -45,7 +45,7 @@ int main (void)
+   /* This is ifdef'd out for now. long double support under SunOS/gcc
+      is pretty much non-existent.  You'll get the odd bus error in library
+      routines like printf().  */
+-  printf ("%Lf, %Lf, %Lf, %Lf\n", ld, ldblit(f), ld - ldblit(f), LDBL_EPSILON);
++  printf ("%Lf, %Lf, %Lf, %Lf\n", (long double)ld, (long double)ldblit(f), (long double)(ld - ldblit(f)), (long double)LDBL_EPSILON);
+ #endif
+ 
+   /* These are not always the same!! Check for a reasonable delta */
diff --git a/gcc9snapshot/patches/patch-libgcc_config.host b/gcc9snapshot/patches/patch-libgcc_config.host
new file mode 100644
index 0000000000..79f3776dcf
--- /dev/null
+++ b/gcc9snapshot/patches/patch-libgcc_config.host
@@ -0,0 +1,19 @@
+$NetBSD$
+
+Add libgcc x86 netbsd config
+
+--- libgcc/config.host.orig	2017-03-10 19:33:27.000000000 +0000
++++ libgcc/config.host
+@@ -605,10 +605,10 @@ x86_64-*-freebsd*)
+ 	md_unwind_header=i386/freebsd-unwind.h
+ 	;;
+ i[34567]86-*-netbsdelf*)
+-	tmake_file="${tmake_file} i386/t-crtstuff"
++	tmake_file="${tmake_file} i386/t-netbsd i386/t-crtstuff"
+ 	;;
+ x86_64-*-netbsd*)
+-	tmake_file="${tmake_file} i386/t-crtstuff"
++	tmake_file="${tmake_file} i386/t-netbsd i386/t-crtstuff"
+ 	;;
+ i[34567]86-*-openbsd*)
+ 	;;
diff --git a/gcc9snapshot/patches/patch-libgcc_crtstuff.c b/gcc9snapshot/patches/patch-libgcc_crtstuff.c
new file mode 100644
index 0000000000..aca55d4c94
--- /dev/null
+++ b/gcc9snapshot/patches/patch-libgcc_crtstuff.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-libgcc_crtstuff.c,v 1.1 2017/05/03 00:21:03 maya Exp $
+
+--- libgcc/crtstuff.c.orig	2017-01-01 12:07:43.000000000 +0000
++++ libgcc/crtstuff.c
+@@ -81,7 +81,7 @@ call_ ## FUNC (void)					\
+ #endif
+ 
+ #if defined(TARGET_DL_ITERATE_PHDR) && \
+-   (defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__))
++   (defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__))
+ #define BSD_DL_ITERATE_PHDR_AVAILABLE
+ #endif
+  
diff --git a/gcc9snapshot/patches/patch-libgfortran_io_io.h b/gcc9snapshot/patches/patch-libgfortran_io_io.h
new file mode 100644
index 0000000000..995f2d296e
--- /dev/null
+++ b/gcc9snapshot/patches/patch-libgfortran_io_io.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+Don't declare old_locale* an internal_proto to avoid linking problems
+
+--- libgfortran/io/io.h.orig	2018-01-07 10:17:52.000000000 +0000
++++ libgfortran/io/io.h
+@@ -57,11 +57,8 @@ extern locale_t c_locale;
+ internal_proto(c_locale);
+ #else
+ extern char* old_locale;
+-internal_proto(old_locale);
+ extern int old_locale_ctr;
+-internal_proto(old_locale_ctr);
+ extern __gthread_mutex_t old_locale_lock;
+-internal_proto(old_locale_lock);
+ #endif
+ 
+ 
diff --git a/gcc9snapshot/patches/patch-libphobos_configure.tgt b/gcc9snapshot/patches/patch-libphobos_configure.tgt
new file mode 100644
index 0000000000..777ac55ed6
--- /dev/null
+++ b/gcc9snapshot/patches/patch-libphobos_configure.tgt
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Add netbsd/x86
+
+--- libphobos/configure.tgt.orig	2019-01-01 12:31:55.000000000 +0000
++++ libphobos/configure.tgt
+@@ -30,6 +30,8 @@ case "${target}" in
+ 	;;
+   x86_64-*-linux* | i?86-*-linux*)
+ 	;;
++  x86_64-*-netbsd* | i?86-*-netbsd*)
++  	;;
+   *)
+ 	UNSUPPORTED=1
+ 	;;
diff --git a/gcc9snapshot/patches/patch-libphobos_libdruntime_core_stdc_assert__.d b/gcc9snapshot/patches/patch-libphobos_libdruntime_core_stdc_assert__.d
new file mode 100644
index 0000000000..5d2badf9c3
--- /dev/null
+++ b/gcc9snapshot/patches/patch-libphobos_libdruntime_core_stdc_assert__.d
@@ -0,0 +1,18 @@
+$NetBSD$
+
+--- libphobos/libdruntime/core/stdc/assert_.d.orig	2018-10-28 19:51:47.000000000 +0000
++++ libphobos/libdruntime/core/stdc/assert_.d
+@@ -53,6 +53,13 @@ else version (FreeBSD)
+      */
+     void __assert(const(char)* exp, const(char)* file, uint line);
+ }
++else version (NetBSD)
++{
++    /***
++     * Assert failure function in the NetBSD C library.
++     */
++    void __assert(const(char)* file, int line, const(char)* exp);
++}
+ else version (DragonFlyBSD)
+ {
+     /***
diff --git a/gcc9snapshot/patches/patch-libphobos_libdruntime_core_stdc_wchar_.d b/gcc9snapshot/patches/patch-libphobos_libdruntime_core_stdc_wchar_.d
new file mode 100644
index 0000000000..057ed4cd59
--- /dev/null
+++ b/gcc9snapshot/patches/patch-libphobos_libdruntime_core_stdc_wchar_.d
@@ -0,0 +1,20 @@
+$NetBSD$
+
+--- libphobos/libdruntime/core/stdc/wchar_.d.orig	2018-10-28 19:51:47.000000000 +0000
++++ libphobos/libdruntime/core/stdc/wchar_.d
+@@ -43,6 +43,15 @@ version (CRuntime_Glibc)
+         ___value __value;
+     }
+ }
++else version (NetBSD)
++{
++    union __mbstate_t
++    {
++        int64_t   __mbstateL;
++        char[128] __mbstate8;
++    }
++    alias mbstate_t = __mbstate_t;
++}
+ else version (OpenBSD)
+ {
+     union __mbstate_t
diff --git a/gcc9snapshot/patches/patch-libphobos_libdruntime_core_sys_netbsd_dlfcn.d b/gcc9snapshot/patches/patch-libphobos_libdruntime_core_sys_netbsd_dlfcn.d
new file mode 100644
index 0000000000..6046789ab4
--- /dev/null
+++ b/gcc9snapshot/patches/patch-libphobos_libdruntime_core_sys_netbsd_dlfcn.d
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- libphobos/libdruntime/core/sys/netbsd/dlfcn.d.orig	2018-10-28 19:51:47.000000000 +0000
++++ libphobos/libdruntime/core/sys/netbsd/dlfcn.d
+@@ -103,7 +103,7 @@ static if (__BSD_VISIBLE)
+     //void*    fdlopen(int, int);
+     int      dladdr(const(void)*, Dl_info*);
+     //dlfunc_t dlfunc(void*, const(char)*);
+-    //int      dlinfo(void*, int, void*);
++    int      dlinfo(void*, int, void*);
+     /+void     dllockinit(void* _context,
+         void* function(void* _context) _lock_create,
+         void  function(void* _lock)    _rlock_acquire,
diff --git a/gcc9snapshot/patches/patch-libphobos_libdruntime_core_sys_netbsd_execinfo.d b/gcc9snapshot/patches/patch-libphobos_libdruntime_core_sys_netbsd_execinfo.d
new file mode 100644
index 0000000000..f6caa736e3
--- /dev/null
+++ b/gcc9snapshot/patches/patch-libphobos_libdruntime_core_sys_netbsd_execinfo.d
@@ -0,0 +1,111 @@
+$NetBSD$
+
+--- libphobos/libdruntime/core/sys/netbsd/execinfo.d.orig	2018-10-28 19:51:47.000000000 +0000
++++ libphobos/libdruntime/core/sys/netbsd/execinfo.d
+@@ -14,103 +14,9 @@ nothrow:
+ 
+ import core.sys.netbsd.dlfcn;
+ 
+-// Use extern (D) so that these functions don't collide with libexecinfo.
+-
+-extern (D) int backtrace(void** buffer, int size)
+-{
+-    import core.thread : thread_stackBottom;
+-
+-    void** p, pend=cast(void**)thread_stackBottom();
+-    version (D_InlineAsm_X86)
+-        asm nothrow @trusted { mov p[EBP], EBP; }
+-    else version (D_InlineAsm_X86_64)
+-        asm nothrow @trusted { mov p[RBP], RBP; }
+-    else
+-        static assert(false, "Architecture not supported.");
+-
+-    int i;
+-    for (; i < size && p < pend; ++i)
+-    {
+-        buffer[i] = *(p + 1);
+-        auto pnext = cast(void**)*p;
+-        if (pnext <= p) break;
+-        p = pnext;
+-    }
+-    return i;
+-}
+-
+-
+-extern (D) char** backtrace_symbols(const(void*)* buffer, int size)
+-{
+-    static void* realloc(void* p, size_t len) nothrow
+-    {
+-        static import cstdlib=core.stdc.stdlib;
+-        auto res = cstdlib.realloc(p, len);
+-        if (res is null) cstdlib.free(p);
+-        return res;
+-    }
+-
+-    if (size <= 0) return null;
+-
+-    size_t pos = size * (char*).sizeof;
+-    char** p = cast(char**)realloc(null, pos);
+-    if (p is null) return null;
+-
+-    Dl_info info;
+-    foreach (i, addr; buffer[0 .. size])
+-    {
+-        if (dladdr(addr, &info) == 0)
+-            (cast(ubyte*)&info)[0 .. info.sizeof] = 0;
+-        fixupDLInfo(addr, info);
+-
+-        immutable len = formatStackFrame(null, 0, addr, info);
+-        assert(len > 0);
+-
+-        p = cast(char**)realloc(p, pos + len);
+-        if (p is null) return null;
+-
+-        formatStackFrame(cast(char*)p + pos, len, addr, info) == len || assert(0);
+-
+-        p[i] = cast(char*)pos;
+-        pos += len;
+-    }
+-    foreach (i; 0 .. size)
+-    {
+-        pos = cast(size_t)p[i];
+-        p[i] = cast(char*)p + pos;
+-    }
+-    return p;
+-}
+-
+-
+-extern (D) void backtrace_symbols_fd(const(void*)* buffer, int size, int fd)
+-{
+-    import core.sys.posix.unistd : write;
+-    import core.stdc.stdlib : alloca;
+-
+-    if (size <= 0) return;
+-
+-    Dl_info info;
+-    foreach (i, addr; buffer[0 .. size])
+-    {
+-        if (dladdr(addr, &info) == 0)
+-            (cast(ubyte*)&info)[0 .. info.sizeof] = 0;
+-        fixupDLInfo(addr, info);
+-
+-        enum maxAlloca = 1024;
+-        enum min = (size_t a, size_t b) => a <= b ? a : b;
+-        immutable len = min(formatStackFrame(null, 0, addr, info), maxAlloca);
+-        assert(len > 0);
+-
+-        auto p = cast(char*)alloca(len);
+-        if (p is null) return;
+-
+-        formatStackFrame(p, len, addr, info) >= len || assert(0);
+-        p[len - 1] = '\n';
+-        write(fd, p, len);
+-    }
+-}
+-
++int backtrace(void** buffer, size_t size);
++char** backtrace_symbols(const(void*)* buffer, size_t size);
++int backtrace_symbols_fd(const(void*)* buffer, size_t size, int fd);
+ 
+ private void fixupDLInfo(const(void)* addr, ref Dl_info info)
+ {
diff --git a/gcc9snapshot/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h b/gcc9snapshot/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h
new file mode 100644
index 0000000000..563a057d25
--- /dev/null
+++ b/gcc9snapshot/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h
@@ -0,0 +1,54 @@
+$NetBSD: patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h,v 1.1 2017/05/03 00:21:03 maya Exp $
+
+Sync with netbsd ctype_base.h
+
+--- libstdc++-v3/config/os/bsd/netbsd/ctype_base.h.orig	2018-01-03 10:03:58.000000000 +0000
++++ libstdc++-v3/config/os/bsd/netbsd/ctype_base.h
+@@ -38,14 +38,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+   /// @brief  Base class for ctype.
+   struct ctype_base
+   {
+-    // Non-standard typedefs.
+-    typedef const unsigned char*	__to_type;
+ 
+     // NB: Offsets into ctype<char>::_M_table force a particular size
+     // on the mask type. Because of this, we don't use an enum.
+-    typedef unsigned char      	mask;
+ 
+ #ifndef _CTYPE_U
++    // Non-standard typedefs.
++    typedef const unsigned char*	__to_type;
++
++    typedef unsigned char      	mask;
++
+     static const mask upper    	= _U;
+     static const mask lower 	= _L;
+     static const mask alpha 	= _U | _L;
+@@ -58,17 +60,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     static const mask punct 	= _P;
+     static const mask alnum 	= _U | _L | _N;
+ #else
++    typedef const unsigned short*	__to_type;
++
++    typedef unsigned short     	mask;
++
+     static const mask upper    	= _CTYPE_U;
+     static const mask lower 	= _CTYPE_L;
+-    static const mask alpha 	= _CTYPE_U | _CTYPE_L;
+-    static const mask digit 	= _CTYPE_N;
+-    static const mask xdigit 	= _CTYPE_N | _CTYPE_X;
++    static const mask alpha 	= _CTYPE_A;
++    static const mask digit 	= _CTYPE_D;
++    static const mask xdigit 	= _CTYPE_X;
+     static const mask space 	= _CTYPE_S;
+-    static const mask print 	= _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N | _CTYPE_B;
+-    static const mask graph 	= _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N;
++    static const mask print 	= _CTYPE_R;
++    static const mask graph 	= _CTYPE_G;
+     static const mask cntrl 	= _CTYPE_C;
+     static const mask punct 	= _CTYPE_P;
+-    static const mask alnum 	= _CTYPE_U | _CTYPE_L | _CTYPE_N;
++    static const mask alnum 	= _CTYPE_A | _CTYPE_D;
+ #endif
+ #if __cplusplus >= 201103L
+     static const mask blank 	= space;
diff --git a/gcc9snapshot/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc b/gcc9snapshot/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc
new file mode 100644
index 0000000000..8ccd4c8be1
--- /dev/null
+++ b/gcc9snapshot/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc
@@ -0,0 +1,81 @@
+$NetBSD: patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc,v 1.1 2017/05/03 00:21:03 maya Exp $
+
+Sync with netbsd ctype_configure_char.cc
+
+--- libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc.orig	2018-01-03 10:03:58.000000000 +0000
++++ libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc
+@@ -38,29 +38,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 
+ // Information as gleaned from /usr/include/ctype.h
+ 
+-  extern "C" const u_int8_t _C_ctype_[];
+-
+   const ctype_base::mask*
+   ctype<char>::classic_table() throw()
+-  { return _C_ctype_ + 1; }
++  { return _C_ctype_tab_ + 1; }
+ 
+-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+-		     size_t __refs)
+-  : facet(__refs), _M_del(__table != 0 && __del),
+-  _M_toupper(NULL), _M_tolower(NULL),
++  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
++		     size_t __refs) 
++  : facet(__refs), _M_del(__table != 0 && __del), 
++  _M_toupper(NULL), _M_tolower(NULL), 
+   _M_table(__table ? __table : classic_table())
+-  {
++  { 
+     memset(_M_widen, 0, sizeof(_M_widen));
+     _M_widen_ok = 0;
+     memset(_M_narrow, 0, sizeof(_M_narrow));
+     _M_narrow_ok = 0;
+   }
+ 
+-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
+-  : facet(__refs), _M_del(__table != 0 && __del),
+-  _M_toupper(NULL), _M_tolower(NULL),
++  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
++  : facet(__refs), _M_del(__table != 0 && __del), 
++  _M_toupper(NULL), _M_tolower(NULL), 
+   _M_table(__table ? __table : classic_table())
+-  {
++  { 
+     memset(_M_widen, 0, sizeof(_M_widen));
+     _M_widen_ok = 0;
+     memset(_M_narrow, 0, sizeof(_M_narrow));
+@@ -69,14 +67,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 
+   char
+   ctype<char>::do_toupper(char __c) const
+-  { return ::toupper((int) __c); }
++  { return ::toupper((int)(unsigned char) __c); }
+ 
+   const char*
+   ctype<char>::do_toupper(char* __low, const char* __high) const
+   {
+     while (__low < __high)
+       {
+-	*__low = ::toupper((int) *__low);
++	*__low = ::toupper((int)(unsigned char) *__low);
+ 	++__low;
+       }
+     return __high;
+@@ -84,14 +82,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 
+   char
+   ctype<char>::do_tolower(char __c) const
+-  { return ::tolower((int) __c); }
++  { return ::tolower((int)(unsigned char) __c); }
+ 
+-  const char*
++  const char* 
+   ctype<char>::do_tolower(char* __low, const char* __high) const
+   {
+     while (__low < __high)
+       {
+-	*__low = ::tolower((int) *__low);
++	*__low = ::tolower((int)(unsigned char) *__low);
+ 	++__low;
+       }
+     return __high;
diff --git a/gcc9snapshot/version.mk b/gcc9snapshot/version.mk
new file mode 100644
index 0000000000..fecd12308c
--- /dev/null
+++ b/gcc9snapshot/version.mk
@@ -0,0 +1,2 @@
+# $NetBSD: version.mk,v 1.21 2015/05/06 05:25:00 keckhardt Exp $
+GCC9S_DIST_VERSION:=	9-20190120


Home | Main Index | Thread Index | Old Index