summaryrefslogtreecommitdiff
path: root/lang/gcc8
diff options
context:
space:
mode:
authormaya <maya@pkgsrc.org>2018-05-05 04:08:36 +0000
committermaya <maya@pkgsrc.org>2018-05-05 04:08:36 +0000
commit18eef8e57a20c7e164ceadc80a1fb023e31e40ab (patch)
treedd55269e1360cdd9b1d2bd0f895000a4a6081719 /lang/gcc8
parent0466add5dbec92d8ce4872e592af8ccf8f283695 (diff)
downloadpkgsrc-18eef8e57a20c7e164ceadc80a1fb023e31e40ab.tar.gz
Add gcc8 8.1.0
Release notes are very long and pretty-printed at: https://gcc.gnu.org/gcc-8/changes.html
Diffstat (limited to 'lang/gcc8')
-rw-r--r--lang/gcc8/DESCR4
-rw-r--r--lang/gcc8/Makefile203
-rw-r--r--lang/gcc8/buildlink3.mk27
-rw-r--r--lang/gcc8/distinfo32
-rw-r--r--lang/gcc8/options.mk130
-rw-r--r--lang/gcc8/patches/patch-contrib_download__prerequisites15
-rw-r--r--lang/gcc8/patches/patch-gcc_Makefile.in15
-rw-r--r--lang/gcc8/patches/patch-gcc_config.gcc29
-rw-r--r--lang/gcc8/patches/patch-gcc_config_arm_arm.h20
-rw-r--r--lang/gcc8/patches/patch-gcc_config_netbsd-protos.h34
-rw-r--r--lang/gcc8/patches/patch-gcc_config_t-netbsd28
-rw-r--r--lang/gcc8/patches/patch-gcc_config_x-netbsd12
-rw-r--r--lang/gcc8/patches/patch-gcc_configure13
-rw-r--r--lang/gcc8/patches/patch-gcc_ggc-common.c71
-rw-r--r--lang/gcc8/patches/patch-gcc_lto_lto.c19
-rw-r--r--lang/gcc8/patches/patch-isl_configure24
-rw-r--r--lang/gcc8/patches/patch-libffi_configure13
-rw-r--r--lang/gcc8/patches/patch-libffi_testsuite_libffi.call_float2.c13
-rw-r--r--lang/gcc8/patches/patch-libgcc_config.host19
-rw-r--r--lang/gcc8/patches/patch-libgcc_crtstuff.c13
-rw-r--r--lang/gcc8/patches/patch-libgfortran_io_io.h18
-rw-r--r--lang/gcc8/patches/patch-libsanitizer_configure.tgt19
-rw-r--r--lang/gcc8/patches/patch-libsanitizer_sanitizer__common_Makefile.am17
-rw-r--r--lang/gcc8/patches/patch-libsanitizer_sanitizer__common_Makefile.in28
-rw-r--r--lang/gcc8/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h54
-rw-r--r--lang/gcc8/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc81
-rw-r--r--lang/gcc8/patches/patch-libstdc++-v3_libsupc++_new__opa.cc17
-rw-r--r--lang/gcc8/version.mk2
28 files changed, 970 insertions, 0 deletions
diff --git a/lang/gcc8/DESCR b/lang/gcc8/DESCR
new file mode 100644
index 00000000000..e1291cbc058
--- /dev/null
+++ b/lang/gcc8/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/lang/gcc8/Makefile b/lang/gcc8/Makefile
new file mode 100644
index 00000000000..f22b1207de2
--- /dev/null
+++ b/lang/gcc8/Makefile
@@ -0,0 +1,203 @@
+# $NetBSD: Makefile,v 1.1 2018/05/05 04:08:36 maya Exp $
+
+GCC_PKGNAME= gcc8
+.include "version.mk"
+
+DISTNAME= gcc-${GCC8_DIST_VERSION}
+PKGNAME= ${GCC_PKGNAME}-${GCC8_DIST_VERSION}
+## When bumping the PKGREVISION of this package the PKGREVISION of
+## lang/gcc8-libs needs to be bump to be at least 1 more than the
+## PKGREVISION of this package!
+#PKGREVISION= 1
+CATEGORIES= lang
+MASTER_SITES= ${MASTER_SITE_GNU:=gcc/gcc-${GCC8_DIST_VERSION}/}
+EXTRACT_SUFX= .tar.xz
+
+MAINTAINER= pkgsrc-users@NetBSD.org
+HOMEPAGE= http://gcc.gnu.org/
+COMMENT= The GNU Compiler Collection (GCC) - 8.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
+CONFIGURE_ARGS+= --disable-libstdcxx-pch
+CONFIGURE_ARGS+= --with-system-zlib
+
+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++
+
+# Disable fixincludes on SmartOS, header changes result in broken includes
+# being generated, see https://github.com/joyent/pkgsrc-legacy/issues/270
+.if ${OS_VARIANT} == "SmartOS"
+SUBST_CLASSES+= fixinc
+SUBST_STAGE.fixinc= pre-configure
+SUBST_FILES.fixinc= gcc/Makefile.in
+SUBST_SED.fixinc= -e "s,\./fixinc.sh,-c true,"
+.endif
+
+.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
+# Match base libstdc++ major
+SUBST_CLASSES+= libstdc
+SUBST_STAGE.libstdc= pre-configure
+SUBST_FILES.libstdc= libstdc++-v3/configure
+SUBST_MESSAGE.libstdc= Bumping libstdc++ major to 7
+SUBST_SED.libstdc= -e 's,libtool_VERSION=6:,libtool_VERSION=7:,g'
+.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}
+# multilib on Darwin requires fat-binaries
+CONFIGURE_ARGS.Darwin+= --disable-multilib
+.if !empty(OSX_SDK_PATH)
+CONFIGURE_ARGS.Darwin+= --with-sysroot=${OSX_SDK_PATH}
+.endif
+.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
+
+CONFIGURE_ARGS.DragonFly+= --disable-bootstrap
+
+.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
+
+.if ${OS_VARIANT} == "SmartOS"
+SUBST_CLASSES+= ccs
+SUBST_STAGE.ccs= pre-configure
+SUBST_FILES.ccs= contrib/make_sunver.pl
+SUBST_SED.ccs= -e 's,/usr/ccs/bin,/usr/bin,g'
+.endif
+
+pre-configure:
+ ${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}
+
+TEST_TARGET= -j ${MAKE_JOBS} -k check || ${TRUE}
+TEST_DEPENDS+= dejagnu-[0-9]*:../../devel/dejagnu
+
+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 "../../devel/zlib/buildlink3.mk"
+.include "../../lang/python/application.mk"
+.include "../../mk/dlopen.buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/lang/gcc8/buildlink3.mk b/lang/gcc8/buildlink3.mk
new file mode 100644
index 00000000000..39eb2010231
--- /dev/null
+++ b/lang/gcc8/buildlink3.mk
@@ -0,0 +1,27 @@
+# $NetBSD: buildlink3.mk,v 1.1 2018/05/05 04:08:36 maya Exp $
+
+BUILDLINK_TREE+= gcc8
+
+.if !defined(GCC8_BUILDLINK3_MK)
+GCC6SNAPSHOT_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.gcc8+= gcc8>=${_GCC_REQD}
+BUILDLINK_ABI_DEPENDS.gcc8+= gcc8>=8.0
+BUILDLINK_PKGSRCDIR.gcc8= ../../lang/gcc8
+BUILDLINK_DEPMETHOD.gcc8?= build
+
+BUILDLINK_FILES.gcc8= #empty
+BUILDLINK_AUTO_VARS.gcc8= no
+
+# Packages that link against shared libraries need a full dependency.
+#.if defined(_USE_GCC_SHLIB)
+#DEPENDS+= {gcc8, gcc8-libs}>=${_GCC_REQD}:../../lang/gcc8-libs
+#ABI_DEPENDS+= {gcc8,gcc8-libs}>=8.0:../../lang/gcc8-libs
+#.endif
+
+pkgbase := gcc8
+.include "../../mk/pkg-build-options.mk"
+.include "../../mk/dlopen.buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
+.endif # gcc8_BUILDLINK3_MK
+BUILDLINK_TREE+= -gcc8
diff --git a/lang/gcc8/distinfo b/lang/gcc8/distinfo
new file mode 100644
index 00000000000..46f7c6d4a00
--- /dev/null
+++ b/lang/gcc8/distinfo
@@ -0,0 +1,32 @@
+$NetBSD: distinfo,v 1.1 2018/05/05 04:08:36 maya Exp $
+
+SHA1 (gcc-8.1.0.tar.xz) = b34031ba9ff3e248b2c62de0825e49a1e0e01998
+RMD160 (gcc-8.1.0.tar.xz) = de00e96f3d70b6a08215930a6884672e56975d05
+SHA512 (gcc-8.1.0.tar.xz) = c96246f34a7aeb404c4525b754dc7f7708a18e06271aadb2b32fef00e6e0940f584e52430bfe2ab01e699c93e3cb418adc113d2622fa826facbec0ec8ce3eb2c
+Size (gcc-8.1.0.tar.xz) = 63372320 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) = c57c3668688a96950a706cb9643b40e5631545f9
+SHA1 (patch-gcc_config_arm_arm.h) = aba0bab2489cb7224d45eca0977156fe4f7a74a8
+SHA1 (patch-gcc_config_netbsd-protos.h) = 6d28864b4ccc8c1a63fe28e43601b84b63a00633
+SHA1 (patch-gcc_config_t-netbsd) = 802ad5706aa7ca9629f8e237f08fbb1569d28846
+SHA1 (patch-gcc_config_x-netbsd) = 6dc3d78e26df62054ea29f98ca51592858e671e3
+SHA1 (patch-gcc_configure) = 15fb7af267b79965f83bc64ce8aad1279b0ea52d
+SHA1 (patch-gcc_ggc-common.c) = a5d2dba635859f5d680c3f80d7c30b42461c752b
+SHA1 (patch-gcc_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-libsanitizer_configure.tgt) = 0a47782f01631d1c91e28a8735865c8571fbcf7d
+SHA1 (patch-libsanitizer_sanitizer__common_Makefile.am) = 4cf6c4f5189078e8f092bfefc1f57ff32d5319ee
+SHA1 (patch-libsanitizer_sanitizer__common_Makefile.in) = 62382c683e98bd8f2f27bd07ef01bdfadcdf256a
+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
+SHA1 (patch-libstdc++-v3_libsupc++_new__opa.cc) = c23679d5bd18ba82c578eb2909a8055bf37c34cd
diff --git a/lang/gcc8/options.mk b/lang/gcc8/options.mk
new file mode 100644
index 00000000000..fcce905d53f
--- /dev/null
+++ b/lang/gcc8/options.mk
@@ -0,0 +1,130 @@
+# $NetBSD: options.mk,v 1.1 2018/05/05 04:08:36 maya Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.${GCC_PKGNAME}
+PKG_SUPPORTED_OPTIONS= nls gcc-inplace-math gcc-c++ gcc-fortran \
+ gcc-go 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/x86_64-linux-gnu/gnu)
+_GNU_INCLUDE_DIR= /usr/include/x86_64-linux-gnu/gnu
+. else
+_GNU_INCLUDE_DIR= /usr/include/gnu
+. endif
+. if exists(${_GNU_INCLUDE_DIR}/stubs-64.h) && \
+ !exists(${_GNU_INCLUDE_DIR}/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-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/lang/gcc8/patches/patch-contrib_download__prerequisites b/lang/gcc8/patches/patch-contrib_download__prerequisites
new file mode 100644
index 00000000000..7ae3cae9ed2
--- /dev/null
+++ b/lang/gcc8/patches/patch-contrib_download__prerequisites
@@ -0,0 +1,15 @@
+$NetBSD: patch-contrib_download__prerequisites,v 1.1 2018/05/05 04:08:36 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/lang/gcc8/patches/patch-gcc_Makefile.in b/lang/gcc8/patches/patch-gcc_Makefile.in
new file mode 100644
index 00000000000..83dca3d54d1
--- /dev/null
+++ b/lang/gcc8/patches/patch-gcc_Makefile.in
@@ -0,0 +1,15 @@
+$NetBSD: patch-gcc_Makefile.in,v 1.1 2018/05/05 04:08:36 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/lang/gcc8/patches/patch-gcc_config.gcc b/lang/gcc8/patches/patch-gcc_config.gcc
new file mode 100644
index 00000000000..fb35f167abe
--- /dev/null
+++ b/lang/gcc8/patches/patch-gcc_config.gcc
@@ -0,0 +1,29 @@
+$NetBSD: patch-gcc_config.gcc,v 1.1 2018/05/05 04:08:36 maya Exp $
+
+--- gcc/config.gcc.orig 2017-10-21 21:09:53.000000000 +0000
++++ gcc/config.gcc
+@@ -801,6 +801,11 @@ case ${target} in
+ gas=yes
+ gnu_ld=yes
+ use_gcc_stdint=wrap
++ # cabs/cabsf are renamed to __c99_cabs/cabsf
++ tm_p_file="${tm_p_file} netbsd-protos.h"
++ target_gtfiles="${target_gtfiles} \$(srcdir)/config/netbsd.c"
++ extra_objs="${extra_objs} netbsd.o"
++ default_gnu_indirect_function=yes
+ case ${enable_threads} in
+ "" | yes | posix) thread_file='posix' ;;
+ esac
+@@ -1498,10 +1503,12 @@ x86_64-*-freebsd*)
+ 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/lang/gcc8/patches/patch-gcc_config_arm_arm.h b/lang/gcc8/patches/patch-gcc_config_arm_arm.h
new file mode 100644
index 00000000000..054cee938e9
--- /dev/null
+++ b/lang/gcc8/patches/patch-gcc_config_arm_arm.h
@@ -0,0 +1,20 @@
+$NetBSD: patch-gcc_config_arm_arm.h,v 1.1 2018/05/05 04:08:36 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 2018-03-22 17:24:41.000000000 +0000
++++ gcc/config/arm/arm.h
+@@ -2195,7 +2195,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(__linux__) || defined(__FreeBSD__))
+ 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/lang/gcc8/patches/patch-gcc_config_netbsd-protos.h b/lang/gcc8/patches/patch-gcc_config_netbsd-protos.h
new file mode 100644
index 00000000000..963ac8333ff
--- /dev/null
+++ b/lang/gcc8/patches/patch-gcc_config_netbsd-protos.h
@@ -0,0 +1,34 @@
+$NetBSD: patch-gcc_config_netbsd-protos.h,v 1.1 2018/05/05 04:08:36 maya Exp $
+
+--- /dev/null 2014-12-15 07:13:57.000000000 +0000
++++ gcc/config/netbsd-protos.h
+@@ -0,0 +1,29 @@
++/* 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_ */
diff --git a/lang/gcc8/patches/patch-gcc_config_t-netbsd b/lang/gcc8/patches/patch-gcc_config_t-netbsd
new file mode 100644
index 00000000000..b087f469e5b
--- /dev/null
+++ b/lang/gcc8/patches/patch-gcc_config_t-netbsd
@@ -0,0 +1,28 @@
+$NetBSD: patch-gcc_config_t-netbsd,v 1.1 2018/05/05 04:08:36 maya Exp $
+
+--- /dev/null 2014-12-16 20:23:05.000000000 +0000
++++ gcc/config/t-netbsd
+@@ -0,0 +1,23 @@
++# Copyright (C) 2002-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/>.
++
++
++netbsd.o: $(srcdir)/config/netbsd.c
++ $(COMPILE) $<
++ $(POSTCOMPILE)
++
diff --git a/lang/gcc8/patches/patch-gcc_config_x-netbsd b/lang/gcc8/patches/patch-gcc_config_x-netbsd
new file mode 100644
index 00000000000..a54d008a5f0
--- /dev/null
+++ b/lang/gcc8/patches/patch-gcc_config_x-netbsd
@@ -0,0 +1,12 @@
+$NetBSD: patch-gcc_config_x-netbsd,v 1.1 2018/05/05 04:08:36 maya Exp $
+
+Add host hooks for NetBSD - needed for working precompiled headers.
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58397
+
+--- /dev/null 2013-09-11 09:12:57.000000000 +0200
++++ gcc/config/x-netbsd 2013-09-10 18:57:27.000000000 +0200
+@@ -0,0 +1,4 @@
++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/lang/gcc8/patches/patch-gcc_configure b/lang/gcc8/patches/patch-gcc_configure
new file mode 100644
index 00000000000..ff0be442822
--- /dev/null
+++ b/lang/gcc8/patches/patch-gcc_configure
@@ -0,0 +1,13 @@
+$NetBSD: patch-gcc_configure,v 1.1 2018/05/05 04:08:36 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/lang/gcc8/patches/patch-gcc_ggc-common.c b/lang/gcc8/patches/patch-gcc_ggc-common.c
new file mode 100644
index 00000000000..3ab0bcb2a64
--- /dev/null
+++ b/lang/gcc8/patches/patch-gcc_ggc-common.c
@@ -0,0 +1,71 @@
+$NetBSD: patch-gcc_ggc-common.c,v 1.1 2018/05/05 04:08:36 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/lang/gcc8/patches/patch-gcc_lto_lto.c b/lang/gcc8/patches/patch-gcc_lto_lto.c
new file mode 100644
index 00000000000..700d61a5e1c
--- /dev/null
+++ b/lang/gcc8/patches/patch-gcc_lto_lto.c
@@ -0,0 +1,19 @@
+$NetBSD: patch-gcc_lto_lto.c,v 1.1 2018/05/05 04:08:36 maya Exp $
+
+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/lang/gcc8/patches/patch-isl_configure b/lang/gcc8/patches/patch-isl_configure
new file mode 100644
index 00000000000..0a9eb6f67c5
--- /dev/null
+++ b/lang/gcc8/patches/patch-isl_configure
@@ -0,0 +1,24 @@
+$NetBSD: patch-isl_configure,v 1.1 2018/05/05 04:08:36 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/lang/gcc8/patches/patch-libffi_configure b/lang/gcc8/patches/patch-libffi_configure
new file mode 100644
index 00000000000..7df2990e992
--- /dev/null
+++ b/lang/gcc8/patches/patch-libffi_configure
@@ -0,0 +1,13 @@
+$NetBSD: patch-libffi_configure,v 1.1 2018/05/05 04:08:36 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/lang/gcc8/patches/patch-libffi_testsuite_libffi.call_float2.c b/lang/gcc8/patches/patch-libffi_testsuite_libffi.call_float2.c
new file mode 100644
index 00000000000..648f705cf54
--- /dev/null
+++ b/lang/gcc8/patches/patch-libffi_testsuite_libffi.call_float2.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-libffi_testsuite_libffi.call_float2.c,v 1.1 2018/05/05 04:08:36 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/lang/gcc8/patches/patch-libgcc_config.host b/lang/gcc8/patches/patch-libgcc_config.host
new file mode 100644
index 00000000000..31c759d99ae
--- /dev/null
+++ b/lang/gcc8/patches/patch-libgcc_config.host
@@ -0,0 +1,19 @@
+$NetBSD: patch-libgcc_config.host,v 1.1 2018/05/05 04:08:36 maya Exp $
+
+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/lang/gcc8/patches/patch-libgcc_crtstuff.c b/lang/gcc8/patches/patch-libgcc_crtstuff.c
new file mode 100644
index 00000000000..01b9a4abbef
--- /dev/null
+++ b/lang/gcc8/patches/patch-libgcc_crtstuff.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-libgcc_crtstuff.c,v 1.1 2018/05/05 04:08:36 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/lang/gcc8/patches/patch-libgfortran_io_io.h b/lang/gcc8/patches/patch-libgfortran_io_io.h
new file mode 100644
index 00000000000..32c8ab48d2b
--- /dev/null
+++ b/lang/gcc8/patches/patch-libgfortran_io_io.h
@@ -0,0 +1,18 @@
+$NetBSD: patch-libgfortran_io_io.h,v 1.1 2018/05/05 04:08:36 maya Exp $
+
+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/lang/gcc8/patches/patch-libsanitizer_configure.tgt b/lang/gcc8/patches/patch-libsanitizer_configure.tgt
new file mode 100644
index 00000000000..04f269a07aa
--- /dev/null
+++ b/lang/gcc8/patches/patch-libsanitizer_configure.tgt
@@ -0,0 +1,19 @@
+$NetBSD: patch-libsanitizer_configure.tgt,v 1.1 2018/05/05 04:08:36 maya Exp $
+
+--- libsanitizer/configure.tgt.orig 2017-10-05 10:39:32.000000000 +0000
++++ libsanitizer/configure.tgt
+@@ -52,9 +52,13 @@ case "${target}" in
+ TSAN_TARGET_DEPENDENT_OBJECTS=tsan_rtl_aarch64.lo
+ fi
+ ;;
+- x86_64-*-darwin[1]* | i?86-*-darwin[1]*)
++ x86_64-*-darwin[1][1-9]* | i?86-*-darwin[1][1-9]*)
+ TSAN_SUPPORTED=no
+ ;;
++ x86_64-*-netbsd*)
++ TSAN_SUPPORTED=no
++ LSAN_SUPPORTED=no
++ ;;
+ *)
+ UNSUPPORTED=1
+ ;;
diff --git a/lang/gcc8/patches/patch-libsanitizer_sanitizer__common_Makefile.am b/lang/gcc8/patches/patch-libsanitizer_sanitizer__common_Makefile.am
new file mode 100644
index 00000000000..3593fbd1e48
--- /dev/null
+++ b/lang/gcc8/patches/patch-libsanitizer_sanitizer__common_Makefile.am
@@ -0,0 +1,17 @@
+$NetBSD: patch-libsanitizer_sanitizer__common_Makefile.am,v 1.1 2018/05/05 04:08:36 maya Exp $
+
+--- libsanitizer/sanitizer_common/Makefile.am.orig 2017-10-19 11:23:59.000000000 +0000
++++ libsanitizer/sanitizer_common/Makefile.am
+@@ -40,6 +40,7 @@ sanitizer_common_files = \
+ sanitizer_mac_libcdep.cc \
+ sanitizer_persistent_allocator.cc \
+ sanitizer_platform_limits_linux.cc \
++ sanitizer_platform_limits_netbsd.cc \
+ sanitizer_platform_limits_posix.cc \
+ sanitizer_posix.cc \
+ sanitizer_posix_libcdep.cc \
+@@ -114,4 +115,3 @@ AM_MAKEFLAGS = \
+ MAKEOVERRIDES=
+
+ ## ################################################################
+-
diff --git a/lang/gcc8/patches/patch-libsanitizer_sanitizer__common_Makefile.in b/lang/gcc8/patches/patch-libsanitizer_sanitizer__common_Makefile.in
new file mode 100644
index 00000000000..934408d9d02
--- /dev/null
+++ b/lang/gcc8/patches/patch-libsanitizer_sanitizer__common_Makefile.in
@@ -0,0 +1,28 @@
+$NetBSD: patch-libsanitizer_sanitizer__common_Makefile.in,v 1.1 2018/05/05 04:08:36 maya Exp $
+
+--- libsanitizer/sanitizer_common/Makefile.in.orig 2017-10-22 22:33:06.000000000 +0000
++++ libsanitizer/sanitizer_common/Makefile.in
+@@ -91,6 +91,7 @@ am__objects_1 = sancov_flags.lo sanitize
+ sanitizer_mac.lo sanitizer_mac_libcdep.lo \
+ sanitizer_persistent_allocator.lo \
+ sanitizer_platform_limits_linux.lo \
++ sanitizer_platform_limits_netbsd.lo \
+ sanitizer_platform_limits_posix.lo sanitizer_posix.lo \
+ sanitizer_posix_libcdep.lo sanitizer_printf.lo \
+ sanitizer_procmaps_common.lo sanitizer_procmaps_freebsd.lo \
+@@ -322,6 +323,7 @@ sanitizer_common_files = \
+ sanitizer_mac_libcdep.cc \
+ sanitizer_persistent_allocator.cc \
+ sanitizer_platform_limits_linux.cc \
++ sanitizer_platform_limits_netbsd.cc \
+ sanitizer_platform_limits_posix.cc \
+ sanitizer_posix.cc \
+ sanitizer_posix_libcdep.cc \
+@@ -468,6 +470,7 @@ distclean-compile:
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_mac_libcdep.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_persistent_allocator.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_platform_limits_linux.Plo@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_platform_limits_netbsd.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_platform_limits_posix.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_posix.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_posix_libcdep.Plo@am__quote@
diff --git a/lang/gcc8/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h b/lang/gcc8/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h
new file mode 100644
index 00000000000..08bc754fc10
--- /dev/null
+++ b/lang/gcc8/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 2018/05/05 04:08:36 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/lang/gcc8/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc b/lang/gcc8/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc
new file mode 100644
index 00000000000..2aad4842f52
--- /dev/null
+++ b/lang/gcc8/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 2018/05/05 04:08:36 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/lang/gcc8/patches/patch-libstdc++-v3_libsupc++_new__opa.cc b/lang/gcc8/patches/patch-libstdc++-v3_libsupc++_new__opa.cc
new file mode 100644
index 00000000000..e8cbcb4a2f4
--- /dev/null
+++ b/lang/gcc8/patches/patch-libstdc++-v3_libsupc++_new__opa.cc
@@ -0,0 +1,17 @@
+$NetBSD: patch-libstdc++-v3_libsupc++_new__opa.cc,v 1.1 2018/05/05 04:08:36 maya Exp $
+
+Ensure we can find SunOS std::aligned_alloc if using it.
+
+--- libstdc++-v3/libsupc++/new_opa.cc.orig 2017-01-26 14:30:45.000000000 +0000
++++ libstdc++-v3/libsupc++/new_opa.cc
+@@ -31,6 +31,10 @@
+ using std::new_handler;
+ using std::bad_alloc;
+
++#if defined(__sun) && _GLIBCXX_HAVE_ALIGNED_ALLOC
++using std::aligned_alloc;
++#endif
++
+ #if !_GLIBCXX_HAVE_ALIGNED_ALLOC
+ #if _GLIBCXX_HAVE__ALIGNED_MALLOC
+ #define aligned_alloc(al,sz) _aligned_malloc(sz,al)
diff --git a/lang/gcc8/version.mk b/lang/gcc8/version.mk
new file mode 100644
index 00000000000..b3da0e5c96c
--- /dev/null
+++ b/lang/gcc8/version.mk
@@ -0,0 +1,2 @@
+# $NetBSD: version.mk,v 1.1 2018/05/05 04:08:36 maya Exp $
+GCC8_DIST_VERSION:= 8.1.0