pkgsrc-Changes archive

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

CVS commit: pkgsrc/lang



Module Name:    pkgsrc
Committed By:   marino
Date:           Tue Dec 13 01:19:20 UTC 2016

Modified Files:
        pkgsrc/lang: Makefile
Added Files:
        pkgsrc/lang/gcc6-aux: DESCR Makefile Makefile.version buildlink3.mk
            distinfo options.mk
        pkgsrc/lang/gcc6-aux/files: diff-ada diff-ada-testsuite diff-core
            diff-cxx diff-fortran diff-gcc-testsuite

Log Message:
Add lang/gcc6-aux to pkgsrc

I had intended to migrate the ada framework to use gcc6-aux instead of
lang/gcc5-aux, but unfortunately there's been a regression on NetBSD.
It builds and tests perfectly on DragonFly and FreeBSD, but it only
builds on NetBSD.  All the ACAT tests that involve tasking fail, but
the cause is unclear.  All the modifications used on gcc5-aux for NetBSD
are present in gcc6-aux but pthread destruction results in a segfault.

Since then gcc5-aux support has been improved, so I'm putting this away
for a while.  NetBSD has been removed from the platform support list
for now, but I'll review any patches I get to fix NetBSD tasking.

This compiler is based on gcc 6.2 and is primarily used for the Ada
frontend.


To generate a diff of this commit:
cvs rdiff -u -r1.445 -r1.446 pkgsrc/lang/Makefile
cvs rdiff -u -r0 -r1.1 pkgsrc/lang/gcc6-aux/DESCR \
    pkgsrc/lang/gcc6-aux/Makefile pkgsrc/lang/gcc6-aux/Makefile.version \
    pkgsrc/lang/gcc6-aux/buildlink3.mk pkgsrc/lang/gcc6-aux/distinfo \
    pkgsrc/lang/gcc6-aux/options.mk
cvs rdiff -u -r0 -r1.1 pkgsrc/lang/gcc6-aux/files/diff-ada \
    pkgsrc/lang/gcc6-aux/files/diff-ada-testsuite \
    pkgsrc/lang/gcc6-aux/files/diff-core pkgsrc/lang/gcc6-aux/files/diff-cxx \
    pkgsrc/lang/gcc6-aux/files/diff-fortran \
    pkgsrc/lang/gcc6-aux/files/diff-gcc-testsuite

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

Modified files:

Index: pkgsrc/lang/Makefile
diff -u pkgsrc/lang/Makefile:1.445 pkgsrc/lang/Makefile:1.446
--- pkgsrc/lang/Makefile:1.445  Thu Nov 17 06:32:10 2016
+++ pkgsrc/lang/Makefile        Tue Dec 13 01:19:19 2016
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.445 2016/11/17 06:32:10 jnemeth Exp $
+# $NetBSD: Makefile,v 1.446 2016/12/13 01:19:19 marino Exp $
 #
 
 COMMENT=       Programming languages
@@ -76,6 +76,7 @@ SUBDIR+=      gcc5
 SUBDIR+=       gcc5-aux
 SUBDIR+=       gcc5-libs
 SUBDIR+=       gcc6
+SUBDIR+=       gcc6-aux
 SUBDIR+=       gcc6-libs
 SUBDIR+=       gforth
 SUBDIR+=       ghc

Added files:

Index: pkgsrc/lang/gcc6-aux/DESCR
diff -u /dev/null pkgsrc/lang/gcc6-aux/DESCR:1.1
--- /dev/null   Tue Dec 13 01:19:20 2016
+++ pkgsrc/lang/gcc6-aux/DESCR  Tue Dec 13 01:19:20 2016
@@ -0,0 +1,14 @@
+The AUX compiler supports several languages: Ada, C, C++, Fortran and
+Objective-C.  Since Ada support must be built by an Ada-capable compiler,
+only platforms for which a bootstrap compiler is available can build it.
+
+The AUX compiler is based on release versions of the Free Software
+Foundation's GNU Compiler Collection.  It carries with it the GMGPL license,
+the modified version of the GPL that exempts generic instantiation from
+resulting in a GPL-licensed executable.  It also carries the GCC Runtime
+Library Exception, so the resulting binaries have no licensing requirements.
+Binaries produced by the AUX compiler should be legally handled the same as
+binaries produced by any FSF compiler.
+
+This compiler implements the full Ada-83, Ada-95, Ada-2005 and Ada-2012
+standards.
Index: pkgsrc/lang/gcc6-aux/Makefile
diff -u /dev/null pkgsrc/lang/gcc6-aux/Makefile:1.1
--- /dev/null   Tue Dec 13 01:19:20 2016
+++ pkgsrc/lang/gcc6-aux/Makefile       Tue Dec 13 01:19:20 2016
@@ -0,0 +1,327 @@
+# $NetBSD: Makefile,v 1.1 2016/12/13 01:19:20 marino Exp $
+#
+
+PKGNAME=       gcc6-aux-${SNAPSHOT}
+PKGREVISION=   ${MAIN_PR}
+DISTNAME=      ${IDENTIFICATION}
+CATEGORIES=    lang
+MASTER_SITES=  ${MASTER_SITE_GNU:=gcc/${IDENTIFICATION}/}
+DISTFILES=     ${DISTNAME}.tar.bz2
+
+MAINTAINER=    draco%marino.st@localhost
+HOMEPAGE=      http://www.dragonlace.net/
+COMMENT=       GNAT Ada compiler based on GCC ${GCC_BRANCH}
+LICENSE=       gnu-gpl-v3 AND gnu-lgpl-v3
+
+LANGS=         c ada c++
+USE_TOOLS+=    gmake sed:run perl makeinfo bzip2 patch pod2man tar
+APPLY_DIFFS=   core ada cxx
+
+.include "Makefile.version"
+.include "../../mk/bsd.prefs.mk"
+.include "options.mk"
+
+# Requires bootstrap compiler, which is only available for on selected systems
+
+ONLY_FOR_PLATFORM=     DragonFly-*-x86_64   \
+                       FreeBSD-*-i386       \
+                       FreeBSD-*-x86_64     \
+                       SunOS-5.1[1-9]*-i386 \
+                       SunOS-5.1[1-9]*-x86_64
+# Tasking is broken on NetBSD.  The reason for this is unknown
+# Until pthread support is fixed, remove NetBSD from PLATFORM list
+#                      NetBSD-[5-9]*-i386   \
+#                      NetBSD-[5-9]*-x86_64
+
+GARCH=                 ${MACHINE_ARCH:S/amd64/x86_64/}
+BLD_TARGET=            ${GARCH}-aux-${LOWER_OPSYS}${OS_VERSION}
+OS_LABEL4VERS=         [${OPSYS}${GARCH:M*64:S/amd_//:S/x86_//}]
+FULL_GNATGCC=          NOT SET
+FULL_PATH=             /sbin:/bin:/usr/sbin:/usr/bin:${PREFIX}/gcc6-aux/bin:${PREFIX}/sbin:${PREFIX}/bin
+
+.if ${OPSYS} == DragonFly
+BOOTSTRAP_COMPILER=    ada-bootstrap.${GARCH}.dragonfly.41.tar.bz2
+.endif
+
+.if ${OPSYS} == FreeBSD
+MODERN_BINUTILS=       yes
+BOOTSTRAP_COMPILER=    ada-bootstrap.${GARCH}.freebsd.100B.tar.bz2
+.endif
+
+.if ${OPSYS} == NetBSD
+.  if !empty(OS_VERSION:M7.99.*)
+NSUFF= 8.0_DEV
+.  else
+NSUFF= ${OS_VERSION}
+.  endif
+.  if ${GARCH} == i386
+NELF=  elf
+.  endif
+XLDF=                  -lm
+.  if ${OS_VERSION:R} < 7
+MODERN_BINUTILS=       yes
+.  endif
+BOOTSTRAP_COMPILER=    ada-bootstrap.${GARCH}.netbsd.614.tar.bz2
+BLD_TARGET=            ${MACHINE_ARCH}-aux-netbsd${NELF}${NSUFF}
+.  if ${OS_VERSION:R} == 5
+CORRECTIONS=           g-socthi-bsd.adb
+CRXN=                  C5
+.  else
+CORRECTIONS=           g-socthi-bsd.adb g-socthi.ads \
+                       s-osinte-netbsd.ads s-osprim-posix.adb
+CRXN=                  C6
+.  endif
+C5_g-socthi-bsd.adb=   Syscall_Socket/__socket30
+C6_g-socthi-bsd.adb=   Syscall_Socket/__socket30
+C6_g-socthi.ads=       C_Select/__select50
+C6_s-osinte-netbsd.ads=        nanosleep/__nanosleep50 \
+                       clock_getres/__clock_getres50 \
+                       clock_gettime/__clock_gettime50
+C6_s-osprim-posix.adb= nanosleep/__nanosleep50 \
+                       gettimeofday/__gettimeofday50
+.endif
+
+.if ${OPSYS} == SunOS
+SOL_OSV!=              expr substr ${OS_VERSION} 3 2
+BLD_TARGET=            ${MACHINE_ARCH}-aux-${LOWER_OPSYS}2.${SOL_OSV}
+BOOTSTRAP_COMPILER=    ada-bootstrap.x86_64.solaris.511.tar.bz2
+.  if ${ABI} == 64
+EXTRA_CONFARGS+=       --enable-multilib
+.  else
+COMPILER_ABI_SWITCH=   -m32
+.  endif
+MY_CONFIGURE_ENV+=     OBJDUMP=${PREFIX}/bin/gobjdump
+MODERN_BINUTILS=       yes
+NATIVE_LINKER!=                which ld
+.endif
+
+.if defined(MODERN_BINUTILS)
+BUILDLINK_DEPMETHOD.binutils=  full
+.include "../../devel/binutils/buildlink3.mk"
+EXTRA_CONFARGS+=       --with-gnu-as --with-as=${PREFIX}/bin/gas
+MY_CONFIGURE_ENV+=     AR=${PREFIX}/bin/gar
+MY_CONFIGURE_ENV+=     AS=${PREFIX}/bin/gas
+MY_CONFIGURE_ENV+=     NM=${PREFIX}/bin/gnm
+MY_CONFIGURE_ENV+=     RANLIB=${PREFIX}/bin/granlib
+.  if defined(NATIVE_LINKER)
+EXTRA_CONFARGS+=       --without-gnu-ld --with-ld=${NATIVE_LINKER}
+.  else
+EXTRA_CONFARGS+=       --with-gnu-ld --with-ld=${PREFIX}/bin/gld.bfd
+MY_CONFIGURE_ENV+=     LD=${PREFIX}/bin/gld.bfd
+.  endif
+.else
+EXTRA_CONFARGS+=       --with-gnu-ld --with-ld=/usr/bin/ld
+EXTRA_CONFARGS+=       --with-gnu-as --with-as=/usr/bin/as
+.endif
+
+
+# define some important directories and files
+WRKSRC=                        ${WRKDIR}/gcc-${GCC_VERSION}
+BUILDDIR=              ${WRKDIR}/build
+NEWBSDIR=              ${WRKDIR}/newbs/bootstrap
+SYSLIBDIR=             ${WRKDIR}/lib
+CFG_SCRIPT=            ${WRKSRC}/configure
+REVFILE=               ${WRKSRC}/gcc/REVISION
+PHASEFILE=             ${WRKSRC}/gcc/DEV-PHASE
+BOOTSTRAP_PREFIX=      ${WRKDIR}/bootstrap
+PKG_PREFIX=            ${PREFIX}/gcc6-aux
+BSFILENAME=            ada-bootstrap.${GARCH}.${LOWER_OPSYS}.${OS_VERSION:C/[A-Z_.-]//g}.tar
+
+
+# testing if gcc6-aux is already installed - if so, use this compiler along with
+# its gnatlink, gnatbind, and gnatmake rather than the older bootstrap versions
+.if exists(${LOCALBASE}/gcc6-aux/bin/ada)
+FULL_GNATGCC=${LOCALBASE}/gcc6-aux/bin/ada
+FULL_GNATGXX=${LOCALBASE}/gcc6-aux/bin/g++
+.endif
+
+
+.if ${FULL_GNATGCC} == "NOT SET"
+# here we know we need to install the bootstrap compiler
+.  if defined(BOOTSTRAP_TRIPLET)
+FULL_GNATGCC=${BOOTSTRAP_PREFIX}/bin/gnatgcc
+.  else
+FULL_GNATGCC=${BOOTSTRAP_PREFIX}/bin/gcc ${COMPILER_ABI_SWITCH}
+FULL_GNATGXX=${BOOTSTRAP_PREFIX}/bin/g++ ${COMPILER_ABI_SWITCH}
+.  endif
+DISTFILES+= ${BOOTSTRAP_COMPILER}
+SITES.${BOOTSTRAP_COMPILER}=   http://downloads.dragonlace.net/src/
+FULL_PATH=${BOOTSTRAP_PREFIX}/bin:/sbin:/bin:/usr/sbin:/usr/bin:${PREFIX}/sbin:${PREFIX}/bin
+.endif
+
+
+# for port maintenance, invoke "make mdi PLUS_BOOTSTRAPS=1"
+.if defined(PLUS_BOOTSTRAPS)
+ALL_BOOTSTRAPS= \
+   ada-bootstrap.i386.freebsd.100B.tar.bz2 \
+   ada-bootstrap.i386.netbsd.614.tar.bz2 \
+   ada-bootstrap.x86_64.dragonfly.41.tar.bz2 \
+   ada-bootstrap.x86_64.freebsd.84.tar.bz2 \
+   ada-bootstrap.x86_64.freebsd.100B.tar.bz2 \
+   ada-bootstrap.x86_64.netbsd.614.tar.bz2 \
+   ada-bootstrap.x86_64.solaris.511.tar.bz2
+.for BC in ${ALL_BOOTSTRAPS}
+SITES.${BC}=   http://downloads.dragonlace.net/src/
+.endfor
+DISTFILES= ${DISTNAME}.tar.bz2 ${ALL_BOOTSTRAPS}
+.endif
+
+# establish ada-aware compiler for use
+MY_CONFIGURE_ENV+=     CC=${FULL_GNATGCC:Q}
+MY_CONFIGURE_ENV+=     CXX=${FULL_GNATGXX:Q}
+MY_CONFIGURE_ENV+=     PATH=${FULL_PATH}
+MY_CONFIGURE_ENV+=     LDFLAGS="${XLDF} ${COMPILER_RPATH_FLAG}${PREFIX}/lib"
+MY_MAKE_ENV+=          PATH=${FULL_PATH}
+MY_MAKE_ENV+=          LD_LIBRARY_PATH=${BUILDDIR}/gcc${EXTRA_LLP}
+# ${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.
+MY_MAKE_ENV+=          ac_cv_path_SED=${TOOLS_SED}
+MY_MAKE_ENV+=          lt_cv_path_SED=${TOOLS_SED}
+
+
+# The standard configuration options
+CONFIGURE_ARGS=        --enable-languages=${LANGS:Q}
+CONFIGURE_ARGS+=       --build=${BLD_TARGET}
+CONFIGURE_ARGS+=       --prefix=${PKG_PREFIX:Q}
+CONFIGURE_ARGS+=       --enable-threads=posix
+CONFIGURE_ARGS+=       --enable-checking=release
+CONFIGURE_ARGS+=       --disable-libmudflap
+CONFIGURE_ARGS+=       --disable-libgomp
+CONFIGURE_ARGS+=       --disable-libssp
+CONFIGURE_ARGS+=       --disable-libcilkrts
+CONFIGURE_ARGS+=       --disable-libitm
+CONFIGURE_ARGS+=       ${EXTRA_CONFARGS}
+
+# Automatic package list generation
+GENERATE_PLIST=  cd ${DESTDIR}${PREFIX};
+GENERATE_PLIST+= ${FIND} * \( -type f -or -type l \) | ${SORT} -dr;
+
+
+post-extract:
+       # Personalize GNAT for each different machine
+       @${ECHO} "-=> GCC AUX ${OS_LABEL4VERS}" > ${REVFILE}
+       @${ECHO} ${PHASE} > ${PHASEFILE}
+       # Apply required composite diff files
+.for suffix in ${APPLY_DIFFS}
+       @${ECHO} "Applying composite patch diff-${suffix}"
+       ${PATCH} -d ${WRKSRC} -s -E < ${FILESDIR}/diff-${suffix}
+.endfor
+.if ${OPSYS} == NetBSD
+.  for sysfile in ${CORRECTIONS}
+.    for pair in ${${CRXN}_${sysfile}}
+       ${PERL5} -pi -e 's|C, ${pair:H}, ".*"|C, ${pair:H}, "${pair:T}"|' \
+               ${WRKSRC}/gcc/ada/${sysfile}
+.    endfor
+.  endfor
+.  if ${CRXN} == C5
+       ${PERL5} -pi -e 's|new int64_t|new int|' \
+               ${WRKSRC}/gcc/ada/s-osinte-netbsd.ads
+       ${PERL5} -pi -e 's|new Long_Integer|new Integer|' \
+               ${WRKSRC}/gcc/ada/s-osprim-posix.adb
+.  endif
+.endif
+.if defined(STATIC_BUILD) || !empty(PKG_OPTIONS:Mbootstrap)
+.  if ${OPSYS} != SunOS
+       # Ensure GNAT tools are built statically
+       ${PERL5} -pi -e 's/^GCC_LINK_FLAGS=.*/GCC_LINK_FLAGS=-static/' \
+         ${WRKSRC}/gcc/ada/gcc-interface/Makefile.in
+.  endif
+.endif
+.if !exists(${LOCALBASE}/gcc6-aux/bin/ada) && ${OPSYS} == SunOS
+       # In case /usr/pkg/bin/gas doesn't exist, establish fallback
+       ${LN} -s ${PREFIX}/bin/gas ${BOOTSTRAP_PREFIX}/bin/as
+.endif
+       # Illumos /usr/ccs binaries are symlinked to /usr/bin
+       # elfdump was present on OmniOS but not in Joyent dev area
+       ${PERL5} -i -pe 's|/usr/ccs/bin|/usr/bin|g;' \
+         -pe 's|readelf -s|greadelf -s|' ${WRKSRC}/contrib/make_sunver.pl
+       # Update LINK_SPEC to add gcc6-aux lib runpath in every binary
+       @${ECHO} "Configuring LINK_SPEC runpath"
+       ${PERL5} -pi -e 's;\@PREFIX\@/\@GCCAUX\@;${PREFIX}/gcc6-aux;' \
+         ${WRKSRC}/gcc/config/dragonfly.h \
+         ${WRKSRC}/gcc/config/netbsd-elf.h \
+         ${WRKSRC}/gcc/config/i386/freebsd.h
+
+.if defined(BOOTSTRAP_TRIPLET)
+       # Bootstrap compiler has statically linked z, gmp, mpc, mpfr and iconv
+       # The only shared lib is libc.so.7, so it should work for a long time.
+       # No longer used, only here to support future SunOS bootstrap generation
+
+       ${MKDIR} ${BOOTSTRAP_PREFIX}
+       ${MV} ${BOOTSTRAP_PREFIX}/../bin ${BOOTSTRAP_PREFIX}
+       ${MV} ${BOOTSTRAP_PREFIX}/../lib ${BOOTSTRAP_PREFIX}
+       ${MV} ${BOOTSTRAP_PREFIX}/../libexec ${BOOTSTRAP_PREFIX}
+       ${RM} -rf ${BOOTSTRAP_PREFIX}/lib/gcc/${BOOTSTRAP_TRIPLET}/include-fixed
+.endif
+
+
+do-configure:
+       ${MKDIR} ${BUILDDIR}
+       cd ${BUILDDIR} && ${SETENV} ${MY_CONFIGURE_ENV} \
+               ${CFG_SCRIPT} ${CONFIGURE_ARGS}
+
+
+do-build:
+       # The unlimited stacksize is for NetBSD64
+       cd ${BUILDDIR} && \
+               ${ULIMIT_CMD_stacksize} && \
+               ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -j${MAKE_JOBS:U1:Q} all
+
+
+.if !empty(PKG_OPTIONS:Mtestsuite) && empty(PKG_OPTIONS:Mbootstrap)
+do-test: build test-ada test-fortran test-objc test-cxx test-c
+
+test-ada:
+.if (${OPSYS} == NetBSD) && (${MACHINE_ARCH} == x86_64)
+       # NetBSD has an extremely small default stacksize of 2MB, which is
+       # insufficient for the gnat.dg testsuite.
+       # specifically: entry_queues test on AMD64
+       # Unlimiting stack resources on i386-netbsdelf* will result in
+       # failure of gnat.dg/task_stack_align.adb execution test.
+       cd ${BUILDDIR} && \
+       ${ULIMIT_CMD_stacksize} && \
+       ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-ada
+.else
+       cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} DEJAGNU_TIMEOUT=30 \
+               ${GMAKE} -sk check-ada
+.endif
+
+test-fortran:
+.if !empty(PKG_OPTIONS:Mfortran)
+       cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-fortran
+.endif
+
+test-objc:
+.if !empty(PKG_OPTIONS:Mobjc)
+       cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-objc
+.endif
+
+test-cxx:
+       # libstdc++ always ends with error status, so ignore it
+       cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk \
+       check-c++ || ${TRUE}
+
+test-c:
+       cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-c
+.endif
+
+do-install:
+       cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} install-strip \
+               DESTDIR=${DESTDIR}
+       ${MV} ${DESTDIR}${PKG_PREFIX}/share ${WRKDIR}/moved_share
+
+.if !empty(PKG_OPTIONS:Mbootstrap)
+create-bootstrap: stage-install
+       ${MKDIR} ${NEWBSDIR}
+       ${CP} -RpP ${DESTDIR}${PKG_PREFIX}/bin ${NEWBSDIR}/
+       ${CP} -RpP ${DESTDIR}${PKG_PREFIX}/lib ${NEWBSDIR}/
+       ${CP} -RpP ${DESTDIR}${PKG_PREFIX}/include ${NEWBSDIR}/
+       ${CP} -RpP ${DESTDIR}${PKG_PREFIX}/libexec ${NEWBSDIR}/
+       ${RM} ${NEWBSDIR}/bin/${GARCH}*
+       ${RM} -rf ${NEWBSDIR}/lib/gcc/${BLD_TARGET}/${GCC_VERSION}/include-fixed
+       (cd ${NEWBSDIR}/.. ; \
+               ${TAR} -cf ${BSFILENAME} bootstrap; ${BZIP2} ${BSFILENAME})
+.endif
+
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/lang/gcc6-aux/Makefile.version
diff -u /dev/null pkgsrc/lang/gcc6-aux/Makefile.version:1.1
--- /dev/null   Tue Dec 13 01:19:20 2016
+++ pkgsrc/lang/gcc6-aux/Makefile.version       Tue Dec 13 01:19:20 2016
@@ -0,0 +1,21 @@
+# $NetBSD: Makefile.version,v 1.1 2016/12/13 01:19:20 marino Exp $
+#
+
+SNAPSHOT=      20160822
+GCC_BRANCH=    6
+GCC_POINT=     2.0
+GCC_VERSION=   ${GCC_BRANCH}.${GCC_POINT}
+BUILD_RELEASE= yes
+MAIN_PR=       0
+
+.if ${BUILD_RELEASE:Mno}
+# Snapshot naming pattern
+IDENTIFICATION=        gcc-${GCC_BRANCH}-${SNAPSHOT}
+MS_SUBDIR=     snapshots/${GCC_BRANCH}-${SNAPSHOT}
+PHASE=         snapshot
+.else
+# Release naming pattern
+IDENTIFICATION=        gcc-${GCC_VERSION}
+MS_SUBDIR=     releases/gcc-${GCC_VERSION}
+PHASE=         release
+.endif
Index: pkgsrc/lang/gcc6-aux/buildlink3.mk
diff -u /dev/null pkgsrc/lang/gcc6-aux/buildlink3.mk:1.1
--- /dev/null   Tue Dec 13 01:19:20 2016
+++ pkgsrc/lang/gcc6-aux/buildlink3.mk  Tue Dec 13 01:19:20 2016
@@ -0,0 +1,22 @@
+# $NetBSD: buildlink3.mk,v 1.1 2016/12/13 01:19:20 marino Exp $
+
+BUILDLINK_TREE+= gcc6-aux
+
+.if !defined(GCC5_AUX_BUILDLINK3_MK)
+GCC5_AUX_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.gcc6-aux+= gcc6-aux>=20160822
+BUILDLINK_PKGSRCDIR.gcc6-aux?= ../../lang/gcc6-aux
+BUILDLINK_DEPMETHOD.gcc6-aux?= build
+
+.include "../../converters/libiconv/buildlink3.mk"
+.include "../../devel/gmp/buildlink3.mk"
+.include "../../math/mpfr/buildlink3.mk"
+.include "../../math/mpcomplex/buildlink3.mk"
+
+pkgbase := gcc6-aux
+.include "../../mk/pkg-build-options.mk"
+
+.endif
+
+BUILDLINK_TREE+= -gcc6-aux
Index: pkgsrc/lang/gcc6-aux/distinfo
diff -u /dev/null pkgsrc/lang/gcc6-aux/distinfo:1.1
--- /dev/null   Tue Dec 13 01:19:20 2016
+++ pkgsrc/lang/gcc6-aux/distinfo       Tue Dec 13 01:19:20 2016
@@ -0,0 +1,34 @@
+$NetBSD: distinfo,v 1.1 2016/12/13 01:19:20 marino Exp $
+
+SHA1 (ada-bootstrap.i386.freebsd.100B.tar.bz2) = b7ff322bbcfa403d37d917d6e88e306de0857251
+RMD160 (ada-bootstrap.i386.freebsd.100B.tar.bz2) = 7a85e0f073dafe9b0d37b493dbb4268bd2f39601
+SHA512 (ada-bootstrap.i386.freebsd.100B.tar.bz2) = ab4a32457f5febf2c854b7107abb8159754f5a5e8413598fb2ecf1ed0a755129c26aab0e0c2e09695d02cef5490b53a3b18c9fa37cec0b07476940c27fc76ae8
+Size (ada-bootstrap.i386.freebsd.100B.tar.bz2) = 41229192 bytes
+SHA1 (ada-bootstrap.i386.netbsd.614.tar.bz2) = 2c29209b086dcf3076428f232fadf306b9a227c6
+RMD160 (ada-bootstrap.i386.netbsd.614.tar.bz2) = f0ecb9b0d69c2d097c6405e0db581f606b372017
+SHA512 (ada-bootstrap.i386.netbsd.614.tar.bz2) = 39d0b2503e9e3a0c9aa25c2daa83be4109e9bda41076c2ea5eb4abf89137c6c2ad6b6726a6d634c8f89f4695810ba902920444df29c5cba31942f84a69aeee75
+Size (ada-bootstrap.i386.netbsd.614.tar.bz2) = 37900035 bytes
+SHA1 (ada-bootstrap.x86_64.dragonfly.41.tar.bz2) = 95fdb86cff798ca7ddb7ac5f9dc397cd1f73e9c4
+RMD160 (ada-bootstrap.x86_64.dragonfly.41.tar.bz2) = 54b56708e6f944ca5e40eb2d99cf79b3487abdb2
+SHA512 (ada-bootstrap.x86_64.dragonfly.41.tar.bz2) = 9a3244b5f76104f1ffcd6e4c47f222f8be7b1faf7184e2e265b1a349e587f4d5112271e91a619e665b893e6a7a58ac0a3e07129f8cff7a473e66229718cff2d2
+Size (ada-bootstrap.x86_64.dragonfly.41.tar.bz2) = 44956630 bytes
+SHA1 (ada-bootstrap.x86_64.freebsd.100B.tar.bz2) = edfe60c5f42bbeb145d7070ed868135ebc60c2de
+RMD160 (ada-bootstrap.x86_64.freebsd.100B.tar.bz2) = 0d50885402208caafbc133ffc3b8684e89a50cae
+SHA512 (ada-bootstrap.x86_64.freebsd.100B.tar.bz2) = 07e7503f575c6ba30c5d4db1f9781f522c0b48effb62c90fe3af991ebbada8064d035871e0e99206c86eb4c10fdfffb6faf89bc203370797d9c1818657004f1a
+Size (ada-bootstrap.x86_64.freebsd.100B.tar.bz2) = 42163803 bytes
+SHA1 (ada-bootstrap.x86_64.freebsd.84.tar.bz2) = b5c76ce07df6e944742eda5f860352c8e179b988
+RMD160 (ada-bootstrap.x86_64.freebsd.84.tar.bz2) = 334c2375ee35bdf931a3a476e794e494ff252515
+SHA512 (ada-bootstrap.x86_64.freebsd.84.tar.bz2) = f7edc4b4d9adcf071cb74221119ae5989f39af176c988f9c446b7b302247f7263215724f5826cf27854f0b87a23f2756ce703e6e1519997faa48a157c0c1425e
+Size (ada-bootstrap.x86_64.freebsd.84.tar.bz2) = 40227668 bytes
+SHA1 (ada-bootstrap.x86_64.netbsd.614.tar.bz2) = 683f58e6e394a508a52ec1dc5f3d9ca2869d5252
+RMD160 (ada-bootstrap.x86_64.netbsd.614.tar.bz2) = 4574857089e82fb80725161cc8b625ce75f6810e
+SHA512 (ada-bootstrap.x86_64.netbsd.614.tar.bz2) = 6287668001dd6d45a1dfe2a6f548fe933ce2bff4fec43516dc76aad8aeb27859ee6660068edfbc9dc671f025e1635629212b1adc1308d5cc775dd19e1f1764b2
+Size (ada-bootstrap.x86_64.netbsd.614.tar.bz2) = 39348972 bytes
+SHA1 (ada-bootstrap.x86_64.solaris.511.tar.bz2) = abb16c1582e2a6ffe37df4afd96d04c44f2eea7b
+RMD160 (ada-bootstrap.x86_64.solaris.511.tar.bz2) = 41677e2fd0cb02c89f200fb97b112ad3be7f19cd
+SHA512 (ada-bootstrap.x86_64.solaris.511.tar.bz2) = 59db01497b11bd4913cfedcbe3931caa361564c1f5eadddd200dc1e0516a44d107494ab898f93bc1050998f73623bf30a74f0933b84d9a03a3c9d51f3f2de8d9
+Size (ada-bootstrap.x86_64.solaris.511.tar.bz2) = 60110383 bytes
+SHA1 (gcc-6.2.0.tar.bz2) = 583e29c7fe69d9a1031a89752c2551ab5aeacb91
+RMD160 (gcc-6.2.0.tar.bz2) = d9154ca51f40ae3ce42950a0476f701a9f86fc95
+SHA512 (gcc-6.2.0.tar.bz2) = 1e8b826a3d44b9d5899309894e20c03abeb352bf3d273b8ad63af814c0ee2911f1a83ce1cd4cdd2d1cb0b3e3c34e9b7ae1b2ab83dfc649ee817ab05247c76198
+Size (gcc-6.2.0.tar.bz2) = 99778648 bytes
Index: pkgsrc/lang/gcc6-aux/options.mk
diff -u /dev/null pkgsrc/lang/gcc6-aux/options.mk:1.1
--- /dev/null   Tue Dec 13 01:19:20 2016
+++ pkgsrc/lang/gcc6-aux/options.mk     Tue Dec 13 01:19:20 2016
@@ -0,0 +1,109 @@
+# $NetBSD: options.mk,v 1.1 2016/12/13 01:19:20 marino Exp $
+
+PKG_OPTIONS_VAR=       PKG_OPTIONS.gcc6-aux
+PKG_SUPPORTED_OPTIONS=  fortran objc testsuite static bootstrap allstages
+PKG_SUGGESTED_OPTIONS=  # fortran
+
+# fortran fails to build transfer.c, disable
+
+.include "../../mk/bsd.options.mk"
+
+
+# Bootstrap is essentially a maintainer option and it will ignore
+# all other options because it is intent on building a bootstrap compiler.
+
+
+#############################
+##  ADD LANGUAGE: Fortran  ##
+#############################
+
+.if empty(PKG_OPTIONS:Mfortran) || !empty(PKG_OPTIONS:Mbootstrap)
+EXTRA_CONFARGS+= --disable-libquadmath
+.else
+LANGS+= fortran
+APPLY_DIFFS+= fortran
+.if ${OPSYS} == NetBSD
+EXTRA_CONFARGS+= --disable-libquadmath
+.else
+EXTRA_CONFARGS+= --enable-libquadmath
+.endif
+.endif
+
+
+#################################
+##  ADD LANGUAGE: Objective-C  ##
+#################################
+
+.if !empty(PKG_OPTIONS:Mobjc) && empty(PKG_OPTIONS:Mbootstrap)
+LANGS+= objc
+.endif
+
+
+#########################
+##  TESTSUITE SUPPORT  ##
+#########################
+
+.if !empty(PKG_OPTIONS:Mtestsuite) && empty(PKG_OPTIONS:Mbootstrap)
+BUILD_DEPENDS+= dejagnu>=1.4:../../devel/dejagnu
+APPLY_DIFFS+= ada-testsuite
+APPLY_DIFFS+= gcc-testsuite
+.endif
+
+
+###############################
+##  STATICALLY BUILT OPTION  ##
+###############################
+
+.if !empty(PKG_OPTIONS:Mstatic)
+STATIC_BUILD = yes
+.endif
+
+.if defined(STATIC_BUILD) && empty(PKG_OPTIONS:Mbootstrap)
+.  if ${OPSYS} == SunOS
+PKG_FAIL_REASON+= SunOS does not support static builds
+.  else
+EXTRA_CONFARGS+= --with-stage1-ldflags=-static
+.  endif
+.endif
+
+
+#################################
+##  BOOTSTRAP COMPILER OPTION  ##
+#################################
+
+# Solaris does not support static linking system libraries, so bootstraps
+# on SunOS require gmp&co to be built with gcc.  Also, OpenBSD x86-64
+# fails configuration during the linking of -lmpc -lmpfr -lgmp in a contest;
+# it complains of missing references in libm.  These libraries are built by
+# a different compiler (the base) so perhaps that's the problem.  Building
+# gmp&co in the tree allows the configure step to succeed on OpenBSD.
+
+.if ${OPSYS} == OpenBSD || ${OPSYS} == MirBSD || \
+   (${OPSYS} == SunOS && !empty(PKG_OPTIONS:Mbootstrap))
+.include "../../devel/gmp/inplace.mk"
+.include "../../math/mpcomplex/inplace.mk"
+.include "../../math/mpfr/inplace.mk"
+.else
+EXTRA_CONFARGS+= --with-gmp=${BUILDLINK_PREFIX.gmp}
+EXTRA_CONFARGS+= --with-mpfr=${BUILDLINK_PREFIX.mpfr}
+EXTRA_CONFARGS+= --with-mpc=${BUILDLINK_PREFIX.mpcomplex}
+.include "../../devel/gmp/buildlink3.mk"
+.include "../../math/mpfr/buildlink3.mk"
+.include "../../math/mpcomplex/buildlink3.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mbootstrap)
+EXTRA_CONFARGS+= --disable-shared --disable-lto
+EXTRA_CONFARGS+= --disable-libstdcxx-pch
+.  if ${OPSYS} != SunOS
+EXTRA_CONFARGS+= --with-stage1-ldflags=-static
+EXTRA_CONFARGS+= --with-boot-ldflags=-static
+EXTRA_CONFARGS+= --with-system-zlib
+.  endif
+.else
+.  if empty(PKG_OPTIONS:Mallstages)
+EXTRA_CONFARGS+= --disable-bootstrap
+EXTRA_CONFARGS+= --disable-libcc1
+.  endif
+EXTRA_CONFARGS+= --enable-shared
+.endif

Index: pkgsrc/lang/gcc6-aux/files/diff-ada
diff -u /dev/null pkgsrc/lang/gcc6-aux/files/diff-ada:1.1
--- /dev/null   Tue Dec 13 01:19:20 2016
+++ pkgsrc/lang/gcc6-aux/files/diff-ada Tue Dec 13 01:19:20 2016
@@ -0,0 +1,2036 @@
+--- gcc/ada/adaint.c.orig
++++ gcc/ada/adaint.c
+@@ -1157,6 +1157,47 @@
+     free (pname);
+   }
+ 
++#elif defined (__ANDROID__)
++
++  /*
++   * ext2 /ext3/ext4/fat16/fat32 have no path limits
++   * /data/local/tmp normally requires rooted devices, if it even exists
++   * /sdcard is the standard location for external storage.  Nativeactivity
++   * manifest needs to authorize its use, otherwise it might not have the
++   * proper permissions.
++   */
++
++  int testfd;
++  char *datadir = getenv ("ANDROID_DATA");
++
++  if (datadir == NULL)
++    strncpy (tmp_filename, "/data/local/tmp/gnat-XXXXXX", L_tmpnam);
++  else
++    snprintf (tmp_filename, L_tmpnam, "%s/local/tmp/gnat-XXXXXX", datadir);
++
++  testfd = mkstemp (tmp_filename);
++  if (testfd != -1)
++    {
++      close (testfd);
++      return;
++    }
++
++  char *sdcard = getenv ("EXTERNAL_STORAGE");
++
++  if (sdcard == NULL)
++    strncpy (tmp_filename, "/sdcard/gnat-XXXXXX", L_tmpnam);
++  else
++    snprintf (tmp_filename, L_tmpnam, "%s/gnat-XXXXXX", sdcard);
++
++  testfd = mkstemp (tmp_filename);
++  if (testfd != -1)
++    {
++      close (testfd);
++      return;
++    }
++
++  tmpnam (tmp_filename);
++
+ #elif defined (__linux__) || defined (__FreeBSD__) || defined (__NetBSD__) \
+   || defined (__OpenBSD__) || defined (__GLIBC__) || defined (__ANDROID__) \
+   || defined (__DragonFly__)
+@@ -1443,7 +1484,7 @@
+   utimbuf.modtime = time_stamp;
+ 
+   /* Set access time to now in local time.  */
+-  t = time ((time_t) 0);
++  t = time (NULL);
+   utimbuf.actime = mktime (localtime (&t));
+ 
+   utime (name, &utimbuf);
+--- gcc/ada/cio.c.orig
++++ gcc/ada/cio.c
+@@ -49,7 +49,7 @@
+ 
+ /* Don't use macros on GNU/Linux since they cause incompatible changes between
+    glibc 2.0 and 2.1 */
+-#ifdef __linux__
++#if defined __linux__ && !defined __ANDROID__
+ #undef putchar
+ #undef getchar
+ #undef fputc
+--- gcc/ada/cstreams.c.orig
++++ gcc/ada/cstreams.c
+@@ -69,7 +69,7 @@
+ #include <unixlib.h>
+ #endif
+ 
+-#ifdef __linux__
++#if defined __linux__ && !defined __ANDROID__
+ /* Don't use macros on GNU/Linux since they cause incompatible changes between
+    glibc 2.0 and 2.1 */
+ 
+--- /dev/null
++++ gcc/ada/g-socthi-bsd.adb
+@@ -0,0 +1,356 @@
++------------------------------------------------------------------------------
++--                                                                          --
++--                         GNAT COMPILER COMPONENTS                         --
++--                                                                          --
++--                    G N A T . S O C K E T S . T H I N                     --
++--                                                                          --
++--                                 B o d y                                  --
++--                                                                          --
++--                     Copyright (C) 2001-2013, AdaCore                     --
++--                                                                          --
++-- GNAT is free software;  you can  redistribute it  and/or modify it under --
++-- terms of the  GNU General Public License as published  by the Free Soft- --
++-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
++-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
++-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
++-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
++--                                                                          --
++-- As a special exception under Section 7 of GPL version 3, you are granted --
++-- additional permissions described in the GCC Runtime Library Exception,   --
++-- version 3.1, as published by the Free Software Foundation.               --
++--                                                                          --
++-- You should have received a copy of the GNU General Public License and    --
++-- a copy of the GCC Runtime Library Exception along with this program;     --
++-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
++-- <http://www.gnu.org/licenses/>.                                          --
++--                                                                          --
++-- GNAT was originally developed  by the GNAT team at  New York University. --
++-- Extensive contributions were provided by Ada Core Technologies Inc.      --
++--                                                                          --
++------------------------------------------------------------------------------
++
++--  This package provides a target dependent thin interface to the sockets
++--  layer for use by the GNAT.Sockets package (g-socket.ads). This package
++--  should not be directly with'ed by an applications program.
++
++--  This is the *BSD version which uses fcntl rather than ioctl
++--  The constant SCON.Thread_Blocking_IO is always true (for all platforms, not
++--  just *BSD), so this binding is significantly simpler than the standard
++--  one it replaces.
++
++with GNAT.OS_Lib; use GNAT.OS_Lib;
++
++with Interfaces.C; use Interfaces.C;
++
++package body GNAT.Sockets.Thin is
++
++   function Syscall_Accept
++     (S       : C.int;
++      Addr    : System.Address;
++      Addrlen : not null access C.int) return C.int;
++   pragma Import (C, Syscall_Accept, "accept");
++   --  The accept() function accepts a connection on a socket.  An incoming
++   --  connection is acknowledged and associated with an immediately created
++   --  socket.  The original socket is returned to the listening state.
++
++   function Syscall_Connect
++     (S       : C.int;
++      Name    : System.Address;
++      Namelen : C.int) return C.int;
++   pragma Import (C, Syscall_Connect, "connect");
++   --  The connect() system call initiates a connection on a socket.  If the
++   --  parameter S is of type SOCK_DGRAM then connect() permanently specifies
++   --  the peer to which datagrams are to be sent.  If S is type SOCK_STREAM
++   --  then connect() attempts to make a connection with another socket, which
++   --  is identified by the parameter Name.
++
++   function Syscall_Recv
++     (S     : C.int;
++      Msg   : System.Address;
++      Len   : C.int;
++      Flags : C.int) return C.int;
++   pragma Import (C, Syscall_Recv, "recv");
++   --  The recv() function receives a message from a socket.  The call can be
++   --  used on a connection mode socket or a bound, connectionless socket.  If
++   --  no messages are available at the socket, the recv() call waits for a
++   --  message to arrive unless the socket is non-blocking.  If a socket is
++   --  non-blocking, the call returns a -1 and ERRNO is set to EWOULDBLOCK.
++
++   function Syscall_Recvfrom
++     (S       : C.int;
++      Msg     : System.Address;
++      Len     : C.int;
++      Flags   : C.int;
++      From    : System.Address;
++      Fromlen : not null access C.int) return C.int;
++   pragma Import (C, Syscall_Recvfrom, "recvfrom");
++   --  The recvfrom() system call receives a message from a socket and captures
++   --  the address from which the data was sent.  It can be used to receive
++   --  data on an unconnected socket as well.  If no messages are available,
++   --  the call waits for a message to arrive on blocking sockets.  For
++   --  non-blocking sockets without messages, -1 is returned and ERRNO is set
++   --  to EAGAIN or EWOULDBLOCK.
++
++   function Syscall_Recvmsg
++     (S     : C.int;
++      Msg   : System.Address;
++      Flags : C.int) return System.CRTL.ssize_t;
++   pragma Import (C, Syscall_Recvmsg, "recvmsg");
++   --  The recvmsg call receives a message from a socket, and can be used to
++   --  receive data on an unconnected socket as well.  If no messages are
++   --  available, the call waits for a message to arrive on blocking sockets.
++   --  For non-blocking sockets without messages, -1 is returned and ERRNO is
++   --  set to EAGAIN or EWOULDBLOCK.
++
++   function Syscall_Sendmsg
++     (S     : C.int;
++      Msg   : System.Address;
++      Flags : C.int) return System.CRTL.ssize_t;
++   pragma Import (C, Syscall_Sendmsg, "sendmsg");
++   --  The sendmsg() function sends a message to a socket, and can be used with
++   --  unconnected sockets as well (the msg is ignored in this case).  The
++   --  function returns the number of bytes sent when successful, otherwise it
++   --  returns -1 and ERRNO is set (many possible values).
++
++   function Syscall_Sendto
++     (S     : C.int;
++      Msg   : System.Address;
++      Len   : C.int;
++      Flags : C.int;
++      To    : System.Address;
++      Tolen : C.int) return C.int;
++   pragma Import (C, Syscall_Sendto, "sendto");
++   --  The sendto() function only works for connected sockets and it initiates
++   --  the transmission of a message.  A successful call returns the numbers of
++   --  bytes sent, and a failure returns a -1 and ERRNO is set.
++
++   function Syscall_Socket
++     (Domain   : C.int;
++      Typ      : C.int;
++      Protocol : C.int) return C.int;
++   pragma Import (C, Syscall_Socket, "socket");
++   --  The socket() function is used to create an unbound socket and returns a
++   --  file descriptor that can be used with other socket functions.  Upon
++   --  failure, a -1 is returned and ERRNO is set.
++
++   procedure Disable_SIGPIPE (S : C.int);
++   pragma Import (C, Disable_SIGPIPE, "__gnat_disable_sigpipe");
++
++   procedure Disable_All_SIGPIPEs;
++   pragma Import (C, Disable_All_SIGPIPEs, "__gnat_disable_all_sigpipes");
++   --  Sets the process to ignore all SIGPIPE signals on platforms that
++   --  don't support Disable_SIGPIPE for particular streams.
++
++   function C_Fcntl
++     (Fd  : C.int;
++      Cmd : C.int;
++      Val : C.int) return C.int;
++   pragma Import (C, C_Fcntl, "fcntl");
++   --  The ioctl of 64-bit DragonFlyBSD, OpenBSD, and NetBSD does not support
++   --  setting a socket in non-blocking mode.  fcntl must be used instead.
++
++   --------------
++   -- C_Accept --
++   --------------
++
++   function C_Accept
++     (S       : C.int;
++      Addr    : System.Address;
++      Addrlen : not null access C.int) return C.int
++   is
++      R : constant C.int := Syscall_Accept (S, Addr, Addrlen);
++   begin
++
++      Disable_SIGPIPE (R);
++      return R;
++   end C_Accept;
++
++   ---------------
++   -- C_Connect --
++   ---------------
++
++   function C_Connect
++     (S       : C.int;
++      Name    : System.Address;
++      Namelen : C.int) return C.int
++   is
++   begin
++      return Syscall_Connect (S, Name, Namelen);
++   end C_Connect;
++
++   ------------------
++   -- Socket_Ioctl --
++   ------------------
++
++   function Socket_Ioctl
++     (S   : C.int;
++      Req : SOSC.IOCTL_Req_T;
++      Arg : access C.int) return C.int
++   is
++   begin
++      if Req = SOSC.FIONBIO then
++         declare
++            use Interfaces;
++            flags    : constant Unsigned_32 :=
++                                Unsigned_32 (C_Fcntl (S, SOSC.F_GETFL, 0));
++            nonblock : constant Unsigned_32 := Unsigned_32 (SOSC.O_NDELAY);
++            enabled  : constant Boolean := Arg.all = 1;
++            newval   : C.int := C.int (flags);
++         begin
++            if enabled then
++               newval := C.int (flags or nonblock);
++            elsif (flags and nonblock) > 0 then
++               newval := C.int (flags - nonblock);
++            end if;
++            return C_Fcntl (Fd => S, Cmd => SOSC.F_SETFL, Val => newval);
++         end;
++      end if;
++
++      return C_Ioctl (S, Req, Arg);
++   end Socket_Ioctl;
++
++   ------------
++   -- C_Recv --
++   ------------
++
++   function C_Recv
++     (S     : C.int;
++      Msg   : System.Address;
++      Len   : C.int;
++      Flags : C.int) return C.int
++   is
++   begin
++      return Syscall_Recv (S, Msg, Len, Flags);
++   end C_Recv;
++
++   ----------------
++   -- C_Recvfrom --
++   ----------------
++
++   function C_Recvfrom
++     (S       : C.int;
++      Msg     : System.Address;
++      Len     : C.int;
++      Flags   : C.int;
++      From    : System.Address;
++      Fromlen : not null access C.int) return C.int
++   is
++   begin
++      return Syscall_Recvfrom (S, Msg, Len, Flags, From, Fromlen);
++   end C_Recvfrom;
++
++   ---------------
++   -- C_Recvmsg --
++   ---------------
++
++   function C_Recvmsg
++     (S     : C.int;
++      Msg   : System.Address;
++      Flags : C.int) return System.CRTL.ssize_t
++   is
++   begin
++      return  Syscall_Recvmsg (S, Msg, Flags);
++   end C_Recvmsg;
++
++   ---------------
++   -- C_Sendmsg --
++   ---------------
++
++   function C_Sendmsg
++     (S     : C.int;
++      Msg   : System.Address;
++      Flags : C.int) return System.CRTL.ssize_t
++   is
++   begin
++      return Syscall_Sendmsg (S, Msg, Flags);
++   end C_Sendmsg;
++
++   --------------
++   -- C_Sendto --
++   --------------
++
++   function C_Sendto
++     (S     : C.int;
++      Msg   : System.Address;
++      Len   : C.int;
++      Flags : C.int;
++      To    : System.Address;
++      Tolen : C.int) return C.int
++   is
++   begin
++      return Syscall_Sendto (S, Msg, Len, Flags, To, Tolen);
++   end C_Sendto;
++
++   --------------
++   -- C_Socket --
++   --------------
++
++   function C_Socket
++     (Domain   : C.int;
++      Typ      : C.int;
++      Protocol : C.int) return C.int
++   is
++      R : constant C.int := Syscall_Socket (Domain, Typ, Protocol);
++   begin
++      Disable_SIGPIPE (R);
++      return R;
++   end C_Socket;
++
++   --------------
++   -- Finalize --
++   --------------
++
++   procedure Finalize is
++   begin
++      null;
++   end Finalize;
++
++   -------------------------
++   -- Host_Error_Messages --
++   -------------------------
++
++   package body Host_Error_Messages is separate;
++
++   ----------------
++   -- Initialize --
++   ----------------
++
++   procedure Initialize is
++   begin
++      Disable_All_SIGPIPEs;
++   end Initialize;
++
++   --------------------
++   -- Signalling_Fds --
++   --------------------
++
++   package body Signalling_Fds is
++
++      --  In this default implementation, we use a C version of these
++      --  subprograms provided by socket.c.
++
++      function C_Create (Fds : not null access Fd_Pair) return C.int;
++      function C_Read (Rsig : C.int) return C.int;
++      function C_Write (Wsig : C.int) return C.int;
++      procedure C_Close (Sig : C.int);
++
++      pragma Import (C, C_Create, "__gnat_create_signalling_fds");
++      pragma Import (C, C_Read,   "__gnat_read_signalling_fd");
++      pragma Import (C, C_Write,  "__gnat_write_signalling_fd");
++      pragma Import (C, C_Close,  "__gnat_close_signalling_fd");
++
++      function Create
++        (Fds : not null access Fd_Pair) return C.int renames C_Create;
++      function Read (Rsig : C.int) return C.int renames C_Read;
++      function Write (Wsig : C.int) return C.int renames C_Write;
++      procedure Close (Sig : C.int) renames C_Close;
++
++   end Signalling_Fds;
++
++   --------------------------
++   -- Socket_Error_Message --
++   --------------------------
++
++   function Socket_Error_Message (Errno : Integer) return String is separate;
++
++end GNAT.Sockets.Thin;
+--- gcc/ada/gnatchop.adb.orig
++++ gcc/ada/gnatchop.adb
+@@ -44,7 +44,7 @@
+    Config_File_Name : constant String_Access := new String'("gnat.adc");
+    --  The name of the file holding the GNAT configuration pragmas
+ 
+-   Gcc : String_Access := new String'("gcc");
++   Gcc : String_Access := new String'("ada");
+    --  May be modified by switch --GCC=
+ 
+    Gcc_Set : Boolean := False;
+--- gcc/ada/gnatlink.adb.orig
++++ gcc/ada/gnatlink.adb
+@@ -136,7 +136,7 @@
+    --  This table collects the arguments to be passed to compile the binder
+    --  generated file.
+ 
+-   Gcc : String_Access := Program_Name ("gcc", "gnatlink");
++   Gcc : String_Access := Program_Name ("ada", "gnatlink");
+ 
+    Read_Mode : constant String := "r" & ASCII.NUL;
+ 
+--- gcc/ada/make.adb.orig
++++ gcc/ada/make.adb
+@@ -667,7 +667,7 @@
+    -- Compiler, Binder & Linker Data and Subprograms --
+    ----------------------------------------------------
+ 
+-   Gcc      : String_Access := Program_Name ("gcc", "gnatmake");
++   Gcc      : String_Access := Program_Name ("ada", "gnatmake");
+    Gnatbind : String_Access := Program_Name ("gnatbind", "gnatmake");
+    Gnatlink : String_Access := Program_Name ("gnatlink", "gnatmake");
+    --  Default compiler, binder, linker programs
+--- gcc/ada/mlib-prj.adb.orig
++++ gcc/ada/mlib-prj.adb
+@@ -335,6 +335,11 @@
+ 
+       Foreign_Sources : Boolean;
+ 
++      Rpath_Disabled : Boolean := False;
++      --  If -R is passed through the library options for the linker, it will
++      --  prevent the implemented libraries portion of the rpath switch from
++      --  being built, even if the linker is capable of supporting rpath.
++
+       Rpath : String_Access := null;
+       --  Allocated only if Path Option is supported
+ 
+@@ -768,7 +773,7 @@
+             Opts.Table (Opts.Last) :=
+               new String'("-L" & Name_Buffer (1 .. Name_Len));
+ 
+-            if Path_Option /= null then
++            if not Rpath_Disabled and then Path_Option /= null then
+                Add_Rpath (Name_Buffer (1 .. Name_Len));
+             end if;
+ 
+@@ -1299,9 +1304,13 @@
+                   Get_Name_String (Element.Value);
+ 
+                   if Name_Len /= 0 then
+-                     Opts.Increment_Last;
+-                     Opts.Table (Opts.Last) :=
+-                       new String'(Name_Buffer (1 .. Name_Len));
++                     if Name_Buffer (1 .. Name_Len) = "-R" then
++                        Rpath_Disabled := True;
++                     else
++                        Opts.Increment_Last;
++                        Opts.Table (Opts.Last) :=
++                          new String'(Name_Buffer (1 .. Name_Len));
++                     end if;
+                   end if;
+ 
+                   Current := Element.Next;
+--- gcc/ada/mlib-utl.adb.orig
++++ gcc/ada/mlib-utl.adb
+@@ -446,7 +446,7 @@
+       if Driver_Name = No_Name then
+          if Gcc_Exec = null then
+             if Gcc_Name = null then
+-               Gcc_Name := Osint.Program_Name ("gcc", "gnatmake");
++               Gcc_Name := Osint.Program_Name ("ada", "gnatmake");
+             end if;
+ 
+             Gcc_Exec := Locate_Exec_On_Path (Gcc_Name.all);
+--- gcc/ada/prj-makr.adb.orig
++++ gcc/ada/prj-makr.adb
+@@ -115,7 +115,7 @@
+ 
+    procedure Dup2 (Old_Fd, New_Fd : File_Descriptor);
+ 
+-   Gcc      : constant String := "gcc";
++   Gcc      : constant String := "ada";
+    Gcc_Path : String_Access := null;
+ 
+    Non_Empty_Node : constant Project_Node_Id := 1;
+--- /dev/null
++++ gcc/ada/s-trasym-bsd.adb
+@@ -0,0 +1,151 @@
++------------------------------------------------------------------------------
++--                                                                          --
++--                         GNAT RUN-TIME COMPONENTS                         --
++--                                                                          --
++--           S Y S T E M . T R A C E B A C K . S Y M B O L I C              --
++--                                                                          --
++--                                 B o d y                                  --
++--                                                                          --
++--                     Copyright (C) 1999-2009, AdaCore                     --
++--                                                                          --
++-- GNAT is free software;  you can  redistribute it  and/or modify it under --
++-- terms of the  GNU General Public License as published  by the Free Soft- --
++-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
++-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
++-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
++-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
++-- for  more details.  You should have  received  a copy of the GNU General --
++-- Public License  distributed with GNAT;  see file COPYING.  If not, write --
++-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
++-- Boston, MA 02110-1301, USA.                                              --
++--                                                                          --
++-- As a special exception,  if other files  instantiate  generics from this --
++-- unit, or you link  this unit with other files  to produce an executable, --
++-- this  unit  does not  by itself cause  the resulting  executable  to  be --
++-- covered  by the  GNU  General  Public  License.  This exception does not --
++-- however invalidate  any other reasons why  the executable file  might be --
++-- covered by the  GNU Public License.                                      --
++--                                                                          --
++-- GNAT was originally developed  by the GNAT team at  New York University. --
++-- Extensive contributions were provided by Ada Core Technologies Inc.      --
++--                                                                          --
++------------------------------------------------------------------------------
++
++--  Run-time symbolic traceback support
++--  This file is based on the work by Juergen Pfiefer which is still used
++--  today to provide symbolic traceback support for gnu/kFreeBSD.
++--  Incorporated in GNAT-AUX by John Marino <http://www.dragonlace.net>
++
++with System.Soft_Links;
++with Ada.Exceptions.Traceback; use Ada.Exceptions.Traceback;
++
++package body System.Traceback.Symbolic is
++
++   package TSL renames System.Soft_Links;
++
++   --  To perform the raw addresses to symbolic form translation we rely on a
++   --  libaddr2line symbolizer which examines debug info from a provided
++   --  executable file name, and an absolute path is needed to ensure the file
++   --  is always found. This is "__gnat_locate_exec_on_path (gnat_argv [0])"
++   --  for our executable file, a fairly heavy operation so we cache the
++   --  result.
++
++   Exename : System.Address;
++   --  Pointer to the name of the executable file to be used on all
++   --  invocations of the libaddr2line symbolization service.
++
++   Exename_Resolved : Boolean := False;
++   --  Flag to indicate whether we have performed the executable file name
++   --  resolution already. Relying on a not null Exename for this purpose
++   --  would be potentially inefficient as this is what we will get if the
++   --  resolution attempt fails.
++
++   ------------------------
++   -- Symbolic_Traceback --
++   ------------------------
++
++   function Symbolic_Traceback (Traceback : Tracebacks_Array) return String is
++
++      procedure convert_addresses
++        (filename : System.Address;
++         addrs    : System.Address;
++         n_addrs  : Integer;
++         buf      : System.Address;
++         len      : System.Address);
++      pragma Import (C, convert_addresses, "convert_addresses");
++      --  This is the procedure version of the Ada-aware addr2line. It places
++      --  in BUF a string representing the symbolic translation of the N_ADDRS
++      --  raw addresses provided in ADDRS, looked up in debug information from
++      --  FILENAME. LEN points to an integer which contains the size of the
++      --  BUF buffer at input and the result length at output.
++      --
++      --  Note that this procedure is *not* thread-safe.
++
++      type Argv_Array is array (0 .. 0) of System.Address;
++      gnat_argv : access Argv_Array;
++      pragma Import (C, gnat_argv, "gnat_argv");
++
++      function locate_exec_on_path
++        (c_exename : System.Address) return System.Address;
++      pragma Import (C, locate_exec_on_path, "__gnat_locate_exec_on_path");
++
++      B_Size : constant Integer := 256 * Traceback'Length;
++      Len    : Integer := B_Size;
++      Res    : String (1 .. B_Size);
++
++      use type System.Address;
++
++   begin
++      --  The symbolic translation of an empty set of addresses is an empty
++      --  string.
++
++      if Traceback'Length = 0 then
++         return "";
++      end if;
++
++      --  If our input set of raw addresses is not empty, resort to the
++      --  libaddr2line service to symbolize it all.
++
++      --  Compute, cache and provide the absolute path to our executable file
++      --  name as the binary file where the relevant debug information is to be
++      --  found. If the executable file name resolution fails, we have no
++      --  sensible basis to invoke the symbolizer at all.
++
++      --  Protect all this against concurrent accesses explicitly, as the
++      --  underlying services are potentially thread unsafe.
++
++      TSL.Lock_Task.all;
++
++      if not Exename_Resolved then
++         Exename := locate_exec_on_path (gnat_argv (0));
++         Exename_Resolved := True;
++      end if;
++
++      if Exename /= System.Null_Address then
++         Len := Res'Length;
++         convert_addresses
++           (Exename, Traceback'Address, Traceback'Length,
++            Res (1)'Address, Len'Address);
++      end if;
++
++      TSL.Unlock_Task.all;
++
++      --  Return what the addr2line symbolizer has produced if we have called
++      --  it (the executable name resolution succeeded), or an empty string
++      --  otherwise.
++
++      if Exename /= System.Null_Address then
++         return Res (1 .. Len);
++      else
++         return "";
++      end if;
++
++   end Symbolic_Traceback;
++
++   function Symbolic_Traceback
++     (E : Ada.Exceptions.Exception_Occurrence) return String is
++   begin
++      return Symbolic_Traceback (Tracebacks (E));
++   end Symbolic_Traceback;
++
++end System.Traceback.Symbolic;
+--- gcc/ada/terminals.c.orig
++++ gcc/ada/terminals.c
+@@ -32,7 +32,7 @@
+ /* First all usupported platforms. Add stubs for exported routines. */
+ 
+ #if defined (VMS) || defined (__vxworks) || defined (__Lynx__) \
+-  || defined (__ANDROID__) || defined (__PikeOS__)
++  || defined (__PikeOS__)
+ 
+ #define ATTRIBUTE_UNUSED __attribute__((unused))
+ 
+@@ -1059,7 +1059,7 @@
+  || defined (__OpenBSD__) \
+  || defined (__NetBSD__)  \
+  || defined (__DragonFly__)
+-#   define BSD
++#   define FREEBSD
+ #endif
+ 
+ /* Include every system header we need */
+@@ -1070,8 +1070,8 @@
+ 
+ /* On some system termio is either absent or including it will disable termios
+    (HP-UX) */
+-#if !defined (__hpux__) && !defined (BSD) && !defined (__APPLE__) \
+-  && !defined (__rtems__)
++#if ! defined (__hpux__) && ! defined (FREEBSD) && \
++    ! defined (__APPLE__) && ! defined(__rtems__)
+ #   include <termio.h>
+ #endif
+ 
+@@ -1083,10 +1083,10 @@
+ #include <sys/types.h>
+ #include <sys/wait.h>
+ #include <unistd.h>
+-#if defined (__sun__)
++#if defined (sun)
+ #   include <sys/stropts.h>
+ #endif
+-#if defined (BSD) || defined (__sun__)
++#if defined (FREEBSD) || defined (sun)
+ #   include <sys/signal.h>
+ #endif
+ #if defined (__hpux__)
+@@ -1094,11 +1094,15 @@
+ #   include <sys/stropts.h>
+ #endif
+ 
++#ifdef __ANDROID__
++#define CDISABLE _PC_VDISABLE
++#else
+ #define CDISABLE _POSIX_VDISABLE
++#endif
+ 
+ /* On HP-UX and Sun system, there is a bzero function but with a different
+    signature. Use memset instead */
+-#if defined (__hpux__) || defined (__sun__) || defined (_AIX)
++#if defined (__hpux__) || defined (sun) || defined (_AIX)
+ #   define bzero(s,n) memset (s,0,n)
+ #endif
+ 
+@@ -1116,11 +1120,11 @@
+ */
+ 
+ /* Configurable part */
+-#if defined (__APPLE__) || defined (BSD)
++#if defined (__APPLE__) || defined (FREEBSD)
+ #define USE_OPENPTY
+-#elif defined (__linux__)
++#elif defined (linux)
+ #define USE_GETPT
+-#elif defined (__sun__)
++#elif defined (sun)
+ #define USE_CLONE_DEVICE "/dev/ptmx"
+ #elif defined (_AIX)
+ #define USE_CLONE_DEVICE "/dev/ptc"
+@@ -1406,7 +1410,7 @@
+     desc->slave_fd = open (desc->slave_name, O_RDWR, 0);
+ #endif
+ 
+-#if defined (__sun__) || defined (__hpux__)
++#if defined (sun) || defined (__hpux__)
+   /* On systems such as Solaris we are using stream. We need to push the right
+      "modules" in order to get the expected terminal behaviors. Otherwise
+      functionalities such as termios are not available.  */
+--- /dev/null
++++ gcc/ada/traceback_symbolic.c
+@@ -0,0 +1,201 @@
++/*
++  Copyright (C) 1999 by Juergen Pfeifer <juergen.pfeifer%gmx.net@localhost>
++  Ada for Linux Team (ALT)
++  Heavily modified by John Marino <http://www.dragonlace.net>
++
++  Permission is hereby granted, free of charge, to any person obtaining a
++  copy of this software and associated documentation files (the
++  "Software"), to deal in the Software without restriction, including
++  without limitation the rights to use, copy, modify, merge, publish,
++  distribute, distribute with modifications, sublicense, and/or sell
++  copies of the Software, and to permit persons to whom the Software is
++  furnished to do so, subject to the following conditions:
++
++  The above copyright notice and this permission notice shall be included
++  in all copies or substantial portions of the Software.
++
++  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
++  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
++  IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
++  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
++  OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
++  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
++
++  Except as contained in this notice, the name(s) of the above copyright
++  holders shall not be used in advertising or otherwise to promote the
++  sale, use or other dealings in this Software without prior written
++  authorization.
++*/
++
++#ifdef IS_CROSS
++
++
++/*
++ * Running addr2line doesn't make sense for cross-compiled objects.
++ * Create a dummy function to satisfy g-trasym.o
++ */
++
++void
++convert_addresses (const char *file_name ATTRIBUTE_UNUSED,
++                   void *addrs ATTRIBUTE_UNUSED,
++                   int n_addr ATTRIBUTE_UNUSED,
++                   void *buf ATTRIBUTE_UNUSED,
++                   int *len ATTRIBUTE_UNUSED)
++{
++  *len = 0;
++}
++
++#else
++
++
++/*
++ * use the external program /usr/bin/addr2line to convert addresses
++ * into file names and line numbers
++ */
++
++#include <sys/types.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <string.h>
++#include <signal.h>
++
++#define CLOSE_SENDPIPE close(sendpipe[0]); close(sendpipe[1])
++#define CLOSE_READPIPE close(readpipe[0]); close(readpipe[1])
++#define DUP2CLOSE(oldfd, newfd) dup2(oldfd, newfd); close(oldfd);
++#define RESTSIG sigaction(SIGPIPE,&oact,NULL)
++
++#define MAX_LINE     1024
++#define PARENT_READ  readpipe[0]
++#define CHILD_WRITE  readpipe[1]
++#define CHILD_READ   sendpipe[0]
++#define PARENT_WRITE sendpipe[1]
++
++#if defined (__sun__)
++#define ADDR2LINE_PROG        "/usr/gnu/bin/addr2line"
++#else
++#define ADDR2LINE_PROG        "/usr/bin/addr2line"
++#endif
++
++void
++convert_addresses (const char *file_name,
++                   void *addrs,
++                   int   n_addr,
++                   void *buf,
++                   int  *len)
++{
++  int max_len = *len;
++  pid_t childpid;
++
++  struct sigaction act, oact;
++
++  int sendpipe[2] = {-1,-1},        /* parent -> child */
++      readpipe[2] = {-1,-1};        /* parent <- child */
++
++  *len = 0;
++  act.sa_handler = SIG_IGN;
++  sigemptyset(&act.sa_mask);
++  act.sa_flags = 0;
++  if (sigaction(SIGPIPE,&act,&oact) < 0)
++    return;
++
++  if (pipe(sendpipe) < 0) { RESTSIG; return; }
++  if (pipe(readpipe) < 0) { CLOSE_SENDPIPE; RESTSIG; return; }
++  if ((childpid = fork()) < 0) {
++    CLOSE_READPIPE;
++    CLOSE_SENDPIPE;
++    RESTSIG;
++    return;
++  }
++
++  if (childpid == 0) {    /* child process */
++    close(PARENT_WRITE);
++    close(PARENT_READ);
++    if ((CHILD_READ != STDIN_FILENO) && (CHILD_WRITE != STDOUT_FILENO)) {
++      if ((CHILD_READ == STDOUT_FILENO) && (CHILD_WRITE == STDIN_FILENO)) {
++        const int temp_fd = dup(CHILD_WRITE);
++        close (CHILD_WRITE);
++        DUP2CLOSE (CHILD_READ, STDIN_FILENO);
++        DUP2CLOSE (temp_fd,    STDOUT_FILENO);
++      }
++      else if ((CHILD_READ == STDIN_FILENO) && (CHILD_WRITE > 1)) {
++        DUP2CLOSE (CHILD_WRITE, STDOUT_FILENO);
++      }
++      else if ((CHILD_READ > 1) && (CHILD_WRITE == STDOUT_FILENO)) {
++        DUP2CLOSE (CHILD_READ, STDIN_FILENO);
++      }
++      else if ((CHILD_READ > 1) && (CHILD_WRITE == STDIN_FILENO)) {
++        DUP2CLOSE (CHILD_WRITE, STDOUT_FILENO);
++        DUP2CLOSE (CHILD_READ,  STDIN_FILENO);
++      }
++      else {
++        /* CHILD_READ >= 1 and CHILD_WRITE > 1 */
++        DUP2CLOSE (CHILD_READ,  STDIN_FILENO);
++        DUP2CLOSE (CHILD_WRITE, STDOUT_FILENO);
++      }
++    }
++    /* As pointed out by Florian Weimer to JP, it is a security threat to call
++       the script with a user defined environment and using the path. That
++       would be Trojans pleasure.  Therefore the absolute path to addr2line
++       and an empty environment is used. That should be safe.
++    */
++    char *const argv[] = { "addr2line",
++                           "-e", file_name,
++                           "--demangle=gnat",
++                           "--functions",
++                           "--basenames",
++                           NULL };
++    char *const envp[] = { NULL };
++    if (execve(ADDR2LINE_PROG, argv, envp) < 0) {
++      close (CHILD_WRITE);
++      close (CHILD_READ);
++      RESTSIG;
++      exit (1);
++    }
++  }
++
++  /* Below this line is parent process */
++  int i, n;
++  char hex[16];
++  char line[MAX_LINE + 1];
++  char *p;
++  char *s = buf;
++  long *trace_address = addrs;
++
++  close(CHILD_WRITE);
++  close(CHILD_READ);
++
++  for(i=0; i < n_addr; i++) {
++    snprintf(hex,sizeof(hex),"%#lx\n",*trace_address);
++    write(PARENT_WRITE,hex,strlen(hex));
++    n = read(PARENT_READ,line,MAX_LINE);
++    if (n<=0)
++      break;
++
++    line[n]=0;
++    /* We have approx. 16 additional chars for "%#lx in " clause.
++       We use this info to prevent a buffer overrun. */
++    if (n + 16 + (*len) > max_len)
++      break;
++
++    p = strchr(line,'\n');
++    if (p) {
++      if (*(p+1)) {
++        *p = 0;
++        *len += snprintf(s, (max_len - (*len)), "%#lx in %s at %s",
++                         *trace_address, line, p+1);
++      }
++      else {
++        *len += snprintf(s, (max_len - (*len)), "%#lx at %s",
++                         *trace_address, line);
++      }
++      s = buf + (*len);
++    }
++    trace_address += 1;
++  }
++  close (PARENT_WRITE);
++  close (PARENT_READ);
++  RESTSIG;
++}
++
++#endif
+--- gcc/ada/gcc-interface/Makefile.in.orig
++++ gcc/ada/gcc-interface/Makefile.in
+@@ -1170,6 +1170,7 @@
+ ifeq ($(strip $(filter-out arm% linux-androideabi,$(target_cpu) $(target_os))),)
+   LIBGNAT_TARGET_PAIRS = \
+   a-intnam.ads<a-intnam-linux.ads \
++  g-socthi.adb<g-socthi-bsd.adb \
+   s-inmaop.adb<s-inmaop-posix.adb \
+   s-intman.adb<s-intman-android.adb \
+   s-linux.ads<s-linux-android.ads \
+@@ -1277,6 +1278,7 @@
+   a-intnam.ads<a-intnam-solaris.ads \
+   s-inmaop.adb<s-inmaop-posix.adb \
+   s-intman.adb<s-intman-solaris.adb \
++  s-trasym.adb<s-trasym-bsd.adb \
+   s-mudido.adb<s-mudido-affinity.adb \
+   s-osinte.adb<s-osinte-solaris.adb \
+   s-osinte.ads<s-osinte-solaris.ads \
+@@ -1320,6 +1322,8 @@
+   EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
+ 
+   EH_MECHANISM=-gcc
++  EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c
++  EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o
+   THREADSLIB = -lposix4 -lthread
+   MISCLIB = -lposix4 -lnsl -lsocket
+   SO_OPTS = -Wl,-h,
+@@ -1475,10 +1479,45 @@
+   LIBRARY_VERSION := $(LIB_VERSION)
+ endif
+ 
++# x86 android
++ifeq ($(strip $(filter-out %86 linux-android,$(target_cpu) $(target_os))),)
++  LIBGNAT_TARGET_PAIRS = \
++  a-intnam.ads<a-intnam-linux.ads \
++  g-socthi.adb<g-socthi-bsd.adb \
++  s-inmaop.adb<s-inmaop-posix.adb \
++  s-intman.adb<s-intman-posix.adb \
++  s-linux.ads<s-linux-android.ads \
++  s-osinte.adb<s-osinte-android.adb \
++  s-osinte.ads<s-osinte-android.ads \
++  s-osprim.adb<s-osprim-posix.adb \
++  s-taprop.adb<s-taprop-posix.adb \
++  s-taspri.ads<s-taspri-posix.ads \
++  s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
++  $(ATOMICS_TARGET_PAIRS) \
++  $(X86_TARGET_PAIRS) \
++  system.ads<system-linux-x86.ads
++
++  TOOLS_TARGET_PAIRS =  \
++    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
++    indepsw.adb<indepsw-gnu.adb
++
++  EXTRA_LIBGNAT_OBJS=
++  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
++  EXTRA_GNATRTL_NONTASKING_OBJS=
++  EH_MECHANISM=-gcc
++  THREADSLIB=
++  MISCLIB=
++  GMEM_LIB=
++  GNATLIB_SHARED = gnatlib-shared-dual
++  LIBRARY_VERSION := $(LIB_VERSION)
++endif
++
+ # x86 FreeBSD
+ ifeq ($(strip $(filter-out %86 freebsd%,$(target_cpu) $(target_os))),)
+   LIBGNAT_TARGET_PAIRS = \
+   a-intnam.ads<a-intnam-freebsd.ads \
++  g-socthi.adb<g-socthi-bsd.adb \
++  s-trasym.adb<s-trasym-bsd.adb \
+   s-inmaop.adb<s-inmaop-posix.adb \
+   s-intman.adb<s-intman-posix.adb \
+   s-mudido.adb<s-mudido-affinity.adb \
+@@ -1496,6 +1535,8 @@
+   mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
+   GNATLIB_SHARED = gnatlib-shared-dual
+ 
++  EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c
++  EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o
+   EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
+ 
+   EH_MECHANISM=-gcc
+@@ -1509,6 +1550,8 @@
+ ifeq ($(strip $(filter-out %86_64 freebsd%,$(target_cpu) $(target_os))),)
+   LIBGNAT_TARGET_PAIRS = \
+   a-intnam.ads<a-intnam-freebsd.ads \
++  g-socthi.adb<g-socthi-bsd.adb \
++  s-trasym.adb<s-trasym-bsd.adb \
+   s-inmaop.adb<s-inmaop-posix.adb \
+   s-intman.adb<s-intman-posix.adb \
+   s-mudido.adb<s-mudido-affinity.adb \
+@@ -1526,6 +1569,8 @@
+   mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
+   GNATLIB_SHARED = gnatlib-shared-dual
+ 
++  EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c
++  EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o
+   EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
+ 
+   EH_MECHANISM=-gcc
+@@ -1539,6 +1584,8 @@
+ ifeq ($(strip $(filter-out %86_64 dragonfly%,$(target_cpu) $(target_os))),)
+   LIBGNAT_TARGET_PAIRS = \
+   a-intnam.ads<a-intnam-dragonfly.ads \
++  g-socthi.adb<g-socthi-bsd.adb \
++  s-trasym.adb<s-trasym-bsd.adb \
+   s-inmaop.adb<s-inmaop-posix.adb \
+   s-intman.adb<s-intman-posix.adb \
+   s-mudido.adb<s-mudido-affinity.adb \
+@@ -1556,6 +1603,76 @@
+   mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
+   GNATLIB_SHARED = gnatlib-shared-dual
+ 
++  EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c
++  EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o
++  EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
++
++  EH_MECHANISM=-gcc
++  THREADSLIB= -lpthread
++  GMEM_LIB = gmemlib
++  LIBRARY_VERSION := $(LIB_VERSION)
++  MISCLIB = -lutil
++endif
++
++# x86 NetBSD
++ifeq ($(strip $(filter-out %86 netbsd%,$(target_cpu) $(target_os))),)
++  LIBGNAT_TARGET_PAIRS = \
++  a-intnam.ads<a-intnam-freebsd.ads \
++  g-socthi.adb<g-socthi-bsd.adb \
++  s-trasym.adb<s-trasym-bsd.adb \
++  s-inmaop.adb<s-inmaop-posix.adb \
++  s-intman.adb<s-intman-posix.adb \
++  s-mudido.adb<s-mudido-affinity.adb \
++  s-osinte.adb<s-osinte-netbsd.adb \
++  s-osinte.ads<s-osinte-netbsd.ads \
++  s-osprim.adb<s-osprim-posix.adb \
++  s-taprop.adb<s-taprop-posix.adb \
++  s-taspri.ads<s-taspri-posix.ads \
++  s-tpopsp.adb<s-tpopsp-posix.adb \
++  $(ATOMICS_TARGET_PAIRS) \
++  $(X86_TARGET_PAIRS) \
++  system.ads<system-freebsd-x86.ads
++
++  TOOLS_TARGET_PAIRS = \
++  mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
++  GNATLIB_SHARED = gnatlib-shared-dual
++
++  EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c
++  EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o
++  EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
++
++  EH_MECHANISM=-gcc
++  THREADSLIB= -lpthread
++  GMEM_LIB = gmemlib
++  LIBRARY_VERSION := $(LIB_VERSION)
++  MISCLIB = -lutil
++endif
++
++# x86-64 NetBSD (must succeed x86 because %86 matches x86_64)
++ifeq ($(strip $(filter-out x86_64 netbsd%,$(target_cpu) $(target_os))),)
++  LIBGNAT_TARGET_PAIRS = \
++  a-intnam.ads<a-intnam-freebsd.ads \
++  g-socthi.adb<g-socthi-bsd.adb \
++  s-trasym.adb<s-trasym-bsd.adb \
++  s-inmaop.adb<s-inmaop-posix.adb \
++  s-intman.adb<s-intman-posix.adb \
++  s-mudido.adb<s-mudido-affinity.adb \
++  s-osinte.adb<s-osinte-netbsd.adb \
++  s-osinte.ads<s-osinte-netbsd.ads \
++  s-osprim.adb<s-osprim-posix.adb \
++  s-taprop.adb<s-taprop-posix.adb \
++  s-taspri.ads<s-taspri-posix.ads \
++  s-tpopsp.adb<s-tpopsp-posix.adb \
++  $(ATOMICS_TARGET_PAIRS) \
++  $(X86_64_TARGET_PAIRS) \
++  system.ads<system-freebsd-x86_64.ads
++
++  TOOLS_TARGET_PAIRS = \
++  mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
++  GNATLIB_SHARED = gnatlib-shared-dual
++
++  EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c
++  EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o
+   EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
+ 
+   EH_MECHANISM=-gcc
+--- gcc/ada/gcc-interface/Make-lang.in.orig
++++ gcc/ada/gcc-interface/Make-lang.in
+@@ -589,7 +589,7 @@
+  ada/widechar.o
+ 
+ # Language-independent object files.
+-ADA_BACKEND = $(BACKEND) attribs.o
++ADA_BACKEND = $(BACKEND2) attribs.o
+ 
+ # List of target dependent sources, overridden below as necessary
+ TARGET_ADA_SRCS =
+--- gcc/ada/init.c.orig
++++ gcc/ada/init.c
+@@ -2510,8 +2510,15 @@
+ {
+   mcontext_t *mcontext = &((ucontext_t *) ucontext)->uc_mcontext;
+ 
++#if defined (__i386__)
++  unsigned long *pc = (unsigned long *)mcontext->gregs[REG_EIP];
++  /* The pattern is "orl $0x0,(%esp)" for a probe in 32-bit mode.  */
++  if (signo == SIGSEGV && pc && *pc == 0x00240c83)
++    mcontext->gregs[REG_ESP] += 4096 + 4 * sizeof (unsigned long);
++#elif defined (__ARMEL__)
+   /* ARM Bump has to be an even number because of odd/even architecture.  */
+-  ((mcontext_t *) mcontext)->arm_pc += 2;
++  mcontext->arm_pc += 2;
++#endif
+ }
+ 
+ static void
+--- gcc/ada/sysdep.c.orig
++++ gcc/ada/sysdep.c
+@@ -287,6 +287,7 @@
+   || defined (__MACHTEN__) || defined (__hpux__) || defined (_AIX) \
+   || (defined (__svr4__) && defined (__i386__)) || defined (__Lynx__) \
+   || defined (__CYGWIN__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
++  || defined (__NetBSD__) \
+   || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__)
+ 
+ # ifdef __MINGW32__
+@@ -339,6 +340,7 @@
+     || defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \
+     || defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \
+     || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
++    || defined (__NetBSD__) \
+     || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__)
+   char c;
+   int nread;
+@@ -359,6 +361,7 @@
+     || defined (__MACHTEN__) || defined (__hpux__) \
+     || defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \
+     || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
++    || defined (__NetBSD__) \
+     || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__)
+       eof_ch = termios_rec.c_cc[VEOF];
+ 
+@@ -795,6 +798,7 @@
+    struct tm */
+ 
+ #elif defined (__APPLE__) || defined (__FreeBSD__) || defined (__linux__) \
++  || defined (__NetBSD__) \
+   || defined (__GLIBC__) || defined (__DragonFly__) || defined (__OpenBSD__)
+ {
+   localtime_r (timer, &tp);
+--- gcc/ada/s-osinte-netbsd.adb.orig
++++ gcc/ada/s-osinte-netbsd.adb
+@@ -0,0 +1,140 @@
++------------------------------------------------------------------------------
++--                                                                          --
++--                  GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                --
++--                                                                          --
++--                   S Y S T E M . O S _ I N T E R F A C E                  --
++--                                                                          --
++--                                   B o d y                                --
++--                                                                          --
++--          Copyright (C) 1991-2015, Free Software Foundation, Inc.         --
++--                                                                          --
++-- GNARL is free software; you can  redistribute it  and/or modify it under --
++-- terms of the  GNU General Public License as published  by the Free Soft- --
++-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
++-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
++-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
++-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
++--                                                                          --
++-- As a special exception under Section 7 of GPL version 3, you are granted --
++-- additional permissions described in the GCC Runtime Library Exception,   --
++-- version 3.1, as published by the Free Software Foundation.               --
++--                                                                          --
++-- You should have received a copy of the GNU General Public License and    --
++-- a copy of the GCC Runtime Library Exception along with this program;     --
++-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
++-- <http://www.gnu.org/licenses/>.                                          --
++--                                                                          --
++-- GNARL was developed by the GNARL team at Florida State University. It is --
++-- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
++-- State University (http://www.gnat.com).                                  --
++--                                                                          --
++------------------------------------------------------------------------------
++
++--  This is the NetBSD THREADS version of this package
++
++with Interfaces.C; use Interfaces.C;
++
++package body System.OS_Interface is
++
++   -----------
++   -- Errno --
++   -----------
++
++   function Errno return int is
++      type int_ptr is access all int;
++
++      function internal_errno return int_ptr;
++      pragma Import (C, internal_errno, "__errno");
++
++   begin
++      return (internal_errno.all);
++   end Errno;
++
++   --------------------
++   -- Get_Stack_Base --
++   --------------------
++
++   function Get_Stack_Base (thread : pthread_t) return Address is
++      pragma Unreferenced (thread);
++   begin
++      return Null_Address;
++   end Get_Stack_Base;
++
++   ------------------
++   -- pthread_init --
++   ------------------
++
++   procedure pthread_init is
++   begin
++      null;
++   end pthread_init;
++
++   -----------------------------------
++   -- pthread_mutexattr_setprotocol --
++   -----------------------------------
++
++   function pthread_mutexattr_setprotocol
++     (attr     : access pthread_mutexattr_t;
++      protocol : int) return int is
++      pragma Unreferenced (attr, protocol);
++   begin
++      return 0;
++   end pthread_mutexattr_setprotocol;
++
++   --------------------------------------
++   -- pthread_mutexattr_setprioceiling --
++   --------------------------------------
++
++   function pthread_mutexattr_setprioceiling
++     (attr     : access pthread_mutexattr_t;
++      prioceiling : int) return int is
++      pragma Unreferenced (attr, prioceiling);
++   begin
++      return 0;
++   end pthread_mutexattr_setprioceiling;
++
++   -----------------
++   -- To_Duration --
++   -----------------
++
++   function To_Duration (TS : timespec) return Duration is
++   begin
++      return Duration (TS.ts_sec) + Duration (TS.ts_nsec) / 10#1#E9;
++   end To_Duration;
++
++   ------------------------
++   -- To_Target_Priority --
++   ------------------------
++
++   function To_Target_Priority
++     (Prio : System.Any_Priority) return Interfaces.C.int
++   is
++   begin
++      return Interfaces.C.int (Prio);
++   end To_Target_Priority;
++
++   -----------------
++   -- To_Timespec --
++   -----------------
++
++   function To_Timespec (D : Duration) return timespec is
++      S : time_t;
++      F : Duration;
++
++   begin
++      S := time_t (Long_Long_Integer (D));
++      F := D - Duration (S);
++
++      --  If F has negative value due to a round-up, adjust for positive F
++      --  value.
++
++      if F < 0.0 then
++         S := S - 1;
++         F := F + 1.0;
++      end if;
++
++      return timespec'(ts_sec => S,
++                       ts_nsec => long (Long_Long_Integer (F * 10#1#E9)));
++   end To_Timespec;
++
++end System.OS_Interface;
+--- gcc/ada/s-osinte-netbsd.ads.orig
++++ gcc/ada/s-osinte-netbsd.ads
+@@ -0,0 +1,634 @@
++------------------------------------------------------------------------------
++--                                                                          --
++--                  GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                --
++--                                                                          --
++--                   S Y S T E M . O S _ I N T E R F A C E                  --
++--                                                                          --
++--                                   S p e c                                --
++--                                                                          --
++--             Copyright (C) 1991-1994, Florida State University            --
++--          Copyright (C) 1995-2015, Free Software Foundation, Inc.         --
++--                                                                          --
++-- GNAT is free software;  you can  redistribute it  and/or modify it under --
++-- terms of the  GNU General Public License as published  by the Free Soft- --
++-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
++-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
++-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
++-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
++--                                                                          --
++-- As a special exception under Section 7 of GPL version 3, you are granted --
++-- additional permissions described in the GCC Runtime Library Exception,   --
++-- version 3.1, as published by the Free Software Foundation.               --
++--                                                                          --
++-- You should have received a copy of the GNU General Public License and    --
++-- a copy of the GCC Runtime Library Exception along with this program;     --
++-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
++-- <http://www.gnu.org/licenses/>.                                          --
++--                                                                          --
++-- GNARL was developed by the GNARL team at Florida State University. It is --
++-- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
++-- State University (http://www.gnat.com).                                  --
++--                                                                          --
++------------------------------------------------------------------------------
++
++--  This is the NetBSD PTHREADS version of this package.
++
++--  This package encapsulates all direct interfaces to OS services
++--  that are needed by the tasking run-time (libgnarl).
++
++--  PLEASE DO NOT add any with-clauses to this package or remove the pragma
++--  Preelaborate. This package is designed to be a bottom-level (leaf) package.
++
++with Ada.Unchecked_Conversion;
++
++with Interfaces.C;
++
++package System.OS_Interface is
++   pragma Preelaborate;
++
++   pragma Linker_Options ("-pthread");
++
++   subtype int            is Interfaces.C.int;
++   subtype short          is Interfaces.C.short;
++   subtype long           is Interfaces.C.long;
++   subtype unsigned       is Interfaces.C.unsigned;
++   subtype unsigned_short is Interfaces.C.unsigned_short;
++   subtype unsigned_long  is Interfaces.C.unsigned_long;
++   subtype unsigned_char  is Interfaces.C.unsigned_char;
++   subtype plain_char     is Interfaces.C.plain_char;
++   subtype size_t         is Interfaces.C.size_t;
++
++   -----------
++   -- Errno --
++   -----------
++
++   function Errno return int;
++   pragma Inline (Errno);
++
++   EAGAIN    : constant := 35;
++   EINTR     : constant := 4;
++   EINVAL    : constant := 22;
++   ENOMEM    : constant := 12;
++   ETIMEDOUT : constant := 60;
++
++   -------------
++   -- Signals --
++   -------------
++
++   Max_Interrupt : constant := 31;
++   type Signal is new int range 0 .. Max_Interrupt;
++   for Signal'Size use int'Size;
++
++   SIGHUP     : constant := 1; --  hangup
++   SIGINT     : constant := 2; --  interrupt (rubout)
++   SIGQUIT    : constant := 3; --  quit (ASCD FS)
++   SIGILL     : constant := 4; --  illegal instruction (not reset)
++   SIGTRAP    : constant := 5; --  trace trap (not reset)
++   SIGIOT     : constant := 6; --  IOT instruction
++   SIGABRT    : constant := 6; --  used by abort, replace SIGIOT in the  future
++   SIGEMT     : constant := 7; --  EMT instruction
++   SIGFPE     : constant := 8; --  floating point exception
++   SIGKILL    : constant := 9; --  kill (cannot be caught or ignored)
++   SIGBUS     : constant := 10; --  bus error
++   SIGSEGV    : constant := 11; --  segmentation violation
++   SIGSYS     : constant := 12; --  bad argument to system call
++   SIGPIPE    : constant := 13; --  write on a pipe with no one to read it
++   SIGALRM    : constant := 14; --  alarm clock
++   SIGTERM    : constant := 15; --  software termination signal from kill
++   SIGURG     : constant := 16; --  urgent condition on IO channel
++   SIGSTOP    : constant := 17; --  stop (cannot be caught or ignored)
++   SIGTSTP    : constant := 18; --  user stop requested from tty
++   SIGCONT    : constant := 19; --  stopped process has been continued
++   SIGCLD     : constant := 20; --  alias for SIGCHLD
++   SIGCHLD    : constant := 20; --  child status change
++   SIGTTIN    : constant := 21; --  background tty read attempted
++   SIGTTOU    : constant := 22; --  background tty write attempted
++   SIGIO      : constant := 23; --  I/O possible (Solaris SIGPOLL alias)
++   SIGXCPU    : constant := 24; --  CPU time limit exceeded
++   SIGXFSZ    : constant := 25; --  filesize limit exceeded
++   SIGVTALRM  : constant := 26; --  virtual timer expired
++   SIGPROF    : constant := 27; --  profiling timer expired
++   SIGWINCH   : constant := 28; --  window size change
++   SIGINFO    : constant := 29; --  information request (NetBSD/FreeBSD)
++   SIGUSR1    : constant := 30; --  user defined signal 1
++   SIGUSR2    : constant := 31; --  user defined signal 2
++
++   SIGADAABORT : constant := SIGABRT;
++   --  Change this if you want to use another signal for task abort.
++   --  SIGTERM might be a good one.
++
++   type Signal_Set is array (Natural range <>) of Signal;
++
++   --  Interrupts that must be unmasked at all times.  NetBSD
++   --  pthreads will not allow an application to mask out any
++   --  interrupt needed by the threads library.
++   Unmasked : constant Signal_Set :=
++     (SIGTRAP, SIGBUS, SIGTTIN, SIGTTOU, SIGTSTP);
++
++   --  NetBSD will uses SIGPROF for timing.  Do not allow a
++   --  handler to attach to this signal.
++   Reserved : constant Signal_Set := (0 .. 0 => SIGPROF);
++
++   type sigset_t is private;
++
++   function sigaddset
++     (set : access sigset_t;
++      sig : Signal) return int;
++   pragma Import (C, sigaddset, "__sigaddset14");
++
++   function sigdelset
++     (set : access sigset_t;
++      sig : Signal) return int;
++   pragma Import (C, sigdelset, "__sigdelset14");
++
++   function sigfillset (set : access sigset_t) return int;
++   pragma Import (C, sigfillset, "__sigfillset14");
++
++   function sigismember
++     (set : access sigset_t;
++      sig : Signal) return int;
++   pragma Import (C, sigismember, "__sigismember14");
++
++   function sigemptyset (set : access sigset_t) return int;
++   pragma Import (C, sigemptyset, "__sigemptyset14");
++
++   --  sigcontext is architecture dependent, so define it private
++   type struct_sigcontext is private;
++
++   type old_struct_sigaction is record
++      sa_handler : System.Address;
++      sa_mask    : sigset_t;
++      sa_flags   : int;
++   end record;
++   pragma Convention (C, old_struct_sigaction);
++
++   type new_struct_sigaction is record
++      sa_handler : System.Address;
++      sa_flags   : int;
++      sa_mask    : sigset_t;
++   end record;
++   pragma Convention (C, new_struct_sigaction);
++
++   subtype struct_sigaction is new_struct_sigaction;
++   type struct_sigaction_ptr is access all struct_sigaction;
++
++   SIG_BLOCK   : constant := 1;
++   SIG_UNBLOCK : constant := 2;
++   SIG_SETMASK : constant := 3;
++
++   SIG_DFL : constant := 0;
++   SIG_IGN : constant := 1;
++
++   SA_SIGINFO : constant := 16#0040#;
++   SA_ONSTACK : constant := 16#0001#;
++
++   function sigaction
++     (sig  : Signal;
++      act  : struct_sigaction_ptr;
++      oact : struct_sigaction_ptr) return int;
++   pragma Import (C, sigaction, "__sigaction14");
++
++   ----------
++   -- Time --
++   ----------
++
++   Time_Slice_Supported : constant Boolean := True;
++   --  Indicates whether time slicing is supported (i.e SCHED_RR is supported)
++
++   type timespec is private;
++
++   function nanosleep (rqtp, rmtp : access timespec) return int;
++   pragma Import (C, nanosleep, "nanosleep");
++
++   type clockid_t is new unsigned;
++
++   function clock_getres
++     (clock_id : clockid_t;
++      res      : access timespec) return int;
++   pragma Import (C, clock_getres, "clock_getres");
++
++   function clock_gettime
++     (clock_id : clockid_t;
++      tp       : access timespec)
++      return int;
++   pragma Import (C, clock_gettime, "clock_gettime");
++
++   function To_Duration (TS : timespec) return Duration;
++   pragma Inline (To_Duration);
++
++   function To_Timespec (D : Duration) return timespec;
++   pragma Inline (To_Timespec);
++
++   type struct_timezone is record
++      tz_minuteswest : int;
++      tz_dsttime     : int;
++   end record;
++   pragma Convention (C, struct_timezone);
++
++   procedure usleep (useconds : unsigned_long);
++   pragma Import (C, usleep, "usleep");
++
++   -------------------------
++   -- Priority Scheduling --
++   -------------------------
++
++   SCHED_FIFO  : constant := 1;
++   SCHED_OTHER : constant := 2;
++   SCHED_RR    : constant := 3;
++
++   function To_Target_Priority
++     (Prio : System.Any_Priority) return Interfaces.C.int;
++   --  Maps System.Any_Priority to a POSIX priority
++
++   -------------
++   -- Process --
++   -------------
++
++   type pid_t is private;
++
++   function kill (pid : pid_t; sig : Signal) return int;
++   pragma Import (C, kill, "kill");
++
++   function getpid return pid_t;
++   pragma Import (C, getpid, "getpid");
++
++   ---------
++   -- LWP --
++   ---------
++
++   function lwp_self return System.Address;
++   --  lwp_self does not exist on this thread library, revert to pthread_self
++   --  which is the closest approximation (with getpid). This function is
++   --  needed to share 7staprop.adb across POSIX-like targets.
++   pragma Import (C, lwp_self, "pthread_self");
++
++   -------------
++   -- Threads --
++   -------------
++
++   type Thread_Body is access
++     function (arg : System.Address) return System.Address;
++   pragma Convention (C, Thread_Body);
++
++   function Thread_Body_Access is new
++     Ada.Unchecked_Conversion (System.Address, Thread_Body);
++
++   type pthread_t           is private;
++   subtype Thread_Id        is pthread_t;
++
++   type pthread_mutex_t     is limited private;
++   type pthread_cond_t      is limited private;
++   type pthread_attr_t      is limited private;
++   type pthread_mutexattr_t is limited private;
++   type pthread_condattr_t  is limited private;
++   type pthread_key_t       is private;
++
++   PTHREAD_CREATE_DETACHED : constant := 1;
++   PTHREAD_CREATE_JOINABLE : constant := 0;
++
++   PTHREAD_SCOPE_PROCESS : constant := 0;
++   PTHREAD_SCOPE_SYSTEM  : constant := 2;
++
++   --  Read/Write lock not supported on NetBSD. To add support both types
++   --  pthread_rwlock_t and pthread_rwlockattr_t must properly be defined
++   --  with the associated routines pthread_rwlock_[init/destroy] and
++   --  pthread_rwlock_[rdlock/wrlock/unlock].
++
++   subtype pthread_rwlock_t     is pthread_mutex_t;
++   subtype pthread_rwlockattr_t is pthread_mutexattr_t;
++
++   -----------
++   -- Stack --
++   -----------
++
++   type stack_t is record
++      ss_sp    : System.Address;
++      ss_size  : size_t;
++      ss_flags : int;
++   end record;
++   pragma Convention (C, stack_t);
++
++   function sigaltstack
++     (ss  : not null access stack_t;
++      oss : access stack_t) return int;
++   pragma Import (C, sigaltstack, "__sigaltstack14");
++
++   Alternate_Stack : aliased System.Address;
++   --  This is a dummy definition, never used (Alternate_Stack_Size is null)
++
++   Alternate_Stack_Size : constant := 0;
++   --  No alternate signal stack is used on this platform
++
++   Stack_Base_Available : constant Boolean := False;
++   --  Indicates whether the stack base is available on this target. This
++   --  allows us to share s-osinte.adb between all the FSU run time. Note that
++   --  this value can only be true if pthread_t has a complete definition that
++   --  corresponds exactly to the C header files.
++
++   function Get_Stack_Base (thread : pthread_t) return Address;
++   pragma Inline (Get_Stack_Base);
++   --  returns the stack base of the specified thread. Only call this function
++   --  when Stack_Base_Available is True.
++
++   function Get_Page_Size return int;
++   pragma Import (C, Get_Page_Size, "getpagesize");
++   --  Returns the size of a page
++
++   PROT_NONE  : constant := 0;
++   PROT_READ  : constant := 1;
++   PROT_WRITE : constant := 2;
++   PROT_EXEC  : constant := 4;
++   PROT_ALL   : constant := PROT_READ + PROT_WRITE + PROT_EXEC;
++   PROT_ON    : constant := PROT_NONE;
++   PROT_OFF   : constant := PROT_ALL;
++
++   function mprotect (addr : Address; len : size_t; prot : int) return int;
++   pragma Import (C, mprotect);
++
++   ---------------------------------------
++   -- Nonstandard Thread Initialization --
++   ---------------------------------------
++
++   --  FSU_THREADS requires pthread_init, which is nonstandard and this should
++   --  be invoked during the elaboration of s-taprop.adb.
++
++   --  NetBSD does not require this so we provide an empty Ada body
++
++   procedure pthread_init;
++
++   -------------------------
++   -- POSIX.1c  Section 3 --
++   -------------------------
++
++   function sigwait
++     (set : access sigset_t;
++      sig : access Signal) return int;
++   pragma Import (C, sigwait, "sigwait");
++
++   function pthread_kill
++     (thread : pthread_t;
++      sig    : Signal) return int;
++   pragma Import (C, pthread_kill, "pthread_kill");
++
++   function pthread_sigmask
++     (how  : int;
++      set  : access sigset_t;
++      oset : access sigset_t) return int;
++   pragma Import (C, pthread_sigmask, "pthread_sigmask");
++
++   --------------------------
++   -- POSIX.1c  Section 11 --
++   --------------------------
++
++   function pthread_mutexattr_init
++     (attr : access pthread_mutexattr_t) return int;
++   pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init");
++
++   function pthread_mutexattr_destroy
++     (attr : access pthread_mutexattr_t) return int;
++   pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy");
++
++   function pthread_mutex_init
++     (mutex : access pthread_mutex_t;
++      attr  : access pthread_mutexattr_t) return int;
++   pragma Import (C, pthread_mutex_init, "pthread_mutex_init");
++
++   function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
++   pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy");
++
++   function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
++   pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock");
++
++   function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
++   pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock");
++
++   function pthread_condattr_init
++     (attr : access pthread_condattr_t) return int;
++   pragma Import (C, pthread_condattr_init, "pthread_condattr_init");
++
++   function pthread_condattr_destroy
++     (attr : access pthread_condattr_t) return int;
++   pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy");
++
++   function pthread_cond_init
++     (cond : access pthread_cond_t;
++      attr : access pthread_condattr_t) return int;
++   pragma Import (C, pthread_cond_init, "pthread_cond_init");
++
++   function pthread_cond_destroy (cond : access pthread_cond_t) return int;
++   pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy");
++
++   function pthread_cond_signal (cond : access pthread_cond_t) return int;
++   pragma Import (C, pthread_cond_signal, "pthread_cond_signal");
++
++   function pthread_cond_wait
++     (cond  : access pthread_cond_t;
++      mutex : access pthread_mutex_t) return int;
++   pragma Import (C, pthread_cond_wait, "pthread_cond_wait");
++
++   function pthread_cond_timedwait
++     (cond    : access pthread_cond_t;
++      mutex   : access pthread_mutex_t;
++      abstime : access timespec) return int;
++   pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait");
++
++   Relative_Timed_Wait : constant Boolean := False;
++   --  pthread_cond_timedwait requires an absolute delay time
++
++   --------------------------
++   -- POSIX.1c  Section 13 --
++   --------------------------
++
++   PTHREAD_PRIO_NONE    : constant := 0;
++   PTHREAD_PRIO_PROTECT : constant := 2;
++   PTHREAD_PRIO_INHERIT : constant := 1;
++
++   function pthread_mutexattr_setprotocol
++     (attr     : access pthread_mutexattr_t;
++      protocol : int) return int;
++
++   function pthread_mutexattr_setprioceiling
++     (attr     : access pthread_mutexattr_t;
++      prioceiling : int) return int;
++
++   type struct_sched_param is record
++      sched_priority : int;
++   end record;
++   pragma Convention (C, struct_sched_param);
++
++   function pthread_getschedparam
++     (thread : pthread_t;
++      policy : access int;
++      param  : access struct_sched_param) return int;
++   pragma Import (C, pthread_getschedparam, "pthread_getschedparam");
++
++   function pthread_setschedparam
++     (thread : pthread_t;
++      policy : int;
++      param  : access struct_sched_param) return int;
++   pragma Import (C, pthread_setschedparam, "pthread_setschedparam");
++
++   function pthread_attr_setscope
++     (attr            : access pthread_attr_t;
++      contentionscope : int) return int;
++   pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope");
++
++   function pthread_attr_getscope
++     (attr            : access pthread_attr_t;
++      contentionscope : access int) return int;
++   pragma Import (C, pthread_attr_getscope, "pthread_attr_getscope");
++
++   function pthread_attr_setinheritsched
++     (attr            : access pthread_attr_t;
++      inheritsched : int) return int;
++   pragma Import
++     (C, pthread_attr_setinheritsched, "pthread_attr_setinheritsched");
++
++   function pthread_attr_getinheritsched
++     (attr         : access pthread_attr_t;
++      inheritsched : access int) return int;
++   pragma Import
++     (C, pthread_attr_getinheritsched, "pthread_attr_getinheritsched");
++
++   function pthread_attr_setschedpolicy
++     (attr   : access pthread_attr_t;
++      policy : int) return int;
++   pragma Import (C, pthread_attr_setschedpolicy,
++     "pthread_attr_setschedpolicy");
++
++   function pthread_attr_getschedpolicy
++     (attr   : access pthread_attr_t;
++      policy : access int) return int;
++   pragma Import (C, pthread_attr_getschedpolicy,
++     "pthread_attr_getschedpolicy");
++
++   function pthread_attr_setschedparam
++     (attr        : access pthread_attr_t;
++      sched_param : int) return int;
++   pragma Import (C, pthread_attr_setschedparam, "pthread_attr_setschedparam");
++
++   function pthread_attr_getschedparam
++     (attr        : access pthread_attr_t;
++      sched_param : access int) return int;
++   pragma Import (C, pthread_attr_getschedparam, "pthread_attr_getschedparam");
++
++   function sched_yield return int;
++   pragma Import (C, sched_yield, "sched_yield");
++
++   --------------------------
++   -- P1003.1c  Section 16 --
++   --------------------------
++
++   function pthread_attr_init (attributes : access pthread_attr_t) return int;
++   pragma Import (C, pthread_attr_init, "pthread_attr_init");
++
++   function pthread_attr_destroy
++     (attributes : access pthread_attr_t) return int;
++   pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
++
++   function pthread_attr_setdetachstate
++     (attr        : access pthread_attr_t;
++      detachstate : int) return int;
++   pragma Import
++     (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate");
++
++   function pthread_attr_getdetachstate
++     (attr        : access pthread_attr_t;
++      detachstate : access int) return int;
++   pragma Import
++     (C, pthread_attr_getdetachstate, "pthread_attr_getdetachstate");
++
++   function pthread_attr_getstacksize
++     (attr      : access pthread_attr_t;
++      stacksize : access size_t) return int;
++   pragma Import
++     (C, pthread_attr_getstacksize, "pthread_attr_getstacksize");
++
++   function pthread_attr_setstacksize
++     (attr      : access pthread_attr_t;
++      stacksize : size_t) return int;
++   pragma Import
++     (C, pthread_attr_setstacksize, "pthread_attr_setstacksize");
++
++   function pthread_create
++     (thread        : access pthread_t;
++      attributes    : access pthread_attr_t;
++      start_routine : Thread_Body;
++      arg           : System.Address) return int;
++   pragma Import (C, pthread_create, "pthread_create");
++
++   function pthread_detach (thread : pthread_t) return int;
++   pragma Import (C, pthread_detach, "pthread_detach");
++
++   procedure pthread_exit (status : System.Address);
++   pragma Import (C, pthread_exit, "pthread_exit");
++
++   function pthread_self return pthread_t;
++   pragma Import (C, pthread_self, "pthread_self");
++
++   --------------------------
++   -- POSIX.1c  Section 17 --
++   --------------------------
++
++   function pthread_setspecific
++     (key   : pthread_key_t;
++      value : System.Address) return  int;
++   pragma Import (C, pthread_setspecific, "pthread_setspecific");
++
++   function pthread_getspecific (key : pthread_key_t) return System.Address;
++   pragma Import (C, pthread_getspecific, "pthread_getspecific");
++
++   type destructor_pointer is access procedure (arg : System.Address);
++   pragma Convention (C, destructor_pointer);
++
++   function pthread_key_create
++     (key        : access pthread_key_t;
++      destructor : destructor_pointer) return int;
++   pragma Import (C, pthread_key_create, "pthread_key_create");
++
++   ------------------------------------
++   -- Non-portable Pthread Functions --
++   ------------------------------------
++
++   function pthread_set_name_np
++     (thread : pthread_t;
++      name   : System.Address) return int;
++   pragma Import (C, pthread_set_name_np, "pthread_set_name_np");
++
++private
++
++   type sigset_t is array (1 .. 4) of unsigned;
++
++   --  In NetBSD the component sa_handler turns out to
++   --  be one a union type, and the selector is a macro:
++   --  #define sa_handler __sigaction_u._handler
++   --  #define sa_sigaction __sigaction_u._sigaction
++
++   --  Should we add a signal_context type here ???
++   --  How could it be done independent of the CPU architecture ???
++   --  sigcontext type is opaque, so it is architecturally neutral.
++   --  It is always passed as an access type, so define it as an empty record
++   --  since the contents are not used anywhere.
++
++   type struct_sigcontext is null record;
++   pragma Convention (C, struct_sigcontext);
++
++   type pid_t is new int;
++
++   type time_t is new Interfaces.Integer_64;
++
++   type timespec is record
++      ts_sec  : time_t;
++      ts_nsec : long;
++   end record;
++   pragma Convention (C, timespec);
++
++   type pthread_t           is new System.Address;
++   type pthread_attr_t      is new System.Address;
++   type pthread_mutex_t     is new System.Address;
++   type pthread_mutexattr_t is new System.Address;
++   type pthread_cond_t      is new System.Address;
++   type pthread_condattr_t  is new System.Address;
++   type pthread_key_t       is new int;
++
++end System.OS_Interface;
+--- gnattools/configure.orig
++++ gnattools/configure
+@@ -2054,6 +2054,11 @@
+     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
+     indepsw.adb<indepsw-gnu.adb"
+     ;;
++  *-*-netbsd*)
++    TOOLS_TARGET_PAIRS="\
++    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
++    indepsw.adb<indepsw-gnu.adb"
++    ;;
+   *-*-solaris*)
+     TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb"
+     ;;
+--- gnattools/configure.ac.orig
++++ gnattools/configure.ac
+@@ -94,6 +94,11 @@
+     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
+     indepsw.adb<indepsw-gnu.adb"
+     ;;
++  *-*-netbsd*)
++    TOOLS_TARGET_PAIRS="\
++    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
++    indepsw.adb<indepsw-gnu.adb"
++    ;;
+   *-*-solaris*)
+     TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb"
+     ;;
Index: pkgsrc/lang/gcc6-aux/files/diff-ada-testsuite
diff -u /dev/null pkgsrc/lang/gcc6-aux/files/diff-ada-testsuite:1.1
--- /dev/null   Tue Dec 13 01:19:20 2016
+++ pkgsrc/lang/gcc6-aux/files/diff-ada-testsuite       Tue Dec 13 01:19:20 2016
@@ -0,0 +1,705 @@
+--- gcc/testsuite/ada/acats/run_acats.orig
++++ gcc/testsuite/ada/acats/run_acats
+@@ -5,20 +5,6 @@
+    exit 1
+ fi
+ 
+-# Provide which replacement.
+-#
+-# type -p is missing from Solaris 2 /bin/sh and /bin/ksh (ksh88), but both
+-# ksh93 and bash have it.
+-# type output format differs between ksh88 and ksh93, so avoid it if
+-# type -p is present.  Unfortunately, HP-UX /bin/sh ignores -p with type.
+-# Fall back to whence which ksh88 and ksh93 provide, but bash does not.
+-
+-which () {
+-    path=`type -p $* 2>/dev/null` && { echo $path | awk '{print $NF}'; return 0; }
+-    path=`type $* 2>/dev/null` && { echo $path | awk '{print $NF}'; return 0; }
+-    path=`whence $* 2>/dev/null` && { echo $path; return 0; }
+-    return 1
+-}
+ 
+ # Set up environment to use the Ada compiler from the object tree
+ 
+--- gcc/testsuite/ada/acats/run_all.sh.orig
++++ gcc/testsuite/ada/acats/run_all.sh
+@@ -18,21 +18,6 @@
+ 
+ # End of customization section.
+ 
+-# Perform arithmetic evaluation on the ARGs, and store the result in the
+-# global $as_val. Take advantage of shells that can avoid forks. The arguments
+-# must be portable across $(()) and expr.
+-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+-  eval 'as_fn_arith ()
+-  {
+-    as_val=$(( $* ))
+-  }'
+-else
+-  as_fn_arith ()
+-  {
+-    as_val=`expr "$@" || test $? -eq 1`
+-  }
+-fi # as_fn_arith
+-
+ display_noeol () {
+   printf "$@"
+   printf "$@" >> $dir/acats.sum
+@@ -50,6 +35,14 @@
+   echo "$@" >> $dir/acats.log
+ }
+ 
++inform () {
++  printf "%04d    %7s" $1 $2
++}
++
++disinform () {
++  printf "\r"
++}
++
+ dir=`${PWDCMD-pwd}`
+ 
+ if [ "$testdir" = "" ]; then
+@@ -105,18 +98,6 @@
+ gnatls -v >> $dir/acats.log
+ display ""
+ 
+-if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ]; then
+-  dir_support=$dir/../acats/support
+-
+-  rm -rf $dir/run
+-  mv $dir/tests $dir/tests.$$ 2> /dev/null
+-  rm -rf $dir/tests.$$ &
+-  mkdir -p $dir/run
+-
+-  cp -pr $dir/../acats/tests $dir/
+-else
+-  dir_support=$dir/support
+-
+ display "             === acats support ==="
+ display_noeol "Generating support files..."
+ 
+@@ -213,9 +194,6 @@
+ 
+ display " done."
+ display ""
+-
+-fi
+-
+ display "             === acats tests ==="
+ 
+ if [ $# -eq 0 ]; then
+@@ -227,14 +205,20 @@
+ glob_countn=0
+ glob_countok=0
+ glob_countu=0
+-par_count=0
+-par_countm=0
+-par_last=
++countdown=0
+ 
+ for chapter in $chapters; do
+-   # Used to generate support once and finish after that.
+-   [ "$chapter" = "NONE" ] && continue
++   if [ -d $dir/tests/$chapter ]; then
++      cd $dir/tests/$chapter
++      ls *.a *.ada *.adt *.am *.dep 2> /dev/null | sed -e 's/\(.*\)\..*/\1/g' | \
++      cut -c1-7 | sort | uniq | comm -23 - $dir/support/norun.lst \
++        > $dir/tests/$chapter/${chapter}.lst
++      countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`
++      countdown=`expr $countdown + $countn`
++   fi
++done
+ 
++for chapter in $chapters; do
+    display Running chapter $chapter ...
+ 
+    if [ ! -d $dir/tests/$chapter ]; then
+@@ -243,45 +227,11 @@
+       continue
+    fi
+ 
+-   cd $dir/tests/$chapter
+-   ls *.a *.ada *.adt *.am *.dep 2> /dev/null | sed -e 's/\(.*\)\..*/\1/g' | \
+-   cut -c1-7 | sort | uniq | comm -23 - $dir_support/norun.lst \
+-     > $dir/tests/$chapter/${chapter}.lst 
+    countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`
+-   as_fn_arith $glob_countn + $countn
+-   glob_countn=$as_val
++   glob_countn=`expr $glob_countn + $countn`
++   counti=0
+    for i in `cat $dir/tests/$chapter/${chapter}.lst`; do 
+-
+-      # If running multiple run_all.sh jobs in parallel, decide
+-      # if we should run this test in the current instance.
+-      if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ]; then
+-       case "$i" in
+-          # Ugh, some tests have inter-test dependencies, those
+-          # tests have to be scheduled on the same parallel instance
+-          # as previous test.
+-          ce2108f | ce2108h | ce3112d) ;;
+-          # All others can be hopefully scheduled freely.
+-          *)
+-             as_fn_arith $par_countm + 1
+-             par_countm=$as_val
+-             [ $par_countm -eq 10 ] && par_countm=0
+-             if [ $par_countm -eq 1 ]; then
+-                as_fn_arith $par_count + 1
+-                par_count=$as_val
+-                if mkdir $GCC_RUNTEST_PARALLELIZE_DIR/$par_count 2>/dev/null; then
+-                   par_last=1
+-                else
+-                   par_last=
+-                fi
+-             fi;;
+-       esac
+-       if [ -z "$par_last" ]; then
+-          as_fn_arith $glob_countn - 1
+-          glob_countn=$as_val
+-          continue
+-       fi
+-      fi
+-
++      counti=`expr $counti + 1`
+       extraflags="-gnat95"
+       grep $i $testdir/overflow.lst > /dev/null 2>&1
+       if [ $? -eq 0 ]; then
+@@ -299,10 +249,13 @@
+       if [ $? -eq 0 ]; then
+          extraflags="$extraflags -fstack-check"
+       fi
++      inform $countdown $i
++      countdown=`expr $countdown - 1`
+       test=$dir/tests/$chapter/$i
+       mkdir $test && cd $test >> $dir/acats.log 2>&1
+ 
+       if [ $? -ne 0 ]; then
++         disinform
+          display "FAIL:       $i"
+          failed="${failed}${i} "
+          clean_dir
+@@ -320,19 +273,22 @@
+       echo "BUILD $main" >> $dir/acats.log
+       EXTERNAL_OBJECTS=""
+       case $i in
+-        cxb30*) EXTERNAL_OBJECTS="$dir_support/cxb30040.o $dir_support/cxb30060.o $dir_support/cxb30130.o $dir_support/cxb30131.o";;
++        cxb30*) EXTERNAL_OBJECTS="$dir/support/cxb30040.o $dir/support/cxb30060.o $dir/support/cxb30130.o $dir/support/cxb30131.o";;
+         ca1020e) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb > /dev/null 2>&1;;
+         ca14028) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads > /dev/null 2>&1;;
++        cxh1001) extraflags="-a -f"; echo "pragma Normalize_Scalars;" > gnat.adc
+       esac
+       if [ "$main" = "" ]; then
++         disinform
+          display "FAIL:       $i"
+          failed="${failed}${i} "
+          clean_dir
+          continue
+       fi
+ 
+-      target_gnatmake $extraflags -I$dir_support $main >> $dir/acats.log 2>&1
++      target_gnatmake $extraflags -I$dir/support $main >> $dir/acats.log 2>&1
+       if [ $? -ne 0 ]; then
++         disinform
+          display "FAIL:       $i"
+          failed="${failed}${i} "
+          clean_dir
+@@ -347,6 +303,7 @@
+       target_run $dir/tests/$chapter/$i/$binmain > $dir/tests/$chapter/$i/${i}.log 2>&1
+       cd $dir/tests/$chapter/$i
+       cat ${i}.log >> $dir/acats.log
++      disinform
+       egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log > /dev/null 2>&1
+       if [ $? -ne 0 ]; then
+          grep 'tasking not implemented' ${i}.log > /dev/null 2>&1
+@@ -356,15 +313,12 @@
+             failed="${failed}${i} "
+          else
+             log "UNSUPPORTED: $i"
+-            as_fn_arith $glob_countn - 1
+-            glob_countn=$as_val
+-            as_fn_arith $glob_countu + 1
+-            glob_countu=$as_val
++            glob_countn=`expr $glob_countn - 1`
++            glob_countu=`expr $glob_countu + 1`
+          fi
+       else
+          log "PASS:   $i"
+-         as_fn_arith $glob_countok + 1
+-         glob_countok=$as_val
++         glob_countok=`expr $glob_countok + 1`
+       fi
+       clean_dir
+    done
+--- /dev/null
++++ gcc/testsuite/ada/acats/run_remote.sh
+@@ -0,0 +1,412 @@
++#!/bin/sh
++# Run ACATS with the GNU Ada compiler
++
++# The following functions are to be customized if you run in cross
++# environment or want to change compilation flags.  Note that for
++# tests requiring checks not turned on by default, this script
++# automatically adds the needed flags to pass (ie: -gnato or -gnatE).
++
++# gccflags="-O3 -fomit-frame-pointer -funroll-all-loops -finline-functions"
++# gnatflags="-gnatN"
++
++gccflags="-O2"
++gnatflags="-gnatws"
++tabtarget="/data/local/testsuite"
++STRIP="@REMOTE_TARGET@-strip"
++
++target_run () {
++  # Run on rooted tablet (port 22 vs port 2222)
++  BN=`basename $*`
++  $STRIP_FOR_TARGET $*
++  /usr/bin/scp -qp $* root@tablet:$tabtarget/
++  /usr/bin/ssh -q tablet $tabtarget/$BN
++}
++
++target_cmd () {
++  /usr/bin/ssh -q tablet "$1"
++}
++
++# End of customization section.
++
++display_noeol () {
++  printf "$@"
++  printf "$@" >> $dir/acats.sum
++  printf "$@" >> $dir/acats.log
++}
++
++display () {
++  echo "$@"
++  echo "$@" >> $dir/acats.sum
++  echo "$@" >> $dir/acats.log
++}
++
++log () {
++  echo "$@" >> $dir/acats.sum
++  echo "$@" >> $dir/acats.log
++}
++
++inform () {
++  printf "%04d    %7s" $1 $2
++}
++
++disinform () {
++  printf "\r"
++}
++
++dir=`${PWDCMD-pwd}`
++
++if [ "$testdir" = "" ]; then
++   echo You must use make check or make check-ada
++   exit 1
++fi
++
++if [ "$dir" = "$testdir" ]; then
++  echo "error: srcdir must be different than objdir, exiting."
++  exit 1
++fi
++
++target_gnatmake () {
++  echo gnatmake-cross --GCC=\"$GCC\" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC=\"$GCC\" -fPIE -pie
++  gnatmake-cross --GCC="$GCC" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC="$GCC" -fPIE -pie
++}
++
++target_gcc () {
++  $GCC $gccflags $*
++}
++
++clean_dir () {
++  rm -f "$binmain" *.o *.ali > /dev/null 2>&1
++}
++
++find_main () {
++  ls ${i}?.adb > ${i}.lst 2> /dev/null
++  ls ${i}*m.adb >> ${i}.lst 2> /dev/null
++  ls ${i}.adb >> ${i}.lst 2> /dev/null
++  main=`tail -1 ${i}.lst`
++}
++
++split_testid () {
++  local mysplit=`echo $1 | awk -F/ '{print "section=" $1 "; TN=" $2 "; prog=" $3 ";"}'`
++  eval ${mysplit}
++}
++
++EXTERNAL_OBJECTS=""
++# Global variable to communicate external objects to link with.
++
++rm -f $dir/acats.sum $dir/acats.log $dir/transfer.lst
++
++display "Test Run By $USER on `date`"
++
++display "             === acats configuration ==="
++
++target=`$GCC -dumpmachine`
++
++display target gcc is $GCC
++display `$GCC -v 2>&1`
++display host=`gcc -dumpmachine`
++display target=$target
++display `type gnatmake-cross`
++gnatls-cross -v >> $dir/acats.log
++display ""
++
++# Let's be tidy and clear off the remote device first
++target_cmd "cd ${tabtarget}; rm logs/*; rmdir logs; rm *"
++
++display "             === acats support ==="
++display_noeol "Generating support files..."
++
++rm -rf $dir/support
++mkdir -p $dir/support
++cd $dir/support
++
++cp $testdir/support/*.ada $testdir/support/*.a $testdir/support/*.tst $dir/support
++
++# Find out the size in bit of an address on the target
++target_gnatmake $testdir/support/impbit.adb >> $dir/acats.log 2>&1
++target_run $dir/support/impbit > $dir/support/impbit.out 2>&1
++target_bit=`cat $dir/support/impbit.out`
++echo target_bit="$target_bit" >> $dir/acats.log
++
++# Find out a suitable asm statement
++# Adapted from configure.ac gcc_cv_as_dwarf2_debug_line
++case "$target" in
++  ia64*-*-* | s390*-*-*)
++    target_insn="nop 0"
++    ;;
++  mmix-*-*)
++    target_insn="swym 0"
++    ;;
++  *)
++    target_insn="nop"
++    ;;
++esac
++echo target_insn="$target_insn" >> $dir/acats.log
++
++sed -e "s,ACATS4GNATDIR,$dir,g" \
++  < $testdir/support/impdef.a > $dir/support/impdef.a
++sed -e "s,ACATS4GNATDIR,$dir,g" \
++  -e "s,ACATS4GNATBIT,$target_bit,g" \
++  -e "s,ACATS4GNATINSN,$target_insn,g" \
++  < $testdir/support/macro.dfs > $dir/support/MACRO.DFS
++sed -e "s,ACATS4GNATDIR,$dir,g" \
++  < $testdir/support/tsttests.dat > $dir/support/TSTTESTS.DAT
++
++cp $testdir/tests/cd/*.c $dir/support
++cp $testdir/tests/cxb/*.c $dir/support
++grep -v '^#' $testdir/norun.lst | sort > $dir/support/norun.lst
++
++rm -rf $dir/run
++mv $dir/tests $dir/tests.$$ 2> /dev/null
++rm -rf $dir/tests.$$ &
++mkdir -p $dir/run
++
++cp -pr $testdir/tests $dir/
++
++for i in $dir/support/*.ada $dir/support/*.a; do
++   host_gnatchop $i >> $dir/acats.log 2>&1
++done
++
++# These tools are used to preprocess some ACATS sources
++# they need to be compiled native on the host.
++
++host_gnatmake -q -gnatws macrosub.adb
++if [ $? -ne 0 ]; then
++   display "**** Failed to compile macrosub"
++   exit 1
++fi
++./macrosub > macrosub.out 2>&1
++
++gcc -c cd300051.c
++host_gnatmake -q -gnatws widechr.adb
++if [ $? -ne 0 ]; then
++   display "**** Failed to compile widechr"
++   exit 1
++fi
++./widechr > widechr.out 2>&1
++
++rm -f $dir/support/macrosub
++rm -f $dir/support/widechr
++rm -f $dir/support/*.ali
++rm -f $dir/support/*.o
++
++display " done."
++
++# From here, all compilations will be made by the target compiler
++
++display_noeol "Compiling support files..."
++
++target_gcc -c *.c
++if [ $? -ne 0 ]; then
++   display "**** Failed to compile C code"
++   exit 1
++fi
++
++host_gnatchop *.adt >> $dir/acats.log 2>&1
++
++target_gnatmake -c -gnato -gnatE *.ads >> $dir/acats.log 2>&1
++target_gnatmake -c -gnato -gnatE *.adb >> $dir/acats.log 2>&1
++
++display " done."
++display ""
++display "             === acats tests ==="
++
++if [ $# -eq 0 ]; then
++   chapters=`cd $dir/tests; echo [a-z]*`
++else
++   chapters=$*
++fi
++
++glob_countn=0
++glob_countok=0
++glob_countu=0
++countdown=0
++
++for chapter in $chapters; do
++   if [ -d $dir/tests/$chapter ]; then
++      cd $dir/tests/$chapter
++      ls *.a *.ada *.adt *.am *.dep 2> /dev/null | sed -e 's/\(.*\)\..*/\1/g' | \
++      cut -c1-7 | sort | uniq | comm -23 - $dir/support/norun.lst \
++        > $dir/tests/$chapter/${chapter}.lst
++      countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`
++      countdown=`expr $countdown + $countn`
++   fi
++done
++
++cat > $dir/execute.sh << EOF
++inform () {
++  printf "left: %04d" \$1
++}
++disinform () {
++  printf "\r"
++}
++cycle () {
++  local countx=0
++  local total=\$(echo \$testlist | awk '{print NF}')
++  mkdir -p logs
++  echo "Executing \$total tests on remote device"
++  inform \$total
++  for x in \$testlist; do
++    timeout -t 30 ./\${x} > logs/\${x}.log 2>&1
++    countx=\$(expr \$countx + 1)
++    if [ \$countx -eq 25 ]; then
++      total=\$(expr \$total - 25)
++      countx=0
++      disinform
++      inform \$total
++    fi
++  done
++  disinform
++  tar -czf remote.logs.tar.gz logs
++}
++testlist=" \\
++EOF
++
++display "All tests are being cross-compiled without execution first."
++
++for chapter in $chapters; do
++   if [ ! -d $dir/tests/$chapter ]; then
++      continue
++   fi
++
++   countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`
++   glob_countn=`expr $glob_countn + $countn`
++   counti=0
++   for i in `cat $dir/tests/$chapter/${chapter}.lst`; do
++      counti=`expr $counti + 1`
++      extraflags="-gnat95"
++      grep $i $testdir/overflow.lst > /dev/null 2>&1
++      if [ $? -eq 0 ]; then
++         extraflags="$extraflags -gnato"
++      fi
++      grep $i $testdir/elabd.lst > /dev/null 2>&1
++      if [ $? -eq 0 ]; then
++         extraflags="$extraflags -gnatE"
++      fi
++      grep $i $testdir/floatstore.lst > /dev/null 2>&1
++      if [ $? -eq 0 ]; then
++         extraflags="$extraflags -ffloat-store"
++      fi
++      grep $i $testdir/stackcheck.lst > /dev/null 2>&1
++      if [ $? -eq 0 ]; then
++         extraflags="$extraflags -fstack-check"
++      fi
++      inform $countdown $i
++      countdown=`expr $countdown - 1`
++      test=$dir/tests/$chapter/$i
++      mkdir $test && cd $test >> $dir/acats.log 2>&1
++
++      if [ $? -ne 0 ]; then
++         disinform
++         display "FAIL:       $i"
++         failed="${failed}${i} "
++         clean_dir
++         continue
++      fi
++
++      host_gnatchop -c -w `ls ${test}*.a ${test}*.ada ${test}*.adt ${test}*.am ${test}*.dep 2> /dev/null` >> $dir/acats.log 2>&1
++      find_main
++      if [ -z "$main" ]; then
++         sync
++         find_main
++      fi
++      binmain=`echo $main | sed -e 's/\(.*\)\..*/\1/g'`
++      echo "BUILD $main" >> $dir/acats.log
++      EXTERNAL_OBJECTS=""
++      case $i in
++        cxb30*) EXTERNAL_OBJECTS="$dir/support/cxb30040.o $dir/support/cxb30060.o $dir/support/cxb30130.o $dir/support/cxb30131.o";;
++        ca1020e) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb > /dev/null 2>&1;;
++        ca14028) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads > /dev/null 2>&1;;
++        cxh1001) extraflags="-a -f"; echo "pragma Normalize_Scalars;" > gnat.adc
++      esac
++      if [ "$main" = "" ]; then
++         disinform
++         display "FAIL:       $i"
++         failed="${failed}${i} "
++         clean_dir
++         continue
++      fi
++
++      target_gnatmake $extraflags -I$dir/support $main >> $dir/acats.log 2>&1
++      if [ $? -ne 0 ]; then
++         disinform
++         display "FAIL:       $i"
++         failed="${failed}${i} "
++         clean_dir
++         continue
++      fi
++      echo $chapter/$i/$binmain >> $dir/transfer.lst
++      echo "$binmain \\" >> $dir/execute.sh
++      $STRIP $binmain
++      disinform
++   done
++done
++echo '"' >> $dir/execute.sh
++echo "cycle" >> $dir/execute.sh
++
++sync
++display "Transfer files to remote device: root@tablet:$tabtarget/"
++cd $dir/tests
++cat $dir/transfer.lst | xargs tar --strip-components=2 -czf - |  \
++  target_cmd "tar -C $tabtarget -xzf -"
++cd $dir
++tar -czf - execute.sh | target_cmd "tar -C $tabtarget -xzf -"
++target_cmd "cd $tabtarget; sh execute.sh"
++rm -rf $dir/logs $dir/remote.logs.tar.gz
++/usr/bin/scp -q root@tablet:$tabtarget/remote.logs.tar.gz $dir/
++tar -xzf $dir/remote.logs.tar.gz
++
++countdown=`wc -l < $dir/transfer.lst`
++glob_countn=${countdown}
++for i in `cat $dir/transfer.lst`; do
++  split_testid $i
++  if [ "$section" != "$savedsect" ]; then
++   display Running chapter $section ...
++  fi
++  savedsect=$section
++
++  #inform $countdown $TN
++  countdown=`expr $countdown - 1`
++  proglog="$dir/logs/${prog}.log"
++  echo "RUN $prog" >> $dir/acats.log
++  if [ ! -f $proglog ]; then
++    echo "LOG NOT FOUND!" >> $proglog
++  fi
++
++  cat $proglog >> $dir/acats.log
++
++  egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' $proglog > /dev/null 2>&1
++  if [ $? -ne 0 ]; then
++     grep 'tasking not implemented' $proglog > /dev/null 2>&1
++
++     if [ $? -ne 0 ]; then
++        display "FAIL:        ${TN}"
++        failed="${failed}${TN} "
++     else
++        log "UNSUPPORTED:     ${TN}"
++        glob_countn=`expr $glob_countn - 1`
++        glob_countu=`expr $glob_countu + 1`
++     fi
++  else
++     log "PASS:       ${TN}"
++     glob_countok=`expr $glob_countok + 1`
++  fi
++  cd $dir/tests/$section/$TN
++  clean_dir
++  #disinform
++done
++
++display "             === acats Summary ==="
++display "# of expected passes         $glob_countok"
++display "# of unexpected failures     `expr $glob_countn - $glob_countok`"
++
++if [ $glob_countu -ne 0 ]; then
++   display "# of unsupported tests            $glob_countu"
++fi
++
++if [ $glob_countok -ne $glob_countn ]; then
++   display "*** FAILURES: $failed"
++fi
++
++display "$0 completed at `date`"
++
++exit 0
+--- gcc/testsuite/gnat.dg/test_raise_from_pure.adb.orig
++++ gcc/testsuite/gnat.dg/test_raise_from_pure.adb
+@@ -1,4 +1,4 @@
+--- { dg-do run }
++-- { dg-do run { xfail *-*-openbsd* } }
+ -- { dg-options "-O2" }
+ 
+ -- This is an optimization test and its failure is only a missed optimization.
+--- gcc/testsuite/gnat.dg/unchecked_convert5.adb.orig
++++ gcc/testsuite/gnat.dg/unchecked_convert5.adb
+@@ -1,22 +0,0 @@
+--- { dg-do run { target hppa*-*-* sparc*-*-* powerpc*-*-* } }
+-
+-with Unchecked_Conversion;
+-
+-procedure Unchecked_Convert5 is
+-
+-  subtype c_1 is string(1..1);
+-
+-  function int2c1 is  -- { dg-warning "different sizes" }
+-    new unchecked_conversion (source => integer, target => c_1);
+-
+-  c1 : c_1;
+-
+-begin
+-
+-  c1 := int2c1(16#12#);
+-
+-  if c1 (1) /= ASCII.Nul then
+-    raise Program_Error;
+-  end if;
+-
+-end;
+--- gcc/testsuite/gnat.dg/unchecked_convert6.adb.orig
++++ gcc/testsuite/gnat.dg/unchecked_convert6.adb
+@@ -1,22 +0,0 @@
+--- { dg-do run { target hppa*-*-* sparc*-*-* powerpc*-*-* } }
+-
+-with Unchecked_Conversion;
+-
+-procedure Unchecked_Convert6 is
+-
+-  subtype c_5 is string(1..5);
+-
+-  function int2c5 is  -- { dg-warning "different sizes" }
+-    new unchecked_conversion (source => integer, target => c_5);
+-
+-  c5 : c_5;
+-
+-begin
+-
+-  c5 := int2c5(16#12#);
+-
+-  if c5 (4) /= ASCII.DC2 then
+-    raise Program_Error;
+-  end if;
+-
+-end;
Index: pkgsrc/lang/gcc6-aux/files/diff-core
diff -u /dev/null pkgsrc/lang/gcc6-aux/files/diff-core:1.1
--- /dev/null   Tue Dec 13 01:19:20 2016
+++ pkgsrc/lang/gcc6-aux/files/diff-core        Tue Dec 13 01:19:20 2016
@@ -0,0 +1,212 @@
+--- gcc/config/dragonfly.h.orig
++++ gcc/config/dragonfly.h
+@@ -84,7 +84,7 @@
+    } \
+    %{static:-Bstatic} \
+   } \
+-  %{!static:--hash-style=gnu} \
++  %{!static:--hash-style=gnu -rpath @PREFIX@/@GCCAUX@/lib} \
+   %{symbolic:-Bsymbolic}"
+ 
+ #undef  LINK_SPEC
+--- gcc/config/i386/freebsd.h.orig
++++ gcc/config/i386/freebsd.h
+@@ -77,6 +77,12 @@
+    When the -shared link option is used a final link is not being
+    done.  */
+ 
++#if FBSD_MAJOR < 10
++#define ELF_HASH_STYLE "--hash-style=both "
++#else
++#define ELF_HASH_STYLE "--hash-style=gnu "
++#endif
++
+ #undef        LINK_SPEC
+ #define LINK_SPEC "\
+   %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
+@@ -88,6 +94,7 @@
+         %{rdynamic:-export-dynamic} \
+         -dynamic-linker %(fbsd_dynamic_linker) } \
+     %{static:-Bstatic}} \
++  %{!static:" ELF_HASH_STYLE "-rpath @PREFIX@/@GCCAUX@/lib} \
+   %{symbolic:-Bsymbolic}"
+ 
+ /* A C statement to output to the stdio stream FILE an assembler
+--- gcc/config/i386/freebsd64.h.orig
++++ gcc/config/i386/freebsd64.h
+@@ -41,4 +41,5 @@
+         %{rdynamic:-export-dynamic} \
+       -dynamic-linker %(fbsd_dynamic_linker) } \
+     %{static:-Bstatic}} \
++  %{!static:" ELF_HASH_STYLE "-rpath @PREFIX@/@GCCAUX@/lib} \
+   %{symbolic:-Bsymbolic}"
+--- gcc/config/netbsd-elf.h.orig
++++ gcc/config/netbsd-elf.h
+@@ -71,6 +71,7 @@
+   "%{assert*} %{R*} %{rpath*} \
+    %{shared:-shared} \
+    %{symbolic:-Bsymbolic} \
++   %{!static:-rpath @PREFIX@/@GCCAUX@/lib} \
+    %{!shared: \
+      -dc -dp \
+      %{!nostdlib: \
+@@ -85,3 +86,10 @@
+ #ifdef HAVE_LD_AS_NEEDED
+ #define USE_LD_AS_NEEDED 1
+ #endif
++
++/* Define this to be nonzero if static stack checking is supported. */
++#define STACK_CHECK_STATIC_BUILTIN 1
++
++#if defined(HAVE_LD_EH_FRAME_HDR)
++#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
++#endif
+--- gcc/config.gcc.orig
++++ gcc/config.gcc
+@@ -1445,12 +1445,16 @@
+       tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h"
+       ;;
+ i[34567]86-*-netbsdelf*)
+-      tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h"
++      tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h freebsd-stdint.h"
+       extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++      tmake_file="${tmake_file} i386/t-crtstuff"
++      use_gcc_stdint=wrap
+       ;;
+ x86_64-*-netbsd*)
+-      tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h"
++      tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h freebsd-stdint.h"
+       extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++      tmake_file="${tmake_file} i386/t-crtstuff"
++      use_gcc_stdint=wrap
+       ;;
+ i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
+       tm_file="i386/i386.h i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h openbsd-oldgas.h openbsd.h i386/openbsd.h"
+--- gcc/configure.orig
++++ gcc/configure
+@@ -28658,6 +28658,13 @@
+   *-linux-musl*)
+     gcc_cv_target_dl_iterate_phdr=yes
+     ;;
++  *-*-netbsd*)
++    if grep dl_iterate_phdr $target_header_dir/link_elf.h > /dev/null 2>&1; then
++      gcc_cv_target_dl_iterate_phdr=yes
++    else
++      gcc_cv_target_dl_iterate_phdr=no
++    fi
++    ;;
+ esac
+ 
+ if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
+--- libgcc/crtstuff.c.orig
++++ libgcc/crtstuff.c
+@@ -81,7 +81,7 @@
+ #endif
+ 
+ #if defined(TARGET_DL_ITERATE_PHDR) && \
+-   (defined(__DragonFly__) || defined(__FreeBSD__))
++   (defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__))
+ #define BSD_DL_ITERATE_PHDR_AVAILABLE
+ #endif
+  
+--- libgcc/unwind-dw2-fde-dip.c.orig
++++ libgcc/unwind-dw2-fde-dip.c
+@@ -71,6 +71,12 @@
+ #endif
+ 
+ #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
++    && defined(TARGET_DL_ITERATE_PHDR) && defined(__NetBSD__)
++# define ElfW(type) Elf_##type
++# define USE_PT_GNU_EH_FRAME
++#endif
++
++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+     && defined(__OpenBSD__)
+ # define ElfW(type) Elf_##type
+ # define USE_PT_GNU_EH_FRAME
+--- libgcc/config.host.orig
++++ libgcc/config.host
+@@ -242,7 +242,8 @@
+   extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+   ;;
+ *-*-netbsd*)
+-  tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
++  tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip"
++  tmake_file="$tmake_file t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
+   # NetBSD 1.7 and later are set up to use GCC's crtstuff for
+   # ELF configurations.  We will clear extra_parts in the
+   # a.out configurations.
+@@ -597,9 +598,12 @@
+       md_unwind_header=i386/freebsd-unwind.h
+       ;;
+ i[34567]86-*-netbsdelf*)
++      tmake_file="${tmake_file} i386/t-crtstuff"
++      #md_unwind_header=i386/netbsd-unwind.h
+       ;;
+ x86_64-*-netbsd*)
+       tmake_file="${tmake_file} i386/t-crtstuff"
++      #md_unwind_header=i386/netbsd-unwind.h
+       ;;
+ i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
+       ;;
+--- gcc/Makefile.in.orig
++++ gcc/Makefile.in
+@@ -1185,7 +1185,6 @@
+       insn-emit.o \
+       insn-extract.o \
+       insn-latencytab.o \
+-      insn-modes.o \
+       insn-opinit.o \
+       insn-output.o \
+       insn-peep.o \
+@@ -1557,6 +1556,7 @@
+   $(OBJS-libcommon-target) main.o c-family/cppspec.o \
+   $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) $(GCOV_OBJS) $(GCOV_DUMP_OBJS) \
+   $(GCOV_TOOL_OBJS) $(GENGTYPE_OBJS) gcc-ar.o gcc-nm.o gcc-ranlib.o \
++  insn-modes.o insn-modes-ada.o \
+   lto-wrapper.o collect-utils.o
+ 
+ # This lists all host object files, whether they are included in this
+@@ -1564,6 +1564,11 @@
+ ALL_HOST_OBJS = $(ALL_HOST_FRONTEND_OBJS) $(ALL_HOST_BACKEND_OBJS)
+ 
+ BACKEND = libbackend.a main.o libcommon-target.a libcommon.a \
++      insn-modes.o \
++      $(CPPLIB) $(LIBDECNUMBER)
++
++BACKEND2 = libbackend.a main.o libcommon-target.a libcommon.a \
++      insn-modes-ada.o \
+       $(CPPLIB) $(LIBDECNUMBER)
+ 
+ # This is defined to "yes" if Tree checking is enabled, which roughly means
+@@ -2218,6 +2223,7 @@
+ 
+ insn-modes.c: s-modes; @true
+ insn-modes.h: s-modes-h; @true
++insn-modes-ada.c: s-modes-ada; @true
+ min-insn-modes.c: s-modes-m; @true
+ 
+ s-modes: build/genmodes$(build_exeext)
+@@ -2235,6 +2241,12 @@
+       $(SHELL) $(srcdir)/../move-if-change tmp-min-modes.c min-insn-modes.c
+       $(STAMP) s-modes-m
+ 
++s-modes-ada: s-modes
++      $(shell sed -e 's/: TARGET_96_ROUND_53_LONG_DOUBLE \? &ieee_extended_intel_96_round_53_format //'  \
++              < insn-modes.c > tmp-modes-ada.c)
++      $(SHELL) $(srcdir)/../move-if-change tmp-modes-ada.c insn-modes-ada.c
++      $(STAMP) s-modes-ada
++
+ insn-preds.c: s-preds; @true
+ tm-preds.h: s-preds-h; @true
+ tm-constrs.h: s-constrs-h; @true
+@@ -3420,6 +3432,9 @@
+           ( cd $(DESTDIR)$(bindir) && \
+             $(LN) $(GCC_INSTALL_NAME)$(exeext) $(FULL_DRIVER_NAME) ); \
+         fi; \
++        if [ -f gnat1$(exeext) ] ; then \
++          ( cd $(DESTDIR)$(bindir) && $(LN) $(GCC_INSTALL_NAME)$(exeext) ada$(exeext) ) \
++        fi; \
+         if [ ! -f gcc-cross$(exeext) ] \
+             && [ "$(GCC_INSTALL_NAME)" != "$(GCC_TARGET_INSTALL_NAME)" ]; then \
+           rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \
Index: pkgsrc/lang/gcc6-aux/files/diff-cxx
diff -u /dev/null pkgsrc/lang/gcc6-aux/files/diff-cxx:1.1
--- /dev/null   Tue Dec 13 01:19:20 2016
+++ pkgsrc/lang/gcc6-aux/files/diff-cxx Tue Dec 13 01:19:20 2016
@@ -0,0 +1,173 @@
+--- libstdc++-v3/config/os/bsd/netbsd/ctype_base.h.orig
++++ libstdc++-v3/config/os/bsd/netbsd/ctype_base.h
+@@ -43,9 +43,22 @@
+ 
+     // 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
++#if defined(_CTYPE_BL)
++    typedef unsigned short      mask;
++    static const mask upper     = _CTYPE_U;
++    static const mask lower     = _CTYPE_L;
++    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_R;
++    static const mask graph     = _CTYPE_G;
++    static const mask cntrl     = _CTYPE_C;
++    static const mask punct     = _CTYPE_P;
++    static const mask alnum     = _CTYPE_A | _CTYPE_D;
++#elif !defined(_CTYPE_U)
++    typedef unsigned char             mask;
+     static const mask upper           = _U;
+     static const mask lower   = _L;
+     static const mask alpha   = _U | _L;
+@@ -58,6 +71,7 @@
+     static const mask punct   = _P;
+     static const mask alnum   = _U | _L | _N;
+ #else
++    typedef unsigned char             mask;
+     static const mask upper           = _CTYPE_U;
+     static const mask lower   = _CTYPE_L;
+     static const mask alpha   = _CTYPE_U | _CTYPE_L;
+--- libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc.orig
++++ libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc
+@@ -38,11 +38,17 @@
+ 
+ // Information as gleaned from /usr/include/ctype.h
+ 
++#ifndef _CTYPE_BL
+   extern "C" const u_int8_t _C_ctype_[];
++#endif
+ 
+   const ctype_base::mask*
+   ctype<char>::classic_table() throw()
++#ifdef _CTYPE_BL
++  { return _C_ctype_tab_ + 1; }
++#else
+   { return _C_ctype_ + 1; }
++#endif
+ 
+   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
+                    size_t __refs) 
+@@ -69,14 +75,14 @@
+ 
+   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 +90,14 @@
+ 
+   char
+   ctype<char>::do_tolower(char __c) const
+-  { return ::tolower((int) __c); }
++  { return ::tolower((int)(unsigned char) __c); }
+ 
+   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;
+--- libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h.orig
++++ libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h
+@@ -48,7 +48,7 @@
+   is(const char* __low, const char* __high, mask* __vec) const
+   {
+     while (__low < __high)
+-      *__vec++ = _M_table[*__low++];
++      *__vec++ = _M_table[(unsigned char)*__low++];
+     return __high;
+   }
+ 
+--- libstdc++-v3/libsupc++/unwind-cxx.h.orig
++++ libstdc++-v3/libsupc++/unwind-cxx.h
+@@ -38,6 +38,7 @@
+ #include <cxxabi.h>
+ 
+ #ifdef _GLIBCXX_HAVE_SYS_SDT_H
++#include <cstdlib>
+ #include <sys/sdt.h>
+ /* We only want to use stap probes starting with v3.  Earlier versions
+    added too much startup cost.  */
+--- libstdc++-v3/configure.host.orig
++++ libstdc++-v3/configure.host
+@@ -262,6 +262,9 @@
+   freebsd*)
+     os_include_dir="os/bsd/freebsd"
+     ;;
++  linux-android*)
++    os_include_dir="os/bionic"
++    ;;
+   linux-musl*)
+     os_include_dir="os/generic"
+     ;;
+--- libstdc++-v3/config/os/bionic/ctype_base.h.orig
++++ libstdc++-v3/config/os/bionic/ctype_base.h
+@@ -38,6 +38,18 @@
+     // Non-standard typedefs.
+     typedef const int*                __to_type;
+ 
++#ifdef _CTYPE_U
++#define _U _CTYPE_U
++#define _L _CTYPE_L
++#define _D _CTYPE_D
++#define _S _CTYPE_S
++#define _P _CTYPE_P
++#define _C _CTYPE_C
++#define _X _CTYPE_X
++#define _B _CTYPE_B
++#define _N _CTYPE_D
++#endif
++
+     // 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 char              mask;
+--- libstdc++-v3/src/c++11/futex.cc.orig
++++ libstdc++-v3/src/c++11/futex.cc
+@@ -27,7 +27,11 @@
+ #if defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1
+ #include <chrono>
+ #include <climits>
++#ifdef __ANDROID__
++#include <sys/syscall.h>
++#else
+ #include <syscall.h>
++#endif
+ #include <unistd.h>
+ #include <sys/time.h>
+ #include <errno.h>
+--- libstdc++-v3/src/filesystem/dir.cc.orig
++++ libstdc++-v3/src/filesystem/dir.cc
+@@ -147,7 +147,13 @@
+ 
+   int err = std::exchange(errno, 0);
+   const auto entp = readdir(dirp);
++#ifdef __ANDROID__
++  int tmperr = errno;
++  errno = err;
++  err = tmperr;
++#else
+   std::swap(errno, err);
++#endif
+ 
+   if (entp)
+     {
Index: pkgsrc/lang/gcc6-aux/files/diff-fortran
diff -u /dev/null pkgsrc/lang/gcc6-aux/files/diff-fortran:1.1
--- /dev/null   Tue Dec 13 01:19:20 2016
+++ pkgsrc/lang/gcc6-aux/files/diff-fortran     Tue Dec 13 01:19:20 2016
@@ -0,0 +1,42 @@
+--- libgfortran/acinclude.m4.orig
++++ libgfortran/acinclude.m4
+@@ -85,7 +85,7 @@
+             [Define to 1 if the target supports #pragma weak])
+   fi
+   case "$host" in
+-    *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* )
++    *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* | *-*-netbsd* )
+       AC_DEFINE(GTHREAD_USE_WEAK, 0,
+               [Define to 0 if the target shouldn't use #pragma weak])
+       ;;
+--- libgfortran/configure.orig
++++ libgfortran/configure
+@@ -25992,7 +25992,7 @@
+ 
+   fi
+   case "$host" in
+-    *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* )
++    *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* | *-*-netbsd* )
+ 
+ $as_echo "#define GTHREAD_USE_WEAK 0" >>confdefs.h
+ 
+--- gcc/fortran/f95-lang.c.orig
++++ gcc/fortran/f95-lang.c
+@@ -748,10 +748,17 @@
+ 
+   gfc_define_builtin ("__builtin_cabsl", func_clongdouble_longdouble, 
+                     BUILT_IN_CABSL, "cabsl", ATTR_CONST_NOTHROW_LEAF_LIST);
++#if defined(__NetBSD__)
++  gfc_define_builtin ("__builtin_cabs", func_cdouble_double, 
++                    BUILT_IN_CABS, "__c99_cabs", ATTR_CONST_NOTHROW_LEAF_LIST);
++  gfc_define_builtin ("__builtin_cabsf", func_cfloat_float, 
++                    BUILT_IN_CABSF, "__c99_cabsf", ATTR_CONST_NOTHROW_LEAF_LIST);
++#else
+   gfc_define_builtin ("__builtin_cabs", func_cdouble_double, 
+                     BUILT_IN_CABS, "cabs", ATTR_CONST_NOTHROW_LEAF_LIST);
+   gfc_define_builtin ("__builtin_cabsf", func_cfloat_float, 
+                     BUILT_IN_CABSF, "cabsf", ATTR_CONST_NOTHROW_LEAF_LIST);
++#endif
+  
+   gfc_define_builtin ("__builtin_copysignl", mfunc_longdouble[1], 
+                     BUILT_IN_COPYSIGNL, "copysignl",
Index: pkgsrc/lang/gcc6-aux/files/diff-gcc-testsuite
diff -u /dev/null pkgsrc/lang/gcc6-aux/files/diff-gcc-testsuite:1.1
--- /dev/null   Tue Dec 13 01:19:20 2016
+++ pkgsrc/lang/gcc6-aux/files/diff-gcc-testsuite       Tue Dec 13 01:19:20 2016
@@ -0,0 +1,46 @@
+--- gcc/testsuite/gcc.dg/format/ext-1.c.orig
++++ gcc/testsuite/gcc.dg/format/ext-1.c
+@@ -8,7 +8,7 @@
+ #include "format.h"
+ 
+ void
+-foo (quad_t q, u_quad_t uq, quad_t *qn, size_t z, size_t *zn, long long int ll,
++foo (quad2_t q, u_quad2_t uq, quad2_t *qn, size_t z, size_t *zn, long long int ll,
+      unsigned long long int ull, int i, unsigned int u, double d,
+      char *s, void *p, wchar_t *ls, wint_t lc, int *n, long int l)
+ {
+--- gcc/testsuite/gcc.dg/format/ext-2.c.orig
++++ gcc/testsuite/gcc.dg/format/ext-2.c
+@@ -8,7 +8,7 @@
+ #include "format.h"
+ 
+ void
+-foo (quad_t *qp, u_quad_t *uqp, quad_t *qn, long long int *llp,
++foo (quad2_t *qp, u_quad2_t *uqp, quad2_t *qn, long long int *llp,
+      unsigned long long int *ullp, float *fp, char *s, void **pp, wchar_t *ls,
+      int *ip, unsigned int *up)
+ {
+--- gcc/testsuite/gcc.dg/format/format.h.orig
++++ gcc/testsuite/gcc.dg/format/format.h
+@@ -71,8 +71,8 @@
+ #endif
+ 
+ /* %q formats want a "quad"; GCC considers this to be a long long.  */
+-typedef llong quad_t;
+-typedef ullong u_quad_t;
++typedef llong quad2_t;
++typedef ullong u_quad2_t;
+ 
+ __extension__ typedef __INTMAX_TYPE__ intmax_t;
+ __extension__ typedef __UINTMAX_TYPE__ uintmax_t;
+--- gcc/testsuite/gcc.dg/pch/pch.exp.orig
++++ gcc/testsuite/gcc.dg/pch/pch.exp
+@@ -44,6 +44,8 @@
+ set test "largefile.c"
+ set testh "largefile.hs"
+ set f [open $test w]
++puts $f "/* { dg-do run { target *-*-solaris* } } */"
++puts $f "/* { dg-error \"dummy\" \"fool dejagnu\" { target { ! *-*-solaris* } 20 } } */"
+ puts $f "/* { dg-timeout-factor 4.0 } */"
+ set v 0
+ for { set v 0 } { $v < 10000 } { incr v } {



Home | Main Index | Thread Index | Old Index