pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Import gcc47-4.7.4nb3 as wip/gcc47.
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Thu Dec 22 15:03:40 2016 +0100
Changeset: 7f197e1603a04b09200179d7d7ade270ee1afb92
Added Files:
gcc47/DESCR
gcc47/Makefile
gcc47/PLIST.java
gcc47/buildlink3.mk
gcc47/distinfo
gcc47/files/values.c
gcc47/options.mk
gcc47/patches/patch-configure
gcc47/patches/patch-gcc_Makefile.in
gcc47/patches/patch-gcc_config.gcc
gcc47/patches/patch-gcc_config_dragonfly-stdint.h
gcc47/patches/patch-gcc_config_dragonfly.h
gcc47/patches/patch-gcc_config_dragonfly.opt
gcc47/patches/patch-gcc_config_i386_dragonfly.h
gcc47/patches/patch-gcc_config_netbsd-stdint.h
gcc47/patches/patch-gcc_config_netbsd.h
gcc47/patches/patch-gcc_config_sol2.h
gcc47/patches/patch-gcc_configure
gcc47/patches/patch-gcc_cp_cfns.gperf
gcc47/patches/patch-gcc_cp_cfns.h
gcc47/patches/patch-gcc_fortran_f95-lang.c
gcc47/patches/patch-gcc_gcc.c
gcc47/patches/patch-gcc_ginclude_stddef.h
gcc47/patches/patch-gcc_testsuite_g++.dg_eh_unwind-direct.C
gcc47/patches/patch-include_libiberty.h
gcc47/patches/patch-libgcc_config.host
gcc47/patches/patch-libgcc_config_i386_dragonfly-unwind.h
gcc47/patches/patch-libgcc_config_t-slibgcc-darwin
gcc47/patches/patch-libgcc_config_t-slibgcc-sld
gcc47/patches/patch-libgcc_crtstuff.c
gcc47/patches/patch-libgcc_unwind-dw2-fde-dip.c
gcc47/patches/patch-libgfortran_configure
gcc47/patches/patch-libgo_Makefile.in
gcc47/patches/patch-libgo_config_ltmain.sh
gcc47/patches/patch-libgo_runtime_proc.c
gcc47/patches/patch-libiberty_Makefile.in
gcc47/patches/patch-libjava_Makefile.in
gcc47/patches/patch-libjava_boehm.cc
gcc47/patches/patch-libjava_configure
gcc47/patches/patch-libjava_contrib_rebuild-gcj-db.in
gcc47/patches/patch-libstdc++-v3_config_locale_dragonfly_c__locale.cc
gcc47/patches/patch-libstdc++-v3_config_locale_dragonfly_ctype__members.cc
gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__base.h
gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__configure__char.cc
gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__inline.h
gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_os__defines.h
gcc47/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h
gcc47/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc
gcc47/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__inline.h
gcc47/patches/patch-libstdc++-v3_configure
gcc47/patches/patch-libstdc++-v3_configure.host
gcc47/patches/patch-ltmain.sh
gcc47/version.mk
Log Message:
Import gcc47-4.7.4nb3 as wip/gcc47.
The GNU Compiler Collection (GCC) includes front ends for C, C++, Objective-C,
Fortran, Java, and Go, as well as libraries for these languages (libstdc++,
libgcj,...).
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=7f197e1603a04b09200179d7d7ade270ee1afb92
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
gcc47/DESCR | 3 +
gcc47/Makefile | 193 +++++++++++++
gcc47/PLIST.java | 42 +++
gcc47/buildlink3.mk | 33 +++
gcc47/distinfo | 55 ++++
gcc47/files/values.c | 64 +++++
gcc47/options.mk | 168 ++++++++++++
gcc47/patches/patch-configure | 19 ++
gcc47/patches/patch-gcc_Makefile.in | 17 ++
gcc47/patches/patch-gcc_config.gcc | 85 ++++++
gcc47/patches/patch-gcc_config_dragonfly-stdint.h | 61 +++++
gcc47/patches/patch-gcc_config_dragonfly.h | 140 ++++++++++
gcc47/patches/patch-gcc_config_dragonfly.opt | 70 +++++
gcc47/patches/patch-gcc_config_i386_dragonfly.h | 106 +++++++
gcc47/patches/patch-gcc_config_netbsd-stdint.h | 63 +++++
gcc47/patches/patch-gcc_config_netbsd.h | 22 ++
gcc47/patches/patch-gcc_config_sol2.h | 26 ++
gcc47/patches/patch-gcc_configure | 29 ++
gcc47/patches/patch-gcc_cp_cfns.gperf | 19 ++
gcc47/patches/patch-gcc_cp_cfns.h | 19 ++
gcc47/patches/patch-gcc_fortran_f95-lang.c | 30 ++
gcc47/patches/patch-gcc_gcc.c | 22 ++
gcc47/patches/patch-gcc_ginclude_stddef.h | 68 +++++
.../patch-gcc_testsuite_g++.dg_eh_unwind-direct.C | 20 ++
gcc47/patches/patch-include_libiberty.h | 22 ++
gcc47/patches/patch-libgcc_config.host | 47 ++++
.../patch-libgcc_config_i386_dragonfly-unwind.h | 163 +++++++++++
gcc47/patches/patch-libgcc_config_t-slibgcc-darwin | 26 ++
gcc47/patches/patch-libgcc_config_t-slibgcc-sld | 28 ++
gcc47/patches/patch-libgcc_crtstuff.c | 29 ++
gcc47/patches/patch-libgcc_unwind-dw2-fde-dip.c | 26 ++
gcc47/patches/patch-libgfortran_configure | 15 +
gcc47/patches/patch-libgo_Makefile.in | 17 ++
gcc47/patches/patch-libgo_config_ltmain.sh | 13 +
gcc47/patches/patch-libgo_runtime_proc.c | 17 ++
gcc47/patches/patch-libiberty_Makefile.in | 18 ++
gcc47/patches/patch-libjava_Makefile.in | 16 ++
gcc47/patches/patch-libjava_boehm.cc | 27 ++
gcc47/patches/patch-libjava_configure | 17 ++
.../patch-libjava_contrib_rebuild-gcj-db.in | 29 ++
...bstdc++-v3_config_locale_dragonfly_c__locale.cc | 305 +++++++++++++++++++++
...++-v3_config_locale_dragonfly_ctype__members.cc | 179 ++++++++++++
...stdc++-v3_config_os_bsd_dragonfly_ctype__base.h | 65 +++++
...nfig_os_bsd_dragonfly_ctype__configure__char.cc | 104 +++++++
...dc++-v3_config_os_bsd_dragonfly_ctype__inline.h | 166 +++++++++++
...stdc++-v3_config_os_bsd_dragonfly_os__defines.h | 46 ++++
...libstdc++-v3_config_os_bsd_netbsd_ctype__base.h | 37 +++
..._config_os_bsd_netbsd_ctype__configure__char.cc | 57 ++++
...bstdc++-v3_config_os_bsd_netbsd_ctype__inline.h | 13 +
gcc47/patches/patch-libstdc++-v3_configure | 47 ++++
gcc47/patches/patch-libstdc++-v3_configure.host | 14 +
gcc47/patches/patch-ltmain.sh | 13 +
gcc47/version.mk | 2 +
53 files changed, 2932 insertions(+)
diffs:
diff --git a/gcc47/DESCR b/gcc47/DESCR
new file mode 100644
index 0000000..0262b09
--- /dev/null
+++ b/gcc47/DESCR
@@ -0,0 +1,3 @@
+The GNU Compiler Collection (GCC) includes front ends for C, C++, Objective-C,
+Fortran, Java, and Go, as well as libraries for these languages (libstdc++,
+libgcj,...).
diff --git a/gcc47/Makefile b/gcc47/Makefile
new file mode 100644
index 0000000..d48bd67
--- /dev/null
+++ b/gcc47/Makefile
@@ -0,0 +1,193 @@
+# $NetBSD: Makefile,v 1.41 2016/10/31 04:10:38 dholland Exp $
+
+GCC_PKGNAME= gcc47
+.include "version.mk"
+
+DISTNAME= gcc-${GCC47_DIST_VERSION}
+PKGNAME= ${GCC_PKGNAME}-${GCC47_DIST_VERSION}
+## When bumping the PKGREVISION of this package the PKGREVISION of
+## lang/gcc47-libs needs to be bump to be at least 1 more than the
+## PKGREVISION of this package!
+PKGREVISION= 3
+CATEGORIES= lang
+MASTER_SITES= ${MASTER_SITE_GNU:=gcc/gcc-${GCC47_DIST_VERSION}/}
+EXTRACT_SUFX= .tar.bz2
+
+MAINTAINER= sbd%NetBSD.org@localhost
+HOMEPAGE= http://gcc.gnu.org/
+COMMENT= The GNU Compiler Collection (GCC) - 4.7 Release Series
+LICENSE= gnu-gpl-v2 AND gnu-gpl-v3 AND gnu-lgpl-v2 AND gnu-lgpl-v3
+
+DISTFILES= ${DEFAULT_DISTFILES}
+EXTRACT_ONLY= ${DEFAULT_DISTFILES}
+
+NOT_FOR_PLATFORM= Interix-*-*
+
+USE_TOOLS+= gmake makeinfo sed:run perl
+GCC_REQD+= 4.4
+
+GNU_CONFIGURE= yes
+## Build outside ${WRKSRC}
+OBJDIR= ../build
+CONFIGURE_DIRS= ${OBJDIR}
+CONFIGURE_SCRIPT= ../${DISTNAME}/configure
+GCC_SUBPREFIX= ${GCC_PKGNAME}
+GCC_PREFIX= ${PREFIX}/${GCC_SUBPREFIX}
+GCC_TARGET_MACHINE?= ${MACHINE_GNU_PLATFORM}
+GNU_CONFIGURE_PREFIX= ${GCC_PREFIX}
+INFO_FILES= yes
+
+UNLIMIT_RESOURCES+= datasize
+UNLIMIT_RESOURCES+= stacksize
+
+SUBST_CLASSES+= vars
+SUBST_STAGE.vars= pre-configure
+SUBST_FILES.vars= gcc/Makefile.in
+SUBST_VARS.vars= GCC_TARGET_MACHINE
+
+.include "../../mk/bsd.prefs.mk"
+
+LANGS= c c++
+
+# In some cases LINKER_RPATH_FLAG needs a trailing space.
+LINKER_RPATH_FLAG:= ${LINKER_RPATH_FLAG:S/-rpath/& /}
+
+## The Library rpath to use in end programs.
+LDFLAGS_FOR_TARGET= ${LDFLAGS:M${COMPILER_RPATH_FLAG}*:N*/usr/lib*}
+
+# The "-static-libstdc++ -static-libgcc" flags are normally added to the
+# boot-ldflags by configure but because we are supply the boot-ldflags
+# we mash supply them.
+BOOT_LDFLAGS= -static-libstdc++ -static-libgcc ${LDFLAGS_FOR_TARGET}
+# Needed on Darwin when LDFLAGS point to a SDK
+BOOT_LDFLAGS+= ${LDFLAGS:M-Wl,-syslibroot*}
+
+# Ignore missing rpaths in "fake" library.
+CHECK_SHLIBS_SKIP+= ${GCC_PKGNAME}/lib*/libgcj_bc.so*
+
+## For target librarys and libjava programs.
+CONFIGURE_ENV+= LDFLAGS_FOR_TARGET=${LDFLAGS_FOR_TARGET:Q}
+
+# "checking for compiler with PCH support" hangs with ASLR enabled
+.if !empty(MACHINE_PLATFORM:MNetBSD-*)
+CONFIGURE_ARGS+= --disable-libstdcxx-pch
+.endif
+
+.if !empty(MACHINE_PLATFORM:MNetBSD-*-*)
+# on NetBSD, use the native SSP code in libc
+CONFIGURE_ARGS+= --disable-libssp
+.else
+CONFIGURE_ARGS+= --enable-libssp
+.endif
+
+CONFIGURE_ARGS+= --enable-languages=${LANGS:Q}
+CONFIGURE_ARGS+= --enable-shared
+CONFIGURE_ARGS+= --enable-long-long
+CONFIGURE_ARGS+= --with-local-prefix=${GCC_PREFIX:Q}
+CONFIGURE_ARGS+= --enable-threads=posix
+CONFIGURE_ARGS+= --with-boot-ldflags=${BOOT_LDFLAGS:Q}
+
+CONFIGURE_ARGS.NetBSD+= --with-gnu-ld --with-ld=/usr/bin/ld
+CONFIGURE_ARGS.NetBSD+= --with-gnu-as --with-as=/usr/bin/as
+MAKE_ENV.NetBSD+= ac_cv_func_clock_gettime=yes
+MAKE_ENV.NetBSD+= ac_cv_func_gethostbyname_r=no
+
+CONFIGURE_ARGS.DragonFly+= --disable-bootstrap
+
+# See ${WRKSRC}/libgcc/config/t-slibgcc-darwin: It uses strip(1) to
+# create a stub library, not just to remove symbols, so we must not
+# let strip(1) be a no-op regardless of ${INSTALL_UNSTRIPPED} or the
+# build fails for missing files.
+CONFIGURE_ARGS.Darwin+= STRIP_FOR_TARGET=${TOOLS_PLATFORM.strip}
+
+.if !empty(MACHINE_PLATFORM:MDarwin-[0-8].*-*)
+CONFIGURE_ARGS+= --with-dwarf2
+CONFIGURE_ARGS+= --disable-libitm
+.endif
+
+.if !empty(MACHINE_PLATFORM:MDarwin-[0-8].*-powerpc)
+CONFIGURE_ARGS+= --disable-multilib
+.endif
+
+.if !empty(MACHINE_PLATFORM:MNetBSD-*-i386) || !empty(MACHINE_PLATFORM:MLinux-*-i386)
+CONFIGURE_ARGS+= --with-arch=i486 --with-tune=i486
+.endif
+
+# Disable fixincludes on SmartOS, header changes result in broken includes
+# being generated, see https://github.com/joyent/pkgsrc/issues/270
+.if ${OS_VARIANT} == "SmartOS"
+SUBST_CLASSES+= fixinc
+SUBST_STAGE.fixinc= pre-configure
+SUBST_FILES.fixinc= gcc/Makefile.in
+SUBST_SED.fixinc= -e "s,\./fixinc.sh,-c true,"
+.endif
+
+.include "options.mk"
+
+.if !empty(PKG_OPTIONS:Mgcc-go) && !empty(MACHINE_PLATFORM:MDarwin-*-*)
+BROKEN+= Doesn't work on Darwin, GCC bugzilla ID 46986
+.endif
+
+# ${WRKSRC}/fixincludes/ looks for sed and compiles the path to sed into
+# a binary so we need to make sure we give it the installed sed and not
+# the tool wrapped one.
+MAKE_ENV+= ac_cv_path_SED=${TOOLS_SED}
+MAKE_ENV+= lt_cv_path_SED=${TOOLS_SED}
+
+# Determine whether to use binutils
+.if ${OPSYS} == "SunOS"
+. if exists(/usr/sfw/bin/gobjdump)
+CONFIGURE_ENV+= OBJDUMP=/usr/sfw/bin/gobjdump
+. endif
+. if exists(/usr/bin/ld)
+CONFIGURE_ARGS+= --without-gnu-ld --with-ld=/usr/bin/ld
+. else
+CONFIGURE_ARGS+= --without-gnu-ld --with-ld=/usr/ccs/bin/ld
+. endif
+. if exists(/usr/sfw/bin/gas)
+CONFIGURE_ARGS+= --with-gnu-as --with-as=/usr/sfw/bin/gas
+. elif exists(/usr/ccs/bin/as)
+CONFIGURE_ARGS+= --without-gnu-as --with-as=/usr/ccs/bin/as
+. else
+BUILDLINK_DEPMETHOD.binutils= full
+. include "../../devel/binutils/buildlink3.mk"
+CONFIGURE_ARGS+= --with-gnu-as --with-as=${PREFIX}/bin/gas
+. endif
+.endif
+
+pre-configure:
+ ${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}
+
+TEST_TARGET= -k check || ${TRUE}
+pre-test:
+ ${RUN} \
+ if runtest --version >/dev/null 2>/dev/null ; then \
+ : ; \
+ else \
+ ${ECHO} "ERROR: Please install devel/dejagnu in order to run the test suite." ; \
+ exit 1 ; \
+ fi
+post-test:
+ ${RUN} cd ${WRKSRC} && cd ${OBJDIR} && \
+ ${SHELL} ${WRKSRC}/contrib/test_summary >${WRKDIR}/test_summary.log
+ @${INFO_MSG} "Test summary are available in ${WRKDIR}/test_summary.log"
+
+post-install:
+ ${TEST} -f ${DESTDIR}${GCC_PREFIX}/bin/cc || \
+ ( cd ${DESTDIR}${GCC_PREFIX}/bin ; ${LN} -f gcc cc )
+.if !empty(PKG_OPTIONS:Mgcc-java)
+ ${RM} -f ${DESTDIR}${JAVA_HOME}/bin/javadoc
+ ${RM} -f ${DESTDIR}${JAVA_HOME}/jre/lib/${JAVA_ARCH}/libjawt.so
+.endif
+.if !empty(MACHINE_PLATFORM:MSunOS-*-*86*) && ${OS_VERSION} != "5.11"
+ ${SH} files/values.c ${DESTDIR}${GCC_PREFIX}/bin/gcc -m32 || ${TRUE}
+ ${SH} files/values.c ${DESTDIR}${GCC_PREFIX}/bin/gcc -m64 || ${TRUE}
+.endif
+
+GENERATE_PLIST+= \
+ cd ${DESTDIR}${PREFIX} && \
+ ${FIND} ${GCC_SUBPREFIX} \( -type f -o -type l \) -print | ${SORT} ;
+
+.include "../../mk/dlopen.buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/gcc47/PLIST.java b/gcc47/PLIST.java
new file mode 100644
index 0000000..ea080a6
--- /dev/null
+++ b/gcc47/PLIST.java
@@ -0,0 +1,42 @@
+@comment $NetBSD: PLIST.java,v 1.2 2012/05/05 22:15:06 joerg Exp $
+bin/${JAVA_NAME}-appletviewer
+bin/${JAVA_NAME}-jar
+bin/${JAVA_NAME}-jarsigner
+bin/${JAVA_NAME}-java
+bin/${JAVA_NAME}-javah
+bin/${JAVA_NAME}-keytool
+bin/${JAVA_NAME}-native2ascii
+bin/${JAVA_NAME}-orbd
+bin/${JAVA_NAME}-rmic
+bin/${JAVA_NAME}-rmid
+bin/${JAVA_NAME}-rmiregistry
+bin/${JAVA_NAME}-serialver
+bin/${JAVA_NAME}-tnameserv
+java/${JAVA_NAME}/bin/appletviewer
+java/${JAVA_NAME}/bin/jar
+java/${JAVA_NAME}/bin/jarsigner
+java/${JAVA_NAME}/bin/java
+java/${JAVA_NAME}/bin/javah
+java/${JAVA_NAME}/bin/keytool
+java/${JAVA_NAME}/bin/native2ascii
+java/${JAVA_NAME}/bin/orbd
+java/${JAVA_NAME}/bin/rmic
+java/${JAVA_NAME}/bin/rmid
+java/${JAVA_NAME}/bin/rmiregistry
+java/${JAVA_NAME}/bin/serialver
+java/${JAVA_NAME}/bin/tnameserv
+java/${JAVA_NAME}/include/jawt.h
+java/${JAVA_NAME}/include/jni.h
+java/${JAVA_NAME}/include/linux/jawt_md.h
+java/${JAVA_NAME}/include/linux/jni_md.h
+java/${JAVA_NAME}/jre/bin/java
+java/${JAVA_NAME}/jre/bin/keytool
+java/${JAVA_NAME}/jre/bin/orbd
+java/${JAVA_NAME}/jre/bin/rmid
+java/${JAVA_NAME}/jre/bin/rmiregistry
+java/${JAVA_NAME}/jre/bin/tnameserv
+java/${JAVA_NAME}/jre/lib/${JAVA_ARCH}/client/libjvm.so
+java/${JAVA_NAME}/jre/lib/${JAVA_ARCH}/server/libjvm.so
+java/${JAVA_NAME}/jre/lib/rt.jar
+java/${JAVA_NAME}/jre/lib/security/java.security
+java/${JAVA_NAME}/lib/tools.jar
diff --git a/gcc47/buildlink3.mk b/gcc47/buildlink3.mk
new file mode 100644
index 0000000..dba0113
--- /dev/null
+++ b/gcc47/buildlink3.mk
@@ -0,0 +1,33 @@
+# $NetBSD: buildlink3.mk,v 1.10 2015/11/25 12:51:16 jperkin Exp $
+
+BUILDLINK_TREE+= gcc47
+
+.if !defined(GCC47_BUILDLINK3_MK)
+GCC47_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.gcc47+= gcc47>=4.7
+BUILDLINK_ABI_DEPENDS.gcc47+= gcc47>=4.7.0
+BUILDLINK_PKGSRCDIR.gcc47= ../../lang/gcc47
+BUILDLINK_DEPMETHOD.gcc47?= build
+
+BUILDLINK_PASSTHRU_DIRS+= ${BUILDLINK_PREFIX.gcc47}/gcc47
+
+BUILDLINK_FILES.gcc47= #empty
+BUILDLINK_AUTO_VARS.gcc47= no
+
+# Packages that link against shared libraries need a full dependency.
+.if defined(_USE_GCC_SHLIB)
+DEPENDS+= {gcc47,gcc47-libs}>=4.7:../../lang/gcc47-libs
+ABI_DEPENDS+= {gcc47,gcc47-libs}>=4.7.0:../../lang/gcc47-libs
+.endif
+
+pkgbase := gcc47
+.include "../../mk/pkg-build-options.mk"
+.if !empty(PKG_BUILD_OPTIONS.gcc47:Mgcc-java)
+.include "../../devel/zlib/buildlink3.mk"
+.endif
+
+.include "../../mk/dlopen.buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
+.endif # GCC47_BUILDLINK3_MK
+BUILDLINK_TREE+= -gcc47
diff --git a/gcc47/distinfo b/gcc47/distinfo
new file mode 100644
index 0000000..5a8baad
--- /dev/null
+++ b/gcc47/distinfo
@@ -0,0 +1,55 @@
+$NetBSD: distinfo,v 1.27 2016/09/06 12:00:33 maya Exp $
+
+SHA1 (ecj-4.5.jar) = 58c1d79c64c8cd718550f32a932ccfde8d1e6449
+RMD160 (ecj-4.5.jar) = d3f4da657f086b6423f74e93f001132f4855368a
+SHA512 (ecj-4.5.jar) = d4e1bf7538ace56e3d69fa91da5bbd16c272923b4de0a9d8dee23ea2b75f9f38c603de72fc4061df49285c450b63f3df211cee5270e9fffc5447445d1a9c9e4e
+Size (ecj-4.5.jar) = 1470676 bytes
+SHA1 (gcc-4.7.4.tar.bz2) = f3359a157b3536f289c155363f1736a2c9b414db
+RMD160 (gcc-4.7.4.tar.bz2) = d0a8e421b9c62a923f765b97828b12d5af388199
+SHA512 (gcc-4.7.4.tar.bz2) = dfcb737073191e628231031a3571ec77ee760a59377630f4a6e4fdfa66f9ddad39fde47e3f0f227eb43cdf90e0d34cde5abdc9ac892c1e111a911062a66c9189
+Size (gcc-4.7.4.tar.bz2) = 82935453 bytes
+SHA1 (patch-configure) = 51c0978c60baddd90ef7e512445fdef913c04e6c
+SHA1 (patch-gcc_Makefile.in) = a61187af64943ef38088442397fcd0f3f65fe2b5
+SHA1 (patch-gcc_config.gcc) = efa4ecabd71bdec14d5dd1f8bb836116c7a9d6e9
+SHA1 (patch-gcc_config_dragonfly-stdint.h) = 740dc819b446d5f1476506322c4b280ffdb5a6c0
+SHA1 (patch-gcc_config_dragonfly.h) = 82f549cdc7543b4bf413a44d481ef42b10f59c82
+SHA1 (patch-gcc_config_dragonfly.opt) = 92f615c73c2e94664bae5b5935ab8b09bca15f73
+SHA1 (patch-gcc_config_i386_dragonfly.h) = 0d3f785434c02beb9c4561fe59842a970e8f7896
+SHA1 (patch-gcc_config_netbsd-stdint.h) = 025fc883101a187e84ed4c0772406720d645d550
+SHA1 (patch-gcc_config_netbsd.h) = 086b593cf9f05e654df9e1a527485ca727ec44cc
+SHA1 (patch-gcc_config_sol2.h) = 4f6ffe871840dcf7e2e469fdcc5d327b9b00f957
+SHA1 (patch-gcc_configure) = a4b670d0c54c410d38715b7a2a572a7048e3ec5e
+SHA1 (patch-gcc_cp_cfns.gperf) = 8f218068e231d97e1b8936aff898c1047440b0ff
+SHA1 (patch-gcc_cp_cfns.h) = 065ef7c681f229f521c845bd1357def95b7e5045
+SHA1 (patch-gcc_fortran_f95-lang.c) = 6edd2adc7de0d6db36fc5670535b55f61664f5fd
+SHA1 (patch-gcc_gcc.c) = d28e633c8961161562db960054aaa5aa6a1ac645
+SHA1 (patch-gcc_ginclude_stddef.h) = 87d7c2ff4400ad0719b2351d2f4c4b05bd257db3
+SHA1 (patch-gcc_testsuite_g++.dg_eh_unwind-direct.C) = fd85ccee102e9618a8010d2dcbb2d9916b28f1cc
+SHA1 (patch-include_libiberty.h) = ad2c64e9a14405c89b02ff68811b1c889405d0a1
+SHA1 (patch-libgcc_config.host) = 6b54e18c6348c4aeb3fda3093fbe990b59456af7
+SHA1 (patch-libgcc_config_i386_dragonfly-unwind.h) = 9d77252dd982495e90f95b82706bab29e581df9f
+SHA1 (patch-libgcc_config_t-slibgcc-darwin) = 5e0d2df4622281f3f9bca3e948d0c7b209fab04c
+SHA1 (patch-libgcc_config_t-slibgcc-sld) = 1b3ae1dc03eaad16a51311049ffc9e42c44dfcbc
+SHA1 (patch-libgcc_crtstuff.c) = 88500ea895cd683608f8f2b7177149f11947e3b4
+SHA1 (patch-libgcc_unwind-dw2-fde-dip.c) = 6da81a310bc76db3ce88649d42658c748c958800
+SHA1 (patch-libgfortran_configure) = b3bbc7d9201073a1bed0b7e10141465bab52c8be
+SHA1 (patch-libgo_Makefile.in) = 612987541f745c7be6835ce7fb7119884db294c3
+SHA1 (patch-libgo_config_ltmain.sh) = 703a27554e479cc2e48410a6bb0e5f5b4be2c150
+SHA1 (patch-libgo_runtime_proc.c) = 55b2c449f4d43fe9b6d7ca1c7f075feebca8ebd6
+SHA1 (patch-libiberty_Makefile.in) = 2a652933a27f670aa5d6fa6e422148bfd01ea82d
+SHA1 (patch-libjava_Makefile.in) = cbf10e212e3865f73f21557eda70d0ad1e860d66
+SHA1 (patch-libjava_boehm.cc) = b18bc9d410a62543583c77e011f50b86f41ca18a
+SHA1 (patch-libjava_configure) = 48ea2baffe87e09dda8133d286bd9b1bfe4c3f8a
+SHA1 (patch-libjava_contrib_rebuild-gcj-db.in) = bb01d738fc7db05046ae37e8ade32574de1d8297
+SHA1 (patch-libstdc++-v3_config_locale_dragonfly_c__locale.cc) = 5c0ccc6b90e3508b03ed399e8e9e300a6aa9cbb7
+SHA1 (patch-libstdc++-v3_config_locale_dragonfly_ctype__members.cc) = 876a754c7fcb1c4a362ca7b2655da6cdbb784ccc
+SHA1 (patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__base.h) = 12b8e3b998ae1c4b6641d8f9e26e7430c58bb7bc
+SHA1 (patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__configure__char.cc) = d5649f42b61ff3c27d60e813cc844b820525aee4
+SHA1 (patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__inline.h) = 3e8cbedb167fc623f184a59b1f4b330544b08939
+SHA1 (patch-libstdc++-v3_config_os_bsd_dragonfly_os__defines.h) = 9a45ecb4309c50ca90008b2fc7d3b44d002698b4
+SHA1 (patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h) = ee1566dba7497043106e0549e6a78042c0c338cd
+SHA1 (patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc) = 5a7c497babd00f7b906234d40e7dc48471cbe759
+SHA1 (patch-libstdc++-v3_config_os_bsd_netbsd_ctype__inline.h) = 830038744cbbb713ecc3f960a9509bef16176db9
+SHA1 (patch-libstdc++-v3_configure) = 7aa0c5fea3b446657aa27f603d99ea50ed1e44c1
+SHA1 (patch-libstdc++-v3_configure.host) = 7426ea4a9735e5f886f4a3ffb4a9ba62734178c4
+SHA1 (patch-ltmain.sh) = 86c1511bd8ff133ba208ec8ec7e206d77ce85d01
diff --git a/gcc47/files/values.c b/gcc47/files/values.c
new file mode 100644
index 0000000..2765709
--- /dev/null
+++ b/gcc47/files/values.c
@@ -0,0 +1,64 @@
+#if 0 /* $NetBSD: values.c,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $ */
+#
+# This is Solaris x86 specific GCC run-time environment patch, which
+# makes it possible to reliably deploy .init snippets. Trouble is that
+# Solaris linker erroneously pads .init segment with zeros [instead of
+# nops], which is bound to SEGV early upon program start-up. This bug
+# was recognized by GCC team [it is mentioned in source code], but
+# workaround apparently and obviously erroneously slipped away in some
+# newer GCC release. This patch compensates for this mishap by dropping
+# modified values-X*.o into GCC installation tree. Object modules in
+# question are normally provided by Sun and linked prior crtbegin.o.
+# Modified versions are additionally crafted with custom .init segment,
+# which does some magic:-)
+# <appro%fy.chalmers.se@localhost>
+set -e
+gcc=gcc
+if [[ "x$1" = x*gcc ]]; then
+ gcc=$1; shift
+fi
+gcc_dir=`${gcc} "$@" -print-libgcc-file-name`
+gcc_dir=${gcc_dir%/*} #*/
+set -x
+${gcc} "$@" -c -o $gcc_dir/values-Xa.o -DXa $0
+${gcc} "$@" -c -o $gcc_dir/values-Xc.o -DXc $0
+${gcc} "$@" -c -o $gcc_dir/values-Xt.o -DXt $0
+exit
+#endif
+
+#include <math.h>
+
+#if defined(Xa)
+const enum version _lib_version = ansi_1;
+#elif defined(Xc)
+const enum version _lib_version = strict_ansi;
+#elif defined(Xt)
+const enum version _lib_version = c_issue_4;
+#else
+#error "compile by issuing 'ksh -f values.c [gcc] [-m64]'"
+#endif
+
+#if defined(__x86_64__)
+asm("\n"
+".section .init\n"
+".align 1\n"
+" leaq 1f(%rip),%rax\n"
+"1: cmpl $0,2f-1b(%rax)\n"
+" jne 2f\n"
+" jmp 2f+5\n"
+" .skip 9\n" /* pad up to 0x1b bytes */
+"2:\n"
+);
+#else
+asm("\n"
+".section .init\n"
+".align 1\n"
+" call 1f\n"
+"1: popl %eax\n"
+" cmpl $0,2f-1b(%eax)\n"
+" jne 2f\n"
+" jmp 2f+5\n"
+" .skip 10\n" /* pad up to 0x1b bytes */
+"2:\n"
+);
+#endif
diff --git a/gcc47/options.mk b/gcc47/options.mk
new file mode 100644
index 0000000..f66cb71
--- /dev/null
+++ b/gcc47/options.mk
@@ -0,0 +1,168 @@
+# $NetBSD: options.mk,v 1.14 2016/09/30 13:16:59 sevan Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.${GCC_PKGNAME}
+PKG_SUPPORTED_OPTIONS= nls gcc-inplace-math gcc-c++ gcc-fortran gcc-java \
+ gcc-go gcc-objc gcc-objc++
+PKG_SUGGESTED_OPTIONS= gcc-c++ gcc-fortran gcc-objc gcc-objc++
+
+PKG_SUGGESTED_OPTIONS.DragonFly+= nls
+PKG_SUGGESTED_OPTIONS.Linux+= nls
+PKG_SUGGESTED_OPTIONS.NetBSD+= nls
+PKG_SUGGESTED_OPTIONS.SunOS+= gcc-go gcc-inplace-math
+# gcc-java was dropped from PKG_SUGGESTED_OPTIONS to spare legacy systems attempting bulkbuilds
+# For example on Darwin/PowerPC this option adds another 24 hours to build time on a G4.
+
+###
+### Determine if multilib is avalible.
+###
+MULTILIB_SUPPORTED?= unknown
+.if !empty(MACHINE_PLATFORM:MLinux-*-x86_64)
+. if exists(/usr/include/gnu/stubs-64.h) && \
+ !exists(/usr/include/gnu/stubs-32.h)
+MULTILIB_SUPPORTED=No
+. else
+MULTILIB_SUPPORTED=Yes
+. endif
+.endif
+.if !empty(MULTILIB_SUPPORTED:M[Yy][Ee][Ss])
+PKG_SUPPORTED_OPTIONS+= gcc-multilib
+PKG_SUGGESTED_OPTIONS+= gcc-multilib
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+###
+### Native Language Support
+###
+.if !empty(PKG_OPTIONS:Mnls)
+USE_TOOLS+= msgfmt
+CONFIGURE_ARGS+= --enable-nls
+CONFIGURE_ARGS+= --with-libiconv-prefix=${BUILDLINK_PREFIX.iconv}
+MAKE_ENV+= ICONVPREFIX=${BUILDLINK_PREFIX.iconv}
+.include "../../converters/libiconv/buildlink3.mk"
+.include "../../devel/gettext-lib/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-nls
+.endif
+
+###
+### Multilib Support
+###
+.if (!empty(MULTILIB_SUPPORTED:M[Yy][Ee][Ss]) && \
+ empty(PKG_OPTIONS:Mgcc-multilib) ) || \
+ !empty(MULTILIB_SUPPORTED:M[Nn][Oo])
+CONFIGURE_ARGS+= --disable-multilib
+.endif
+
+###
+### Build math libraries in place
+###
+.if !empty(PKG_OPTIONS:Mgcc-inplace-math)
+. include "../../devel/gmp/inplace.mk"
+. include "../../math/mpcomplex/inplace.mk"
+. include "../../math/mpfr/inplace.mk"
+.else
+CONFIGURE_ARGS+= --with-gmp=${BUILDLINK_PREFIX.gmp}
+CONFIGURE_ARGS+= --with-mpc=${BUILDLINK_PREFIX.mpcomplex}
+CONFIGURE_ARGS+= --with-mpfr=${BUILDLINK_PREFIX.mpfr}
+LIBS.SunOS+= -lgmp
+. include "../../devel/gmp/buildlink3.mk"
+. include "../../math/mpcomplex/buildlink3.mk"
+. include "../../math/mpfr/buildlink3.mk"
+.endif
+
+###
+### Optional languages
+### Ada could be added although there is a bootstrapping issue. See
+### ../gcc34-ada for guidance
+###
+
+.if !empty(PKG_OPTIONS:Mgcc-objc++)
+. if empty(PKG_OPTIONS:Mgcc-c++)
+PKG_OPTIONS+= gcc-c++
+. endif
+. if empty(PKG_OPTIONS:Mgcc-objc)
+PKG_OPTIONS+= gcc-objc
+. endif
+LANGS+= obj-c++
+.endif
+
+.if !empty(PKG_OPTIONS:Mgcc-objc)
+LANGS+= objc
+.endif
+
+.if !empty(PKG_OPTIONS:Mgcc-java)
+. if empty(PKG_OPTIONS:Mgcc-c++)
+PKG_OPTIONS+= gcc-c++
+. endif
+
+LANGS+= java
+
+# Add the Eclipse Java compiler for to parse `.java' source files.
+ECJ_JAR= ecj-4.5.jar
+SITES.${ECJ_JAR}= ftp://sourceware.org/pub/java/
+DISTFILES+= ${ECJ_JAR}
+CONFIGURE_ARGS+= --with-ecj-jar=${DISTDIR:Q}/${ECJ_JAR:Q}
+
+JAVA_NAME= ${GCC_PKGNAME}
+JAVA_HOME= ${PREFIX}/java/${JAVA_NAME}
+JAVA_WRAPPERS= appletviewer jar jarsigner java javah keytool \
+ native2ascii orbd rmic rmid rmiregistry serialver \
+ tnameserv
+
+JAVA_ARCH= ${MACHINE_ARCH:S/x86_64/amd64/}
+
+PLIST_SRC+= PLIST.java
+PLIST_SUBST+= JAVA_NAME=${JAVA_NAME:Q}
+PLIST_SUBST+= JAVA_ARCH=${JAVA_ARCH:Q}
+
+# Create a JPackage compatible SDK environment.
+CONFIGURE_ARGS+= --enable-java-home
+CONFIGURE_ARGS+= --with-os-directory=${LOWER_OPSYS:Q}
+CONFIGURE_ARGS+= --with-arch-directory=${JAVA_ARCH:Q}
+CONFIGURE_ARGS+= --with-jvm-root-dir=${JAVA_HOME:Q}
+CONFIGURE_ARGS+= --with-java-home=${JAVA_HOME:Q}
+
+REPLACE_PYTHON= libjava/contrib/aot-compile.in
+
+USE_TOOLS+= unzip zip:run gmake:run
+CONFIGURE_ARGS+= --with-system-zlib
+
+# libjava/contrib/aotcompile.py.in stores the path to a 'make' program so
+# we need to make sure we give it the installed 'make' and not the tool
+# wrapped one.
+CONFIGURE_ENV+= PKGSRC_MAKE=${TOOLS_PATH.gmake}
+MAKE_ENV+= PKGSRC_MAKE=${TOOLS_PATH.gmake}
+
+# fastjar-0.93 from pkgsrc/archivers/fastjar seems to trigger a build
+# failure (seen on NetBSD-5.0/i386) when building java. So in case
+# the fastjar package is installed, make sure the configure script
+# doesn't pick it up.
+CONFIGURE_ENV+= JAR=no
+MAKE_ENV+= JAR=no
+MAKE_ENV+= ac_cv_prog_JAR=no
+
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../lang/python/application.mk"
+.include "../../mk/java-env.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mgcc-go)
+LANGS+= go
+.endif
+
+.if !empty(PKG_OPTIONS:Mgcc-fortran)
+LANGS+= fortran
+.endif
+
+.if !empty(PKG_OPTIONS:Mgcc-c++)
+LANGS+= c++
+USE_TOOLS+= perl
+.if ${OPSYS} != "SunOS"
+CONFIGURE_ARGS+= --enable-__cxa_atexit
+.endif
+CONFIGURE_ARGS+= --with-gxx-include-dir=${GCC_PREFIX}/include/c++/
+.else
+CONFIGURE_ARGS+= --disable-build-with-cxx
+CONFIGURE_ARGS+= --disable-build-poststage1-with-cxx
+.endif
diff --git a/gcc47/patches/patch-configure b/gcc47/patches/patch-configure
new file mode 100644
index 0000000..d20f8a8
--- /dev/null
+++ b/gcc47/patches/patch-configure
@@ -0,0 +1,19 @@
+$NetBSD: patch-configure,v 1.2 2012/06/23 22:13:02 marino Exp $
+
+--- configure.orig 2012-02-02 10:20:32.000000000 +0000
++++ configure
+@@ -5191,9 +5191,11 @@ if test "x$with_mpfr_lib" != x; then
+ gmplibs="-L$with_mpfr_lib $gmplibs"
+ fi
+ if test "x$with_mpfr$with_mpfr_include$with_mpfr_lib" = x && test -d ${srcdir}/mpfr; then
+- gmplibs='-L$$r/$(HOST_SUBDIR)/mpfr/'"$lt_cv_objdir $gmplibs"
+- gmpinc='-I$$r/$(HOST_SUBDIR)/mpfr -I$$s/mpfr '"$gmpinc"
+- extra_mpc_mpfr_configure_flags='--with-mpfr-include=$$s/mpfr --with-mpfr-lib=$$r/$(HOST_SUBDIR)/mpfr/'"$lt_cv_objdir"
++ sdir=
++ test -d "${srcdir}/mpfr/src" && sdir=/src
++ gmplibs='-L$$r/$(HOST_SUBDIR)/mpfr'"$sdir/$lt_cv_objdir $gmplibs"
++ gmpinc='-I$$r/$(HOST_SUBDIR)/mpfr'"$sdir "'-I$$s/mpfr'"$sdir $gmpinc"
++ extra_mpc_mpfr_configure_flags='--with-mpfr-include=$$s/mpfr'"$sdir "'--with-mpfr-lib=$$r/$(HOST_SUBDIR)/mpfr'"$sdir/$lt_cv_objdir"
+ # Do not test the mpfr version. Assume that it is sufficient, since
+ # it is in the source tree, and the library has not been built yet
+ # but it would be included on the link line in the version check below
diff --git a/gcc47/patches/patch-gcc_Makefile.in b/gcc47/patches/patch-gcc_Makefile.in
new file mode 100644
index 0000000..009480f
--- /dev/null
+++ b/gcc47/patches/patch-gcc_Makefile.in
@@ -0,0 +1,17 @@
+$NetBSD: patch-gcc_Makefile.in,v 1.5 2013/04/21 08:55:19 sbd Exp $
+
+Add gcc libdir to a programs rpath so that _this gcc's_ support libraries
+are found.
+
+NOTE: the %M spec string is added by patch-gcc_gcc.c
+
+--- gcc/Makefile.in.orig 2012-03-07 10:59:56.000000000 +0000
++++ gcc/Makefile.in
+@@ -2074,6 +2074,7 @@ prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_
+ # Language-independent files.
+
+ DRIVER_DEFINES = \
++ -DLINK_LIBGCC_SPEC="\"%D $(LINKER_RPATH_FLAG)$(prefix)/@GCC_TARGET_MACHINE@/lib/%M $(LINKER_RPATH_FLAG)$(libdir)/%M \"" \
+ -DSTANDARD_STARTFILE_PREFIX=\"$(unlibsubdir)/\" \
+ -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
+ -DSTANDARD_LIBEXEC_PREFIX=\"$(libexecdir)/gcc/\" \
diff --git a/gcc47/patches/patch-gcc_config.gcc b/gcc47/patches/patch-gcc_config.gcc
new file mode 100644
index 0000000..ab600a7
--- /dev/null
+++ b/gcc47/patches/patch-gcc_config.gcc
@@ -0,0 +1,85 @@
+$NetBSD: patch-gcc_config.gcc,v 1.3 2012/06/23 22:13:02 marino Exp $
+
+* Add t-crtstuff to tmake_file on NetBSD.
+* Add netbsd-stdint.h to tm_file on NetBSD.
+* wrap the system stdint.h on NetBSD.
+* Add DragonFly support.
+
+--- gcc/config.gcc.orig 2012-03-05 10:43:22.000000000 +0000
++++ gcc/config.gcc
+@@ -589,6 +589,26 @@ case ${target} in
+ # need_64bit_hwint=yes # system compiler has this for all arch!
+ use_gcc_stdint=wrap
+ ;;
++*-*-dragonfly*)
++ gas=yes
++ gnu_ld=yes
++ tmake_file="t-slibgcc"
++ case ${enable_threads} in
++ "" | yes | posix)
++ thread_file='posix'
++ ;;
++ no | gnat | single)
++ # Let these non-posix thread selections fall through if requested
++ ;;
++ *)
++ echo 'Unknown thread configuration for DragonFly BSD'
++ exit 1
++ ;;
++ esac
++ extra_options="$extra_options rpath.opt dragonfly.opt"
++ default_use_cxa_atexit=yes
++ use_gcc_stdint=wrap
++ ;;
+ *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
+ extra_options="$extra_options gnu-user.opt"
+ gas=yes
+@@ -644,6 +664,7 @@ case ${target} in
+ esac
+ ;;
+ *-*-netbsd*)
++ use_gcc_stdint=wrap
+ tmake_file="t-slibgcc"
+ gas=yes
+ gnu_ld=yes
+@@ -1196,6 +1217,14 @@ i[34567]86-*-elf*)
+ x86_64-*-elf*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
+ ;;
++i[34567]86-*-dragonfly*)
++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/dragonfly.h"
++ tmake_file="${tmake_file} i386/t-crtstuff"
++ ;;
++x86_64-*-dragonfly*)
++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/x86-64.h i386/dragonfly.h"
++ tmake_file="${tmake_file} i386/t-crtstuff"
++ ;;
+ i[34567]86-*-freebsd*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
+ ;;
+@@ -1203,12 +1232,14 @@ x86_64-*-freebsd*)
+ 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 netbsd-stdint.h"
+ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++ tmake_file="${tmake_file} i386/t-crtstuff"
+ ;;
+ x86_64-*-netbsd*)
+- tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h 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 netbsd-stdint.h"
+ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++ tmake_file="${tmake_file} i386/t-crtstuff"
+ ;;
+ 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"
+@@ -3518,6 +3549,8 @@ case ${target} in
+ ;;
+ i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw*)
+ ;;
++ i[34567]86-*-dragonfly* | x86_64-*-dragonfly*)
++ ;;
+ i[34567]86-*-freebsd* | x86_64-*-freebsd*)
+ ;;
+ ia64*-*-linux*)
diff --git a/gcc47/patches/patch-gcc_config_dragonfly-stdint.h b/gcc47/patches/patch-gcc_config_dragonfly-stdint.h
new file mode 100644
index 0000000..94ebe5c
--- /dev/null
+++ b/gcc47/patches/patch-gcc_config_dragonfly-stdint.h
@@ -0,0 +1,61 @@
+$NetBSD: patch-gcc_config_dragonfly-stdint.h,v 1.1 2012/06/23 22:13:02 marino Exp $
+
+--- gcc/config/dragonfly-stdint.h.orig 2012-06-22 10:35:29.000000000 +0000
++++ gcc/config/dragonfly-stdint.h
+@@ -0,0 +1,56 @@
++/* Definitions for <stdint.h> types for DragonFly systems.
++ Copyright (C) 2009 Free Software Foundation, Inc.
++ Contributed by Gerald Pfeifer <gerald%pfeifer.com@localhost>.
++
++This file is part of GCC.
++
++GCC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 3, or (at your option)
++any later version.
++
++GCC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++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/>. */
++
++#define SIG_ATOMIC_TYPE "int"
++
++#define INT8_TYPE "signed char"
++#define INT16_TYPE "short int"
++#define INT32_TYPE "int"
++#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
++#define UINT8_TYPE "unsigned char"
++#define UINT16_TYPE "short unsigned int"
++#define UINT32_TYPE "unsigned int"
++#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
++
++#define INT_LEAST8_TYPE INT8_TYPE
++#define INT_LEAST16_TYPE INT16_TYPE
++#define INT_LEAST32_TYPE INT32_TYPE
++#define INT_LEAST64_TYPE INT64_TYPE
++#define UINT_LEAST8_TYPE UINT8_TYPE
++#define UINT_LEAST16_TYPE UINT16_TYPE
++#define UINT_LEAST32_TYPE UINT32_TYPE
++#define UINT_LEAST64_TYPE UINT64_TYPE
++
++#define INT_FAST8_TYPE INT32_TYPE
++#define INT_FAST16_TYPE INT32_TYPE
++#define INT_FAST32_TYPE INT32_TYPE
++#define INT_FAST64_TYPE INT64_TYPE
++#define UINT_FAST8_TYPE UINT32_TYPE
++#define UINT_FAST16_TYPE UINT32_TYPE
++#define UINT_FAST32_TYPE UINT32_TYPE
++#define UINT_FAST64_TYPE UINT64_TYPE
++
++#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? INT64_TYPE : INT32_TYPE)
++#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? UINT64_TYPE : UINT32_TYPE)
diff --git a/gcc47/patches/patch-gcc_config_dragonfly.h b/gcc47/patches/patch-gcc_config_dragonfly.h
new file mode 100644
index 0000000..9ace605
--- /dev/null
+++ b/gcc47/patches/patch-gcc_config_dragonfly.h
@@ -0,0 +1,140 @@
+$NetBSD: patch-gcc_config_dragonfly.h,v 1.1 2012/06/23 22:13:02 marino Exp $
+
+--- gcc/config/dragonfly.h.orig 2012-06-22 10:35:29.000000000 +0000
++++ gcc/config/dragonfly.h
+@@ -0,0 +1,135 @@
++/* Base configuration file for all DragonFly targets.
++ Copyright (C) 1999, 2000, 2001, 2007, 2008 Free Software Foundation, Inc.
++
++This file is part of GCC.
++
++GCC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 3, or (at your option)
++any later version.
++
++GCC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GCC; see the file COPYING3. If not see
++<http://www.gnu.org/licenses/>. */
++
++/* Common DragonFly configuration.
++ All DragonFly architectures should include this file, which will specify
++ their commonalities.
++ Adapted from gcc/config/i386/freebsd-elf.h by
++ David O'Brien <obrien%FreeBSD.org@localhost>.
++ Further work by David O'Brien <obrien%FreeBSD.org@localhost> and
++ Loren J. Rittle <ljrittle%acm.org@localhost>. */
++
++#undef TARGET_OS_CPP_BUILTINS
++#define TARGET_OS_CPP_BUILTINS() \
++ do \
++ { \
++ builtin_define_std ("unix"); \
++ builtin_define ("__DragonFly__"); \
++ builtin_assert ("system=unix"); \
++ builtin_assert ("system=bsd"); \
++ builtin_assert ("system=DragonFly"); \
++ } \
++ while (0)
++
++#undef CPP_SPEC
++#define CPP_SPEC \
++ "%(cpp_cpu) %(cpp_arch) %{posix:-D_POSIX_SOURCE}"
++
++#undef STARTFILE_SPEC
++#define STARTFILE_SPEC \
++ "%{!shared: \
++ %{pg:gcrt1.o%s} \
++ %{!pg: \
++ %{p:gcrt1.o%s} \
++ %{!p: \
++ %{profile: gcrt1.o%s} \
++ %{!profile: \
++ %{pie: Scrt1.o%s;:crt1.o%s}}}}} \
++ crti.o%s \
++ %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++
++#undef ENDFILE_SPEC
++#define ENDFILE_SPEC \
++ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++
++#undef LIB_SPEC
++#define LIB_SPEC \
++ "%{pthread:-lpthread} -lc"
++
++#if defined(HAVE_LD_EH_FRAME_HDR)
++#define LINK_EH_SPEC "--eh-frame-hdr"
++#endif
++
++/* Provide a LINK_SPEC appropriate for DragonFly. Here we provide support
++ for the special GCC options -static and -shared, which allow us to
++ link things in one of these three modes by applying the appropriate
++ combinations of options at link-time.
++
++ When the -shared link option is used a final link is not being
++ done. */
++
++#define DFBSD_LINK_SPEC \
++ "%{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
++ %{v:-V} \
++ %{assert*} %{R*} %{rpath*} %{defsym*} \
++ %{shared:-Bshareable %{h*} %{soname*}} \
++ %{!shared: \
++ %{!static: \
++ %{rdynamic:-export-dynamic} \
++ -dynamic-linker %(dfbsd_dynamic_linker) \
++ } \
++ %{static:-Bstatic}} \
++ %{!static:--hash-style=both} \
++ %{symbolic:-Bsymbolic}"
++
++#undef LINK_SPEC
++#define LINK_SPEC DFBSD_LINK_SPEC
++
++#define DFBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.2"
++
++
++/* Use --as-needed -lgcc_s for eh support. */
++#ifdef HAVE_LD_AS_NEEDED
++#define USE_LD_AS_NEEDED 1
++#endif
++
++/************************[ Target stuff ]***********************************/
++
++/* All DragonFly Architectures support the ELF object file format. */
++#undef OBJECT_FORMAT_ELF
++#define OBJECT_FORMAT_ELF
++
++/* Don't assume anything about the header files. */
++#undef NO_IMPLICIT_EXTERN_C
++#define NO_IMPLICIT_EXTERN_C 1
++
++/* Follow DragonFly's standard headers (<machine/stdint.h>, etc...). */
++
++#undef WCHAR_TYPE
++#define WCHAR_TYPE "int"
++
++#undef WINT_TYPE
++#define WINT_TYPE "int"
++
++/*
++ * Profile libraries are found at /usr/lib/profile with standard names
++ * #define MATH_LIBRARY_PROFILE "m_p"
++ */
++
++/* Code generation parameters. */
++
++/* Use periods rather than dollar signs in special g++ assembler names.
++ This ensures the configuration knows our system correctly so we can link
++ with libraries compiled with the native cc. */
++#undef NO_DOLLAR_IN_LABEL
++
++/* Used by libgcc2.c. We support file locking with fcntl / F_SETLKW.
++ This enables the test coverage code to use file locking when exiting a
++ program, which avoids race conditions if the program has forked. */
++#define TARGET_POSIX_IO
diff --git a/gcc47/patches/patch-gcc_config_dragonfly.opt b/gcc47/patches/patch-gcc_config_dragonfly.opt
new file mode 100644
index 0000000..eb8816d
--- /dev/null
+++ b/gcc47/patches/patch-gcc_config_dragonfly.opt
@@ -0,0 +1,70 @@
+$NetBSD: patch-gcc_config_dragonfly.opt,v 1.1 2012/06/23 22:13:02 marino Exp $
+
+--- gcc/config/dragonfly.opt.orig 2012-06-22 10:35:29.000000000 +0000
++++ gcc/config/dragonfly.opt
+@@ -0,0 +1,65 @@
++; DragonFlyBSD options.
++
++; Copyright (C) 2010, 2011
++; Free Software Foundation, Inc.
++;
++; This file is part of GCC.
++;
++; GCC is free software; you can redistribute it and/or modify it under
++; the terms of the GNU General Public License as published by the Free
++; Software Foundation; either version 3, or (at your option) any later
++; version.
++;
++; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
++; WARRANTY; without even the implied warranty of MERCHANTABILITY or
++; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
++; for more details.
++;
++; You should have received a copy of the GNU General Public License
++; along with GCC; see the file COPYING3. If not see
++; <http://www.gnu.org/licenses/>.
++
++; See the GCC internals manual (options.texi) for a description of this file's format.
++
++; Please try to keep this file in ASCII collating order.
++
++assert
++Driver Separate
++
++assert=
++Driver JoinedOrMissing
++
++defsym
++Driver Separate
++
++defsym=
++Driver JoinedOrMissing
++
++posix
++Driver
++
++profile
++Driver
++
++pthread
++Driver
++
++rdynamic
++Driver
++
++rpath-link
++Driver Separate
++
++rpath-link=
++Driver JoinedOrMissing
++
++rpath=
++Driver JoinedOrMissing
++
++soname
++Driver Separate
++
++soname=
++Driver JoinedOrMissing
++
++; This comment is to ensure we retain the blank line above.
diff --git a/gcc47/patches/patch-gcc_config_i386_dragonfly.h b/gcc47/patches/patch-gcc_config_i386_dragonfly.h
new file mode 100644
index 0000000..03c67f1
--- /dev/null
+++ b/gcc47/patches/patch-gcc_config_i386_dragonfly.h
@@ -0,0 +1,106 @@
+$NetBSD: patch-gcc_config_i386_dragonfly.h,v 1.2 2012/07/12 13:47:23 marino Exp $
+
+--- gcc/config/i386/dragonfly.h.orig 2012-07-12 12:01:10.000000000 +0000
++++ gcc/config/i386/dragonfly.h
+@@ -0,0 +1,101 @@
++/* Definitions for Intel 386 running DragonFly with ELF format
++ Copyright (C) 1996, 2000, 2002, 2004, 2007 Free Software Foundation, Inc.
++ Contributed by Eric Youngdale.
++ Modified for stabs-in-ELF by H.J. Lu.
++ Adapted from GNU/Linux version by John Polstra.
++ Continued development by David O'Brien <obrien%freebsd.org@localhost>
++
++This file is part of GCC.
++
++GCC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 3, or (at your option)
++any later version.
++
++GCC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GCC; see the file COPYING3. If not see
++<http://www.gnu.org/licenses/>. */
++
++
++/* Override the default comment-starter of "/". */
++#undef ASM_COMMENT_START
++#define ASM_COMMENT_START "#"
++
++#undef ASM_APP_ON
++#define ASM_APP_ON "#APP\n"
++
++#undef ASM_APP_OFF
++#define ASM_APP_OFF "#NO_APP\n"
++
++#undef DBX_REGISTER_NUMBER
++#define DBX_REGISTER_NUMBER(n) \
++ (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
++
++#undef NO_PROFILE_COUNTERS
++#define NO_PROFILE_COUNTERS 1
++
++/* Tell final.c that we don't need a label passed to mcount. */
++
++#undef MCOUNT_NAME
++#define MCOUNT_NAME ".mcount"
++
++/* Make gcc agree with <machine/ansi.h>. */
++
++#undef SIZE_TYPE
++#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
++
++#undef PTRDIFF_TYPE
++#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
++
++#undef WCHAR_TYPE_SIZE
++#define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD)
++
++#undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */
++#define SUBTARGET_EXTRA_SPECS \
++ { "dfbsd_dynamic_linker", DFBSD_DYNAMIC_LINKER }
++
++
++/* A C statement to output to the stdio stream FILE an assembler
++ command to advance the location counter to a multiple of 1<<LOG
++ bytes if it is within MAX_SKIP bytes.
++
++ This is used to align code labels according to Intel recommendations. */
++
++#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
++#undef ASM_OUTPUT_MAX_SKIP_ALIGN
++#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \
++ if ((LOG) != 0) { \
++ if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
++ else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
++ }
++#endif
++
++/* Don't default to pcc-struct-return, we want to retain compatibility with
++ older gcc versions AND pcc-struct-return is nonreentrant.
++ (even though the SVR4 ABI for the i386 says that records and unions are
++ returned in memory). */
++
++#undef DEFAULT_PCC_STRUCT_RETURN
++#define DEFAULT_PCC_STRUCT_RETURN 0
++
++/* DragonFly sets the rounding precision of the FPU to 53 bits. Let the
++ compiler get the contents of <float.h> and std::numeric_limits correct. */
++#undef TARGET_96_ROUND_53_LONG_DOUBLE
++#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT)
++
++/* Put all *tf routines in libgcc. */
++#undef LIBGCC2_HAS_TF_MODE
++#define LIBGCC2_HAS_TF_MODE 1
++#define LIBGCC2_TF_CEXT q
++#define TF_SIZE 113
++
++/* Static stack checking is supported by means of probes. */
++#define STACK_CHECK_STATIC_BUILTIN 1
++
++/* Support for i386 has been removed from DragonFly for several releases */
++#define SUBTARGET32_DEFAULT_CPU "i486"
diff --git a/gcc47/patches/patch-gcc_config_netbsd-stdint.h b/gcc47/patches/patch-gcc_config_netbsd-stdint.h
new file mode 100644
index 0000000..b8894a8
--- /dev/null
+++ b/gcc47/patches/patch-gcc_config_netbsd-stdint.h
@@ -0,0 +1,63 @@
+$NetBSD: patch-gcc_config_netbsd-stdint.h,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+Copy gcc/config/freebsd-stdint.h to gcc/config/netbsd-stdint.h.
+
+--- gcc/config/netbsd-stdint.h.orig 2012-04-02 09:19:19.577200540 +0000
++++ gcc/config/netbsd-stdint.h
+@@ -0,0 +1,56 @@
++/* Definitions for <stdint.h> types for NetBSD systems.
++ Copyright (C) 2009 Free Software Foundation, Inc.
++ Contributed by Gerald Pfeifer <gerald%pfeifer.com@localhost>.
++
++This file is part of GCC.
++
++GCC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 3, or (at your option)
++any later version.
++
++GCC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++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/>. */
++
++#define SIG_ATOMIC_TYPE "int"
++
++#define INT8_TYPE "signed char"
++#define INT16_TYPE "short int"
++#define INT32_TYPE "int"
++#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
++#define UINT8_TYPE "unsigned char"
++#define UINT16_TYPE "short unsigned int"
++#define UINT32_TYPE "unsigned int"
++#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
++
++#define INT_LEAST8_TYPE "signed char"
++#define INT_LEAST16_TYPE "short int"
++#define INT_LEAST32_TYPE "int"
++#define INT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
++#define UINT_LEAST8_TYPE "unsigned char"
++#define UINT_LEAST16_TYPE "short unsigned int"
++#define UINT_LEAST32_TYPE "unsigned int"
++#define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
++
++#define INT_FAST8_TYPE "int"
++#define INT_FAST16_TYPE "int"
++#define INT_FAST32_TYPE "int"
++#define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
++#define UINT_FAST8_TYPE "unsigned int"
++#define UINT_FAST16_TYPE "unsigned int"
++#define UINT_FAST32_TYPE "unsigned int"
++#define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
++
++#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
++#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
diff --git a/gcc47/patches/patch-gcc_config_netbsd.h b/gcc47/patches/patch-gcc_config_netbsd.h
new file mode 100644
index 0000000..09345b0
--- /dev/null
+++ b/gcc47/patches/patch-gcc_config_netbsd.h
@@ -0,0 +1,22 @@
+$NetBSD: patch-gcc_config_netbsd.h,v 1.1 2016/09/06 12:00:33 maya Exp $
+
+when using shared, link against libc.
+
+--- gcc/config/netbsd.h.orig 2013-01-10 20:38:27.000000000 +0000
++++ gcc/config/netbsd.h
+@@ -96,6 +96,7 @@ along with GCC; see the file COPYING3.
+ %{!pg:-lposix}} \
+ %{p:-lposix_p} \
+ %{pg:-lposix_p}} \
++ %{shared:-lc} \
+ %{!shared: \
+ %{!symbolic: \
+ %{!p: \
+@@ -109,6 +110,7 @@ along with GCC; see the file COPYING3.
+ %{!pg:-lposix}} \
+ %{p:-lposix_p} \
+ %{pg:-lposix_p}} \
++ %{shared:-lc} \
+ %{!shared: \
+ %{!symbolic: \
+ %{!p: \
diff --git a/gcc47/patches/patch-gcc_config_sol2.h b/gcc47/patches/patch-gcc_config_sol2.h
new file mode 100644
index 0000000..55950b5
--- /dev/null
+++ b/gcc47/patches/patch-gcc_config_sol2.h
@@ -0,0 +1,26 @@
+$NetBSD: patch-gcc_config_sol2.h,v 1.1 2014/05/10 14:14:58 richard Exp $
+
+--- gcc/config/sol2.h.orig 2011-08-18 14:47:46.000000000 +0000
++++ gcc/config/sol2.h
+@@ -166,12 +166,20 @@ along with GCC; see the file COPYING3.
+ #define RDYNAMIC_SPEC "--export-dynamic"
+ #endif
+
++#ifndef USE_GLD
++/* With Sun ld, use mapfile to enforce direct binding to libgcc_s unwinder. */
++#define LINK_LIBGCC_MAPFILE_SPEC "-M %slibgcc-unwind.map"
++#else
++/* GNU ld doesn't support direct binding. */
++#define LINK_LIBGCC_MAPFILE_SPEC ""
++#endif
++
+ #undef LINK_SPEC
+ #define LINK_SPEC \
+ "%{h*} %{v:-V} \
+ %{!shared:%{!static:%{rdynamic: " RDYNAMIC_SPEC "}}} \
+ %{static:-dn -Bstatic} \
+- %{shared:-G -dy %{!mimpure-text:-z text}} \
++ %{shared:-G -dy %{!mimpure-text:-z text} " LINK_LIBGCC_MAPFILE_SPEC "} \
+ %{symbolic:-Bsymbolic -G -dy -z text} \
+ %{pthreads|pthread|fprofile-generate*:" LIB_THREAD_LDFLAGS_SPEC "} \
+ %(link_arch) \
diff --git a/gcc47/patches/patch-gcc_configure b/gcc47/patches/patch-gcc_configure
new file mode 100644
index 0000000..0ef815b
--- /dev/null
+++ b/gcc47/patches/patch-gcc_configure
@@ -0,0 +1,29 @@
+$NetBSD: patch-gcc_configure,v 1.1 2012/06/23 22:13:02 marino Exp $
+
+Add dl_iterate_phdr detection for FreeBSD and DragonFly.
+Detection for NetBSD and OpenBSD is added but commented out in case this
+error handling mechanism is activated for these platforms later.
+
+--- gcc/configure.orig 2012-03-08 13:54:54.000000000 +0000
++++ gcc/configure
+@@ -26802,6 +26802,20 @@ case "$target" in
+ gcc_cv_target_dl_iterate_phdr=no
+ fi
+ ;;
++ *-*-dragonfly* | *-*-freebsd*)
++ if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then
++ gcc_cv_target_dl_iterate_phdr=yes
++ else
++ gcc_cv_target_dl_iterate_phdr=no
++ fi
++ ;;
++# *-*-netbsd* | *-*-openbsd*)
++# 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
diff --git a/gcc47/patches/patch-gcc_cp_cfns.gperf b/gcc47/patches/patch-gcc_cp_cfns.gperf
new file mode 100644
index 0000000..7a2309c
--- /dev/null
+++ b/gcc47/patches/patch-gcc_cp_cfns.gperf
@@ -0,0 +1,19 @@
+$NetBSD: patch-gcc_cp_cfns.gperf,v 1.1 2016/09/06 06:45:32 maya Exp $
+
+cfns: fix mismatch in gnu_inline attributes
+https://gcc.gnu.org/ml/gcc-patches/2015-08/msg00375.html
+
+fixes build using gcc5
+
+--- gcc/cp/cfns.gperf.orig 2009-04-21 19:03:23.000000000 +0000
++++ gcc/cp/cfns.gperf
+@@ -23,6 +23,9 @@ static unsigned int hash (const char *,
+ #ifdef __GNUC__
+ __inline
+ #endif
++#ifdef __GNUC_STDC_INLINE__
++__attribute__ ((__gnu_inline__))
++#endif
+ const char * libc_name_p (const char *, unsigned int);
+ %}
+ %%
diff --git a/gcc47/patches/patch-gcc_cp_cfns.h b/gcc47/patches/patch-gcc_cp_cfns.h
new file mode 100644
index 0000000..03e0d34
--- /dev/null
+++ b/gcc47/patches/patch-gcc_cp_cfns.h
@@ -0,0 +1,19 @@
+$NetBSD: patch-gcc_cp_cfns.h,v 1.1 2016/09/06 06:45:32 maya Exp $
+
+cfns: fix mismatch in gnu_inline attributes
+https://gcc.gnu.org/ml/gcc-patches/2015-08/msg00375.html
+
+fixes build of using gcc5.
+
+--- gcc/cp/cfns.h.orig 2009-04-21 19:03:23.000000000 +0000
++++ gcc/cp/cfns.h
+@@ -54,6 +54,9 @@ static unsigned int hash (const char *,
+ #ifdef __GNUC__
+ __inline
+ #endif
++#ifdef __GNUC_STDC_INLINE__
++__attribute__ ((__gnu_inline__))
++#endif
+ const char * libc_name_p (const char *, unsigned int);
+ /* maximum key range = 391, duplicates = 0 */
+
diff --git a/gcc47/patches/patch-gcc_fortran_f95-lang.c b/gcc47/patches/patch-gcc_fortran_f95-lang.c
new file mode 100644
index 0000000..358c818
--- /dev/null
+++ b/gcc47/patches/patch-gcc_fortran_f95-lang.c
@@ -0,0 +1,30 @@
+$NetBSD: patch-gcc_fortran_f95-lang.c,v 1.2 2014/01/14 19:16:52 wiz Exp $
+
+No NetBSD the 'cabs' and 'cabsf' functions are are __RENAME so that
+thay have '__c99_' prefixes.
+
+--- gcc/fortran/f95-lang.c.orig 2012-01-17 14:34:37.000000000 +0000
++++ gcc/fortran/f95-lang.c
+@@ -817,12 +817,21 @@ gfc_init_builtin_functions (void)
+ gfc_define_builtin ("__builtin_truncf", mfunc_float[0],
+ BUILT_IN_TRUNCF, "truncf", 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);
+ gfc_define_builtin ("__builtin_cabsl", func_clongdouble_longdouble,
+- BUILT_IN_CABSL, "cabsl", ATTR_CONST_NOTHROW_LEAF_LIST);
++ BUILT_IN_CABSL, "__c99_cabsl", 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);
++ gfc_define_builtin ("__builtin_cabsl", func_clongdouble_longdouble,
++ BUILT_IN_CABSL, "cabsl", ATTR_CONST_NOTHROW_LEAF_LIST);
++#endif
+
+ gfc_define_builtin ("__builtin_copysignl", mfunc_longdouble[1],
+ BUILT_IN_COPYSIGNL, "copysignl",
diff --git a/gcc47/patches/patch-gcc_gcc.c b/gcc47/patches/patch-gcc_gcc.c
new file mode 100644
index 0000000..118ba7d
--- /dev/null
+++ b/gcc47/patches/patch-gcc_gcc.c
@@ -0,0 +1,22 @@
+$NetBSD: patch-gcc_gcc.c,v 1.3 2012/09/15 07:41:24 sbd Exp $
+
+Add %M spec string.
+
+Patch commited to gcc in svn id 187775.
+
+--- gcc/gcc.c.orig 2012-02-28 17:31:38.000000000 +0000
++++ gcc/gcc.c
+@@ -5115,6 +5115,13 @@ do_spec_1 (const char *spec, int inswitc
+ return value;
+ break;
+
++ case 'M':
++ if (multilib_os_dir == NULL)
++ obstack_1grow (&obstack, '.');
++ else
++ obstack_grow (&obstack, multilib_os_dir, strlen(multilib_os_dir));
++ break;
++
+ case 'G':
+ value = do_spec_1 (libgcc_spec, 0, NULL);
+ if (value != 0)
diff --git a/gcc47/patches/patch-gcc_ginclude_stddef.h b/gcc47/patches/patch-gcc_ginclude_stddef.h
new file mode 100644
index 0000000..a7c8511
--- /dev/null
+++ b/gcc47/patches/patch-gcc_ginclude_stddef.h
@@ -0,0 +1,68 @@
+$NetBSD: patch-gcc_ginclude_stddef.h,v 1.2 2012/06/23 22:13:02 marino Exp $
+
+Fix build on NetBSD i386/amd64 after the ansi.h header include protection
+name change.
+Add DragonFly support.
+
+--- gcc/ginclude/stddef.h.orig 2012-02-12 01:06:04.000000000 +0000
++++ gcc/ginclude/stddef.h
+@@ -53,12 +53,21 @@ see the files COPYING3 and COPYING.RUNTI
+ one less case to deal with in the following. */
+ #if defined (__BSD_NET2__) || defined (____386BSD____) || (defined (__FreeBSD__) && (__FreeBSD__ < 5)) || defined(__NetBSD__)
+ #include <machine/ansi.h>
++#if !defined(_MACHINE_ANSI_H_)
++#if defined(_I386_ANSI_H_) || defined(_X86_64_ANSI_H_)
++#define _MACHINE_ANSI_H_
++#endif
++#endif
+ #endif
+ /* On FreeBSD 5, machine/ansi.h does not exist anymore... */
+ #if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
+ #include <sys/_types.h>
+ #endif
+
++#if defined(__DragonFly__)
++#include <sys/types.h>
++#endif
++
+ /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
+ defined if the corresponding type is *not* defined.
+ FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_.
+@@ -136,6 +145,7 @@ _TYPE_wchar_t;
+ #ifndef _BSD_PTRDIFF_T_
+ #ifndef ___int_ptrdiff_t_h
+ #ifndef _GCC_PTRDIFF_T
++#ifndef _PTRDIFF_T_DECLARED /* DragonFly */
+ #define _PTRDIFF_T
+ #define _T_PTRDIFF_
+ #define _T_PTRDIFF
+@@ -144,10 +154,12 @@ _TYPE_wchar_t;
+ #define _BSD_PTRDIFF_T_
+ #define ___int_ptrdiff_t_h
+ #define _GCC_PTRDIFF_T
++#define _PTRDIFF_T_DECLARED
+ #ifndef __PTRDIFF_TYPE__
+ #define __PTRDIFF_TYPE__ long int
+ #endif
+ typedef __PTRDIFF_TYPE__ ptrdiff_t;
++#endif /* _PTRDIFF_T_DECLARED */
+ #endif /* _GCC_PTRDIFF_T */
+ #endif /* ___int_ptrdiff_t_h */
+ #endif /* _BSD_PTRDIFF_T_ */
+@@ -201,6 +213,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
+ #define _GCC_SIZE_T
+ #define _SIZET_
+ #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
++ || defined(__DragonFly__) \
+ || defined(__FreeBSD_kernel__)
+ /* __size_t is a typedef on FreeBSD 5, must not trash it. */
+ #else
+@@ -307,7 +320,7 @@ typedef _BSD_RUNE_T_ rune_t;
+ /* FreeBSD 5 can't be handled well using "traditional" logic above
+ since it no longer defines _BSD_RUNE_T_ yet still desires to export
+ rune_t in some cases... */
+-#if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
++#if defined (__DragonFly__) || (defined (__FreeBSD__) && (__FreeBSD__ >= 5))
+ #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
+ #if __BSD_VISIBLE
+ #ifndef _RUNE_T_DECLARED
diff --git a/gcc47/patches/patch-gcc_testsuite_g++.dg_eh_unwind-direct.C b/gcc47/patches/patch-gcc_testsuite_g++.dg_eh_unwind-direct.C
new file mode 100644
index 0000000..d8f0719
--- /dev/null
+++ b/gcc47/patches/patch-gcc_testsuite_g++.dg_eh_unwind-direct.C
@@ -0,0 +1,20 @@
+$NetBSD: patch-gcc_testsuite_g++.dg_eh_unwind-direct.C,v 1.1 2014/05/10 14:14:58 richard Exp $
+
+--- gcc/testsuite/g++.dg/eh/unwind-direct.C.orig 2014-01-18 17:52:15.019246553 +0000
++++ gcc/testsuite/g++.dg/eh/unwind-direct.C
+@@ -0,0 +1,15 @@
++// PR target/59788
++// { dg-do run { target { *-*-solaris2* && { ! gld } } } }
++// { dg-options "-Wl,-Bdirect" }
++
++#include <stdexcept>
++
++int
++main(void)
++{
++ try
++ { throw std::runtime_error( "Catch me if you can!"); }
++ catch(...)
++ { return 0; }
++ return 1;
++}
diff --git a/gcc47/patches/patch-include_libiberty.h b/gcc47/patches/patch-include_libiberty.h
new file mode 100644
index 0000000..95328d2
--- /dev/null
+++ b/gcc47/patches/patch-include_libiberty.h
@@ -0,0 +1,22 @@
+$NetBSD: patch-include_libiberty.h,v 1.1 2012/06/23 22:13:02 marino Exp $
+
+--- include/libiberty.h.orig 2011-09-28 19:04:30.000000000 +0000
++++ include/libiberty.h
+@@ -106,7 +106,16 @@ extern int countargv (char**);
+ to find the declaration so provide a fully prototyped one. If it
+ is 1, we found it so don't provide any declaration at all. */
+ #if !HAVE_DECL_BASENAME
+-#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME)
++#if defined (__GNU_LIBRARY__ ) \
++ || defined (__linux__) \
++ || defined (__DragonFly__) \
++ || defined (__FreeBSD__) \
++ || defined (__OpenBSD__) \
++ || defined (__NetBSD__) \
++ || defined (__CYGWIN__) \
++ || defined (__CYGWIN32__) \
++ || defined (__MINGW32__) \
++ || defined (HAVE_DECL_BASENAME)
+ extern char *basename (const char *);
+ #else
+ /* Do not allow basename to be used if there is no prototype seen. We
diff --git a/gcc47/patches/patch-libgcc_config.host b/gcc47/patches/patch-libgcc_config.host
new file mode 100644
index 0000000..a6af4df
--- /dev/null
+++ b/gcc47/patches/patch-libgcc_config.host
@@ -0,0 +1,47 @@
+$NetBSD: patch-libgcc_config.host,v 1.1 2012/06/23 22:13:02 marino Exp $
+
+--- libgcc/config.host.orig 2012-02-20 21:19:55.000000000 +0000
++++ libgcc/config.host
+@@ -174,6 +174,11 @@ case ${host} in
+ tmake_file="$tmake_file t-darwin ${cpu_type}/t-darwin t-libgcc-pic t-slibgcc-darwin"
+ extra_parts="crt3.o crttms.o crttme.o"
+ ;;
++*-*-dragonfly*)
++ 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"
++ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
++ ;;
+ *-*-freebsd*)
+ # This is the generic ELF configuration of FreeBSD. Later
+ # machine-specific sections may refine and add to this
+@@ -267,6 +272,7 @@ esac
+
+ case ${host} in
+ *-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd* | *-*-solaris2* | \
++ *-*-dragonfly* | \
+ alpha*-dec-osf5.1*)
+ enable_execute_stack=enable-execute-stack-mprotect.c
+ ;;
+@@ -523,6 +529,14 @@ i[34567]86-*-elf*)
+ x86_64-*-elf*)
+ tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
+ ;;
++i[34567]86-*-dragonfly*)
++ tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff"
++ md_unwind_header=i386/dragonfly-unwind.h
++ ;;
++x86_64-*-dragonfly*)
++ tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff"
++ md_unwind_header=i386/dragonfly-unwind.h
++ ;;
+ i[34567]86-*-freebsd*)
+ tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff"
+ ;;
+@@ -1156,6 +1170,7 @@ i[34567]86-*-darwin* | x86_64-*-darwin*
+ i[34567]86-*-gnu* | \
+ i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]* | \
+ i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw* | \
++ i[34567]86-*-dragonfly* | x86_64-*-dragonfly* | \
+ i[34567]86-*-freebsd* | x86_64-*-freebsd*)
+ tmake_file="${tmake_file} t-softfp-tf"
+ if test "${host_address}" = 32; then
diff --git a/gcc47/patches/patch-libgcc_config_i386_dragonfly-unwind.h b/gcc47/patches/patch-libgcc_config_i386_dragonfly-unwind.h
new file mode 100644
index 0000000..ec95c3e
--- /dev/null
+++ b/gcc47/patches/patch-libgcc_config_i386_dragonfly-unwind.h
@@ -0,0 +1,163 @@
+$NetBSD: patch-libgcc_config_i386_dragonfly-unwind.h,v 1.1 2012/06/23 22:13:02 marino Exp $
+
+--- libgcc/config/i386/dragonfly-unwind.h.orig 2012-06-22 10:35:29.000000000 +0000
++++ libgcc/config/i386/dragonfly-unwind.h
+@@ -0,0 +1,158 @@
++/* DWARF2 EH unwinding support for DragonFly BSD: AMD x86-64 and x86.
++ Copyright (C) 2010 John Marino <draco%marino.st@localhost> */
++
++/* Do code reading to identify a signal frame, and set the frame
++ state data appropriately. See unwind-dw2.c for the structs. */
++
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#include <signal.h>
++#include <sys/ucontext.h>
++#include <machine/sigframe.h>
++
++
++#define REG_NAME(reg) sf_uc.uc_mcontext.mc_## reg
++
++#ifdef __x86_64__
++#define MD_FALLBACK_FRAME_STATE_FOR x86_64_dragonfly_fallback_frame_state
++
++
++static void
++x86_64_sigtramp_range (unsigned char **start, unsigned char **end)
++{
++ unsigned long ps_strings;
++ int mib[2];
++ size_t len;
++
++ mib[0] = CTL_KERN;
++ mib[1] = KERN_PS_STRINGS;
++ len = sizeof (ps_strings);
++ sysctl (mib, 2, &ps_strings, &len, NULL, 0);
++
++ *start = (unsigned char *)ps_strings - 32;
++ *end = (unsigned char *)ps_strings;
++}
++
++
++static _Unwind_Reason_Code
++x86_64_dragonfly_fallback_frame_state
++(struct _Unwind_Context *context, _Unwind_FrameState *fs)
++{
++ unsigned char *pc = context->ra;
++ unsigned char *sigtramp_start, *sigtramp_end;
++ struct sigframe *sf;
++ long new_cfa;
++
++ x86_64_sigtramp_range(&sigtramp_start, &sigtramp_end);
++ if (pc >= sigtramp_end || pc < sigtramp_start)
++ return _URC_END_OF_STACK;
++
++ sf = (struct sigframe *) context->cfa;
++ new_cfa = sf->REG_NAME(rsp);
++ fs->regs.cfa_how = CFA_REG_OFFSET;
++ /* Register 7 is rsp */
++ fs->regs.cfa_reg = 7;
++ fs->regs.cfa_offset = new_cfa - (long) context->cfa;
++
++ /* The SVR4 register numbering macros aren't usable in libgcc. */
++ fs->regs.reg[0].how = REG_SAVED_OFFSET;
++ fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(rax) - new_cfa;
++ fs->regs.reg[1].how = REG_SAVED_OFFSET;
++ fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(rdx) - new_cfa;
++ fs->regs.reg[2].how = REG_SAVED_OFFSET;
++ fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(rcx) - new_cfa;
++ fs->regs.reg[3].how = REG_SAVED_OFFSET;
++ fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(rbx) - new_cfa;
++ fs->regs.reg[4].how = REG_SAVED_OFFSET;
++ fs->regs.reg[4].loc.offset = (long)&sf->REG_NAME(rsi) - new_cfa;
++ fs->regs.reg[5].how = REG_SAVED_OFFSET;
++ fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(rdi) - new_cfa;
++ fs->regs.reg[6].how = REG_SAVED_OFFSET;
++ fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(rbp) - new_cfa;
++ fs->regs.reg[8].how = REG_SAVED_OFFSET;
++ fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(r8) - new_cfa;
++ fs->regs.reg[9].how = REG_SAVED_OFFSET;
++ fs->regs.reg[9].loc.offset = (long)&sf->REG_NAME(r9) - new_cfa;
++ fs->regs.reg[10].how = REG_SAVED_OFFSET;
++ fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(r10) - new_cfa;
++ fs->regs.reg[11].how = REG_SAVED_OFFSET;
++ fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(r11) - new_cfa;
++ fs->regs.reg[12].how = REG_SAVED_OFFSET;
++ fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(r12) - new_cfa;
++ fs->regs.reg[13].how = REG_SAVED_OFFSET;
++ fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(r13) - new_cfa;
++ fs->regs.reg[14].how = REG_SAVED_OFFSET;
++ fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(r14) - new_cfa;
++ fs->regs.reg[15].how = REG_SAVED_OFFSET;
++ fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(r15) - new_cfa;
++ fs->regs.reg[16].how = REG_SAVED_OFFSET;
++ fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(rip) - new_cfa;
++ fs->retaddr_column = 16;
++ fs->signal_frame = 1;
++ return _URC_NO_REASON;
++}
++
++#else /* Next section is for i386 */
++
++#define MD_FALLBACK_FRAME_STATE_FOR x86_dragonfly_fallback_frame_state
++
++
++static void
++x86_sigtramp_range (unsigned char **start, unsigned char **end)
++{
++ unsigned long ps_strings;
++ int mib[2];
++ size_t len;
++
++ mib[0] = CTL_KERN;
++ mib[1] = KERN_PS_STRINGS;
++ len = sizeof (ps_strings);
++ sysctl (mib, 2, &ps_strings, &len, NULL, 0);
++
++ *start = (unsigned char *)ps_strings - 128;
++ *end = (unsigned char *)ps_strings;
++}
++
++
++static _Unwind_Reason_Code
++x86_dragonfly_fallback_frame_state
++(struct _Unwind_Context *context, _Unwind_FrameState *fs)
++{
++ unsigned char *pc = context->ra;
++ unsigned char *sigtramp_start, *sigtramp_end;
++ struct sigframe *sf;
++ long new_cfa;
++
++ x86_sigtramp_range(&sigtramp_start, &sigtramp_end);
++
++ if (pc >= sigtramp_end || pc < sigtramp_start)
++ return _URC_END_OF_STACK;
++
++ sf = (struct sigframe *) context->cfa;
++ new_cfa = sf->REG_NAME(esp);
++ fs->regs.cfa_how = CFA_REG_OFFSET;
++ fs->regs.cfa_reg = 4;
++ fs->regs.cfa_offset = new_cfa - (long) context->cfa;
++
++ /* The SVR4 register numbering macros aren't usable in libgcc. */
++ fs->regs.reg[0].how = REG_SAVED_OFFSET;
++ fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa;
++ fs->regs.reg[3].how = REG_SAVED_OFFSET;
++ fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa;
++ fs->regs.reg[1].how = REG_SAVED_OFFSET;
++ fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa;
++ fs->regs.reg[2].how = REG_SAVED_OFFSET;
++ fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa;
++ fs->regs.reg[6].how = REG_SAVED_OFFSET;
++ fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa;
++ fs->regs.reg[7].how = REG_SAVED_OFFSET;
++ fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa;
++ fs->regs.reg[5].how = REG_SAVED_OFFSET;
++ fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa;
++ fs->regs.reg[8].how = REG_SAVED_OFFSET;
++ fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa;
++ fs->retaddr_column = 8;
++ fs->signal_frame = 1;
++ return _URC_NO_REASON;
++}
++#endif /* ifdef __x86_64__ */
diff --git a/gcc47/patches/patch-libgcc_config_t-slibgcc-darwin b/gcc47/patches/patch-libgcc_config_t-slibgcc-darwin
new file mode 100644
index 0000000..a596bfb
--- /dev/null
+++ b/gcc47/patches/patch-libgcc_config_t-slibgcc-darwin
@@ -0,0 +1,26 @@
+$NetBSD: patch-libgcc_config_t-slibgcc-darwin,v 1.1 2014/05/20 01:59:05 pho Exp $
+
+If we don't install libgcc_s.10.[45].dylib, our gcc links binaries
+with *both* /usr/lib/libgcc_s.1.dylib and
+${GCC_PREFIX}/lib/libgcc_s.1.dylib, which is certainly a bad thing.
+
+The problem was already reported to the upstream but it caught
+seemingly no attention:
+http://gcc.gnu.org/ml/gcc-help/2010-07/msg00164.html
+
+--- libgcc/config/t-slibgcc-darwin.orig 2011-11-02 10:49:46.000000000 +0000
++++ libgcc/config/t-slibgcc-darwin
+@@ -27,13 +27,7 @@ SHLIB_MKMAP_OPTS = -v leading_underscore
+ SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/libgcc-libsystem.ver
+ SHLIB_VERPFX = $(srcdir)/config/$(cpu_type)/libgcc-darwin
+
+-# we're only going to build the stubs if the target slib is /usr/lib
+-# there is no other case in which they're useful in a live system.
+-ifeq (/usr/lib,$(shlib_slibdir))
+ LGCC_STUBS = libgcc_s.10.4.dylib libgcc_s.10.5.dylib
+-else
+-LGCC_STUBS =
+-endif
+
+ LGCC_FILES = libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)
+ LGCC_FILES += $(LGCC_STUBS)
diff --git a/gcc47/patches/patch-libgcc_config_t-slibgcc-sld b/gcc47/patches/patch-libgcc_config_t-slibgcc-sld
new file mode 100644
index 0000000..b7cd4f2
--- /dev/null
+++ b/gcc47/patches/patch-libgcc_config_t-slibgcc-sld
@@ -0,0 +1,28 @@
+$NetBSD: patch-libgcc_config_t-slibgcc-sld,v 1.1 2014/05/10 14:14:58 richard Exp $
+
+--- libgcc/config/t-slibgcc-sld.orig 2011-06-01 14:39:17.000000000 +0000
++++ libgcc/config/t-slibgcc-sld
+@@ -3,3 +3,23 @@
+
+ SHLIB_LDFLAGS = -Wl,-h,$(SHLIB_SONAME) -Wl,-z,text -Wl,-z,defs \
+ -Wl,-M,$(SHLIB_MAP)
++
++# Linker mapfile to enforce direct binding to libgcc_s unwinder
++# (PR target/59788).
++libgcc-unwind.map: libgcc-std.ver
++ @(echo "{"; \
++ for f in `grep _Unwind_ $< | sort`; do \
++ echo " $$f = EXTERN DIRECT;"; \
++ done; \
++ echo "};" ) > $@
++
++# Copy libgcc-unwind.map to the place where gcc will look for it at build-time.
++install-libgcc-unwind-map-forbuild: libgcc-unwind.map
++ $(INSTALL_DATA) $< $(gcc_objdir)
++
++all: install-libgcc-unwind-map-forbuild
++
++install-libgcc-unwind-map: libgcc-unwind.map
++ $(INSTALL_DATA) $< $(DESTDIR)$(slibdir)
++
++install: install-libgcc-unwind-map
diff --git a/gcc47/patches/patch-libgcc_crtstuff.c b/gcc47/patches/patch-libgcc_crtstuff.c
new file mode 100644
index 0000000..ee6e2fb
--- /dev/null
+++ b/gcc47/patches/patch-libgcc_crtstuff.c
@@ -0,0 +1,29 @@
+$NetBSD: patch-libgcc_crtstuff.c,v 1.1 2012/06/23 22:13:02 marino Exp $
+
+Currently dl_iterate_phdr error handling is hardcoded for FreeBSD 7+
+Expand code to handle all BSDs even though detection is only active for
+FreeBSD and DragonFly currently.
+
+--- libgcc/crtstuff.c.orig 2011-12-06 21:35:41.000000000 +0000
++++ libgcc/crtstuff.c
+@@ -81,11 +81,19 @@ call_ ## FUNC (void) \
+ }
+ #endif
+
++#if defined(TARGET_DL_ITERATE_PHDR) && \
++ ( defined(__FreeBSD__) \
++ || defined(__OpenBSD__) \
++ || defined(__NetBSD__) \
++ || defined(__DragonFly__))
++#define BSD_DL_ITERATE_PHDR_AVAILABLE
++#endif
++
+ #if defined(OBJECT_FORMAT_ELF) \
+ && !defined(OBJECT_FORMAT_FLAT) \
+ && defined(HAVE_LD_EH_FRAME_HDR) \
+ && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
+- && defined(__FreeBSD__) && __FreeBSD__ >= 7
++ && defined(BSD_DL_ITERATE_PHDR_AVAILABLE)
+ #include <link.h>
+ # define USE_PT_GNU_EH_FRAME
+ #endif
diff --git a/gcc47/patches/patch-libgcc_unwind-dw2-fde-dip.c b/gcc47/patches/patch-libgcc_unwind-dw2-fde-dip.c
new file mode 100644
index 0000000..6d31295
--- /dev/null
+++ b/gcc47/patches/patch-libgcc_unwind-dw2-fde-dip.c
@@ -0,0 +1,26 @@
+$NetBSD: patch-libgcc_unwind-dw2-fde-dip.c,v 1.2 2013/04/24 14:31:51 adam Exp $
+
+Add dl_iterate_phdr error handling support for all BSDs. The NetBSD and
+OpenBSD code will not run until dl_iterate_phdr detection in the configure
+script is uncommented.
+
+--- libgcc/unwind-dw2-fde-dip.c.orig 2012-10-06 21:55:06.000000000 +0000
++++ libgcc/unwind-dw2-fde-dip.c
+@@ -54,13 +54,15 @@
+ #endif
+
+ #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+- && defined(__FreeBSD__) && __FreeBSD__ >= 7
++ && defined(TARGET_DL_ITERATE_PHDR) \
++ && (defined(__FreeBSD__) || defined(__DragonFly__))
+ # define ElfW __ElfN
+ # define USE_PT_GNU_EH_FRAME
+ #endif
+
+ #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+- && defined(__OpenBSD__)
++ && defined(TARGET_DL_ITERATE_PHDR) \
++ && (defined(__OpenBSD__) || defined(__NetBSD__))
+ # define ElfW(type) Elf_##type
+ # define USE_PT_GNU_EH_FRAME
+ #endif
diff --git a/gcc47/patches/patch-libgfortran_configure b/gcc47/patches/patch-libgfortran_configure
new file mode 100644
index 0000000..2b3dc5b
--- /dev/null
+++ b/gcc47/patches/patch-libgfortran_configure
@@ -0,0 +1,15 @@
+$NetBSD: patch-libgfortran_configure,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+"#pragma weak" shouldn't be used on NetBSD.
+
+--- libgfortran/configure.orig 2012-03-22 07:37:39.000000000 +0000
++++ libgfortran/configure
+@@ -25564,7 +25564,7 @@ $as_echo "#define SUPPORTS_WEAK 1" >>con
+
+ fi
+ case "$host" in
+- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | alpha*-dec-osf* )
++ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | alpha*-dec-osf* | *-*-netbsd* )
+
+ $as_echo "#define GTHREAD_USE_WEAK 0" >>confdefs.h
+
diff --git a/gcc47/patches/patch-libgo_Makefile.in b/gcc47/patches/patch-libgo_Makefile.in
new file mode 100644
index 0000000..a78be86
--- /dev/null
+++ b/gcc47/patches/patch-libgo_Makefile.in
@@ -0,0 +1,17 @@
+$NetBSD: patch-libgo_Makefile.in,v 1.2 2012/12/01 02:29:32 sbd Exp $
+
+proc.c will not compile with inline-functions (implied by -O3)
+so add -fno-inline-functions to it's cflags.
+
+
+--- libgo/Makefile.in.orig 2012-08-06 14:34:27.000000000 +0000
++++ libgo/Makefile.in
+@@ -3051,7 +3051,7 @@ print.lo: runtime/print.c
+ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o print.lo `test -f 'runtime/print.c' || echo '$(srcdir)/'`runtime/print.c
+
+ proc.lo: runtime/proc.c
+-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT proc.lo -MD -MP -MF $(DEPDIR)/proc.Tpo -c -o proc.lo `test -f 'runtime/proc.c' || echo '$(srcdir)/'`runtime/proc.c
++@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) -fno-inline-functions $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT proc.lo -MD -MP -MF $(DEPDIR)/proc.Tpo -c -o proc.lo `test -f 'runtime/proc.c' || echo '$(srcdir)/'`runtime/proc.c
+ @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/proc.Tpo $(DEPDIR)/proc.Plo
+ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/proc.c' object='proc.lo' libtool=yes @AMDEPBACKSLASH@
+ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
diff --git a/gcc47/patches/patch-libgo_config_ltmain.sh b/gcc47/patches/patch-libgo_config_ltmain.sh
new file mode 100644
index 0000000..f5d44ad
--- /dev/null
+++ b/gcc47/patches/patch-libgo_config_ltmain.sh
@@ -0,0 +1,13 @@
+$NetBSD: patch-libgo_config_ltmain.sh,v 1.1 2014/05/10 14:14:58 richard Exp $
+
+--- libgo/config/ltmain.sh.orig 2010-11-12 20:52:54.000000000 +0000
++++ libgo/config/ltmain.sh
+@@ -976,7 +976,7 @@ func_enable_tag ()
+
+
+ case $host in
+- *cygwin* | *mingw* | *pw32* | *cegcc*)
++ *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* )
+ # don't eliminate duplications in $postdeps and $predeps
+ opt_duplicate_compiler_generated_deps=:
+ ;;
diff --git a/gcc47/patches/patch-libgo_runtime_proc.c b/gcc47/patches/patch-libgo_runtime_proc.c
new file mode 100644
index 0000000..18c20d7
--- /dev/null
+++ b/gcc47/patches/patch-libgo_runtime_proc.c
@@ -0,0 +1,17 @@
+$NetBSD: patch-libgo_runtime_proc.c,v 1.1 2013/04/02 09:57:52 jperkin Exp $
+
+SunOS libelf does not support largefile.
+
+--- libgo/runtime/proc.c.orig 2012-07-26 01:57:22.000000000 +0000
++++ libgo/runtime/proc.c
+@@ -10,6 +10,10 @@
+ #include "config.h"
+
+ #ifdef HAVE_DL_ITERATE_PHDR
++#ifdef __sun
++#undef _FILE_OFFSET_BITS
++#define _FILE_OFFSET_BITS 32
++#endif
+ #include <link.h>
+ #endif
+
diff --git a/gcc47/patches/patch-libiberty_Makefile.in b/gcc47/patches/patch-libiberty_Makefile.in
new file mode 100644
index 0000000..881c796
--- /dev/null
+++ b/gcc47/patches/patch-libiberty_Makefile.in
@@ -0,0 +1,18 @@
+$NetBSD: patch-libiberty_Makefile.in,v 1.1 2015/06/19 09:05:11 jperkin Exp $
+
+The ${PREFIX}/include/ansidecl.h installed by devel/binutils is not
+necessarily compatible (E.g. binutils-2.25 does not define PARAMS). Adjust
+the include path priority so the internal ansidecl.h gets precedence, allowing
+cp-demangle.c to use libiberty.h without compilation errors.
+
+--- libiberty/Makefile.in.orig 2012-08-06 14:34:27.000000000 +0000
++++ libiberty/Makefile.in
+@@ -112,7 +112,7 @@ installcheck: installcheck-subdir
+
+ INCDIR=$(srcdir)/$(MULTISRCTOP)../include
+
+-COMPILE.c = $(CC) -c @DEFS@ $(CFLAGS) $(CPPFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@
++COMPILE.c = $(CC) -c @DEFS@ -I. -I$(INCDIR) $(CFLAGS) $(CPPFLAGS) $(HDEFINES) @ac_libiberty_warn_cflags@
+
+ # Just to make sure we don't use a built-in rule with VPATH
+ .c.$(objext):
diff --git a/gcc47/patches/patch-libjava_Makefile.in b/gcc47/patches/patch-libjava_Makefile.in
new file mode 100644
index 0000000..2ad72a9
--- /dev/null
+++ b/gcc47/patches/patch-libjava_Makefile.in
@@ -0,0 +1,16 @@
+$NetBSD: patch-libjava_Makefile.in,v 1.1 2014/05/20 01:59:05 pho Exp $
+
+Tell libtool the fact that libjvm.so is a module to be opened with
+dlopen(3). This is actually needed on Mach-O systems like Darwin.
+
+--- libjava/Makefile.in.orig 2013-04-11 07:59:02.000000000 +0000
++++ libjava/Makefile.in
+@@ -1121,7 +1121,7 @@ libgcj_tools_la_LINK = $(LIBLINK) $(libg
+ libjvm_la_SOURCES = jni-libjvm.cc
+ libjvm_la_DEPENDENCIES = libgcj.la libgcj.spec $(am__append_20)
+ libjvm_la_LIBADD = -L$(here)/.libs libgcj.la
+-libjvm_la_LDFLAGS = -avoid-version $(LIBGCJ_LD_SYMBOLIC) \
++libjvm_la_LDFLAGS = -avoid-version -module $(LIBGCJ_LD_SYMBOLIC) \
+ $(LIBJAVA_LDFLAGS_NOUNDEF)
+
+ libjvm_la_LINK = $(CXXLINK) $(libjvm_la_LDFLAGS)
diff --git a/gcc47/patches/patch-libjava_boehm.cc b/gcc47/patches/patch-libjava_boehm.cc
new file mode 100644
index 0000000..45e3fd5
--- /dev/null
+++ b/gcc47/patches/patch-libjava_boehm.cc
@@ -0,0 +1,27 @@
+$NetBSD: patch-libjava_boehm.cc,v 1.1 2012/04/30 09:12:28 sbd Exp $
+
+Disable GC_register_my_thread and GC_unregister_my_thread on NetBSD as
+the version of boehm-gc bundled with gcc does not support NetBSD threads.
+
+--- libjava/boehm.cc.orig 2007-10-22 21:24:35.000000000 +0000
++++ libjava/boehm.cc
+@@ -747,7 +747,8 @@ _Jv_GCAttachThread ()
+ // The registration interface is only defined on posixy systems and
+ // only actually works if pthread_getattr_np is defined.
+ // FIXME: until gc7 it is simpler to disable this on solaris.
+-#if defined(HAVE_PTHREAD_GETATTR_NP) && !defined(GC_SOLARIS_THREADS)
++#if defined(HAVE_PTHREAD_GETATTR_NP) && !defined(GC_SOLARIS_THREADS) \
++ && !defined(__NetBSD__)
+ GC_register_my_thread ();
+ #endif
+ }
+@@ -755,7 +756,8 @@ _Jv_GCAttachThread ()
+ void
+ _Jv_GCDetachThread ()
+ {
+-#if defined(HAVE_PTHREAD_GETATTR_NP) && !defined(GC_SOLARIS_THREADS)
++#if defined(HAVE_PTHREAD_GETATTR_NP) && !defined(GC_SOLARIS_THREADS) \
++ && !defined(__NetBSD__)
+ GC_unregister_my_thread ();
+ #endif
+ }
diff --git a/gcc47/patches/patch-libjava_configure b/gcc47/patches/patch-libjava_configure
new file mode 100644
index 0000000..29f1f23
--- /dev/null
+++ b/gcc47/patches/patch-libjava_configure
@@ -0,0 +1,17 @@
+$NetBSD: patch-libjava_configure,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+Avoid a reference to the wrapped make in the pkgsrc work directory from
+showing up in an installed file.
+See: libjava/contrib/aotcompile.py.in
+
+--- libjava/configure.orig 2012-03-22 07:37:39.000000000 +0000
++++ libjava/configure
+@@ -24692,7 +24692,7 @@ $as_echo "Python modules dir: ${python_m
+
+
+ # needed for aot-compile-rpm
+-MAKE=`which make`
++MAKE=${PKGSRC_MAKE}
+
+
+ # Check whether --enable-aot-compile-rpm was given.
diff --git a/gcc47/patches/patch-libjava_contrib_rebuild-gcj-db.in b/gcc47/patches/patch-libjava_contrib_rebuild-gcj-db.in
new file mode 100644
index 0000000..bd3f5c0
--- /dev/null
+++ b/gcc47/patches/patch-libjava_contrib_rebuild-gcj-db.in
@@ -0,0 +1,29 @@
+$NetBSD: patch-libjava_contrib_rebuild-gcj-db.in,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+No need to use bash for this small script.
+
+Also -print0 is not portable to solaris and perhaps others.
+
+--- libjava/contrib/rebuild-gcj-db.in.orig 2008-07-02 13:17:54.000000000 +0000
++++ libjava/contrib/rebuild-gcj-db.in
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # rebuild-gcj-db
+
+ ## Copyright (C) 2000, 2002, 2003, 2008 Free Software Foundation
+@@ -16,12 +16,12 @@ for i in `@prefix@/bin/gcc --print-multi
+ base=@prefix@/lib/$dirname
+ dbLocation=`@prefix@/bin/gcj-dbtool -p $base`
+ libdir=$base/gcj
+- if ! test -d $libdir; then
++ if test ! -d $libdir; then
+ # No shared libraries here.
+ continue
+ fi
+ dirname $dbLocation | xargs mkdir -p
+ @prefix@/bin/gcj-dbtool -n $dbLocation 64
+- find $libdir -follow -name '*.db' -print0 | \
++ find $libdir -follow -name '*.db' -print | @AWK@ '{printf("%s%c", $1, 0);}'|\
+ @prefix@/bin/gcj-dbtool -0 -m $dbLocation $dbLocation
+ done
diff --git a/gcc47/patches/patch-libstdc++-v3_config_locale_dragonfly_c__locale.cc b/gcc47/patches/patch-libstdc++-v3_config_locale_dragonfly_c__locale.cc
new file mode 100644
index 0000000..2815686
--- /dev/null
+++ b/gcc47/patches/patch-libstdc++-v3_config_locale_dragonfly_c__locale.cc
@@ -0,0 +1,305 @@
+$NetBSD: patch-libstdc++-v3_config_locale_dragonfly_c__locale.cc,v 1.1 2012/06/23 22:13:02 marino Exp $
+
+--- libstdc++-v3/config/locale/dragonfly/c_locale.cc.orig 2012-06-22 10:35:30.000000000 +0000
++++ libstdc++-v3/config/locale/dragonfly/c_locale.cc
+@@ -0,0 +1,300 @@
++// Wrapper for underlying C-language localization -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
++// Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 3, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// 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/>.
++
++//
++// ISO C++ 14882: 22.8 Standard locale categories.
++//
++
++// Written by Benjamin Kosnik <bkoz%redhat.com@localhost>
++
++#include <cerrno> // For errno
++#include <cmath> // For isinf, finite, finitef, fabs
++#include <cstdlib> // For strof, strtold
++#include <cstring>
++#include <cstdio>
++#include <locale>
++#include <limits>
++
++#ifdef _GLIBCXX_HAVE_IEEEFP_H
++#include <ieeefp.h>
++#endif
++
++namespace std _GLIBCXX_VISIBILITY(default)
++{
++_GLIBCXX_BEGIN_NAMESPACE_VERSION
++
++ template<>
++ void
++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
++ const __c_locale&) throw()
++ {
++ // Assumes __s formatted for "C" locale.
++ char* __old = setlocale(LC_ALL, 0);
++ const size_t __len = strlen(__old) + 1;
++ char* __sav = new char[__len];
++ memcpy(__sav, __old, __len);
++ setlocale(LC_ALL, "C");
++ char* __sanity;
++ bool __overflow = false;
++
++#if !__FLT_HAS_INFINITY__
++ errno = 0;
++#endif
++
++#ifdef _GLIBCXX_HAVE_STRTOF
++ __v = strtof(__s, &__sanity);
++#else
++ double __d = strtod(__s, &__sanity);
++ __v = static_cast<float>(__d);
++#ifdef _GLIBCXX_HAVE_FINITEF
++ if (!finitef (__v))
++ __overflow = true;
++#elif defined (_GLIBCXX_HAVE_FINITE)
++ if (!finite (static_cast<double> (__v)))
++ __overflow = true;
++#elif defined (_GLIBCXX_HAVE_ISINF)
++ if (isinf (static_cast<double> (__v)))
++ __overflow = true;
++#else
++ if (fabs(__d) > numeric_limits<float>::max())
++ __overflow = true;
++#endif
++#endif // _GLIBCXX_HAVE_STRTOF
++
++ // _GLIBCXX_RESOLVE_LIB_DEFECTS
++ // 23. Num_get overflow result.
++ if (__sanity == __s || *__sanity != '\0')
++ {
++ __v = 0.0f;
++ __err = ios_base::failbit;
++ }
++ else if (__overflow
++#if __FLT_HAS_INFINITY__
++ || __v == numeric_limits<float>::infinity()
++ || __v == -numeric_limits<float>::infinity()
++#else
++ || ((__v > 1.0f || __v < -1.0f) && errno == ERANGE)
++#endif
++ )
++ {
++ if (__v > 0.0f)
++ __v = numeric_limits<float>::max();
++ else
++ __v = -numeric_limits<float>::max();
++ __err = ios_base::failbit;
++ }
++
++ setlocale(LC_ALL, __sav);
++ delete [] __sav;
++ }
++
++ template<>
++ void
++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
++ const __c_locale&) throw()
++ {
++ // Assumes __s formatted for "C" locale.
++ char* __old = setlocale(LC_ALL, 0);
++ const size_t __len = strlen(__old) + 1;
++ char* __sav = new char[__len];
++ memcpy(__sav, __old, __len);
++ setlocale(LC_ALL, "C");
++ char* __sanity;
++
++#if !__DBL_HAS_INFINITY__
++ errno = 0;
++#endif
++
++ __v = strtod(__s, &__sanity);
++
++ // _GLIBCXX_RESOLVE_LIB_DEFECTS
++ // 23. Num_get overflow result.
++ if (__sanity == __s || *__sanity != '\0')
++ {
++ __v = 0.0;
++ __err = ios_base::failbit;
++ }
++ else if (
++#if __DBL_HAS_INFINITY__
++ __v == numeric_limits<double>::infinity()
++ || __v == -numeric_limits<double>::infinity())
++#else
++ (__v > 1.0 || __v < -1.0) && errno == ERANGE)
++#endif
++ {
++ if (__v > 0.0)
++ __v = numeric_limits<double>::max();
++ else
++ __v = -numeric_limits<double>::max();
++ __err = ios_base::failbit;
++ }
++
++ setlocale(LC_ALL, __sav);
++ delete [] __sav;
++ }
++
++ template<>
++ void
++ __convert_to_v(const char* __s, long double& __v,
++ ios_base::iostate& __err, const __c_locale&) throw()
++ {
++ // Assumes __s formatted for "C" locale.
++ char* __old = setlocale(LC_ALL, 0);
++ const size_t __len = strlen(__old) + 1;
++ char* __sav = new char[__len];
++ memcpy(__sav, __old, __len);
++ setlocale(LC_ALL, "C");
++
++#if !__LDBL_HAS_INFINITY__
++ errno = 0;
++#endif
++
++#if defined(_GLIBCXX_HAVE_STRTOLD) && !defined(_GLIBCXX_HAVE_BROKEN_STRTOLD)
++ char* __sanity;
++ __v = strtold(__s, &__sanity);
++
++ // _GLIBCXX_RESOLVE_LIB_DEFECTS
++ // 23. Num_get overflow result.
++ if (__sanity == __s || *__sanity != '\0')
++#else
++ typedef char_traits<char>::int_type int_type;
++ int __p = sscanf(__s, "%Lf", &__v);
++
++ if (!__p || static_cast<int_type>(__p) == char_traits<char>::eof())
++#endif
++ {
++ __v = 0.0l;
++ __err = ios_base::failbit;
++ }
++ else if (
++#if __LDBL_HAS_INFINITY__
++ __v == numeric_limits<long double>::infinity()
++ || __v == -numeric_limits<long double>::infinity())
++#else
++ (__v > 1.0l || __v < -1.0l) && errno == ERANGE)
++#endif
++ {
++ if (__v > 0.0l)
++ __v = numeric_limits<long double>::max();
++ else
++ __v = -numeric_limits<long double>::max();
++ __err = ios_base::failbit;
++ }
++
++ setlocale(LC_ALL, __sav);
++ delete [] __sav;
++ }
++
++
++ /* DragonFly's implementation of setlocale won't accept something like
++ "de_DE". According to nls manpage, the expected format is:
++ language[_territory][.codeset][@modifier], but it seems that both
++ the _territory and .codeset components are required.
++
++ As an attempt to correct for this, we'll tack on ".UTF-8" if
++ a period is not detected in the locale string.
++
++ There are no locales with modifiers on DragonFly so if found, they
++ will just be stripped off silently. e.g "de_DE@euro" will be reduced
++ to "de_DE". The UTF-8 default would be added after that.
++ */
++
++ void
++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
++ __c_locale)
++ {
++ const size_t size__s = (__s == NULL) ? 1 : strlen (__s);
++ const char UTF8[] = ".UTF-8";
++ char localspec[size__s + 6 + 1];
++
++ if (__s == NULL) {
++ localspec[0] = NULL;
++ } else {
++ strcpy (localspec, __s);
++ char * pch = strchr (localspec, '@');
++ if (pch != NULL)
++ *pch = 0;
++
++ if ( (strchr (__s, '.') == NULL)
++ && (strcmp (__s, "C") != 0)
++ && (strcmp (__s, "POSIX") != 0))
++ strncat (localspec, UTF8, 6);
++ }
++
++ const char * result = std::setlocale(LC_ALL, localspec);
++
++ if ((strcmp(result, "C") != 0) && (strcmp (result, localspec) != 0))
++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
++ "name not valid"));
++ __cloc = 0;
++ }
++
++ void
++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
++ { __cloc = 0; }
++
++ __c_locale
++ locale::facet::_S_clone_c_locale(__c_locale&) throw()
++ { return __c_locale(); }
++
++ __c_locale
++ locale::facet::_S_lc_ctype_c_locale(__c_locale, const char*)
++ { return __c_locale(); }
++
++_GLIBCXX_END_NAMESPACE_VERSION
++} // namespace
++
++namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
++{
++_GLIBCXX_BEGIN_NAMESPACE_VERSION
++
++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
++ {
++ "LC_CTYPE",
++ "LC_NUMERIC",
++ "LC_TIME",
++ "LC_COLLATE",
++ "LC_MONETARY",
++ "LC_MESSAGES"
++ };
++
++_GLIBCXX_END_NAMESPACE_VERSION
++} // namespace
++
++namespace std _GLIBCXX_VISIBILITY(default)
++{
++_GLIBCXX_BEGIN_NAMESPACE_VERSION
++
++ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
++
++_GLIBCXX_END_NAMESPACE_VERSION
++} // namespace
++
++// XXX GLIBCXX_ABI Deprecated
++#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
++#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
++ extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
++_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi);
++#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
diff --git a/gcc47/patches/patch-libstdc++-v3_config_locale_dragonfly_ctype__members.cc b/gcc47/patches/patch-libstdc++-v3_config_locale_dragonfly_ctype__members.cc
new file mode 100644
index 0000000..814736d
--- /dev/null
+++ b/gcc47/patches/patch-libstdc++-v3_config_locale_dragonfly_ctype__members.cc
@@ -0,0 +1,179 @@
+$NetBSD: patch-libstdc++-v3_config_locale_dragonfly_ctype__members.cc,v 1.1 2012/06/23 22:13:02 marino Exp $
+
+--- libstdc++-v3/config/locale/dragonfly/ctype_members.cc.orig 2012-06-22 11:15:15.000000000 +0000
++++ libstdc++-v3/config/locale/dragonfly/ctype_members.cc
+@@ -0,0 +1,174 @@
++// std::ctype implementation details, GNU version -*- C++ -*-
++
++// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
++// Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 3, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// 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/>.
++
++//
++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
++//
++
++// Written by Benjamin Kosnik <bkoz%redhat.com@localhost>
++
++#include <locale>
++#include <bits/c++locale_internal.h>
++#include <cstdlib>
++#include <cstring>
++#include <cstdio>
++
++namespace std _GLIBCXX_VISIBILITY(default)
++{
++ // NB: The other ctype<char> specializations are in src/locale.cc and
++ // various /config/os/* files.
++
++ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
++ : ctype<char>(0, false, __refs)
++ {
++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
++ {
++ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
++ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
++ }
++ }
++
++ ctype_byname<char>::~ctype_byname()
++ { }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++ ctype<wchar_t>::__wmask_type
++ ctype<wchar_t>::_M_convert_to_wmask(
++ const mask __attribute__((__unused__)) __m) const throw()
++ {
++ // DragonFly uses the same codes for 'char' as 'wchar_t', so this routine
++ // never gets called.
++ return __wmask_type();
++ };
++
++ wchar_t
++ ctype<wchar_t>::do_toupper(wchar_t __c) const
++ { return towupper(__c); }
++
++ const wchar_t*
++ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
++ {
++ while (__lo < __hi)
++ {
++ *__lo = towupper(*__lo);
++ ++__lo;
++ }
++ return __hi;
++ }
++
++ wchar_t
++ ctype<wchar_t>::do_tolower(wchar_t __c) const
++ { return towlower(__c); }
++
++ const wchar_t*
++ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
++ {
++ while (__lo < __hi)
++ {
++ *__lo = towlower(*__lo);
++ ++__lo;
++ }
++ return __hi;
++ }
++
++ wchar_t
++ ctype<wchar_t>::
++ do_widen(char __c) const
++ { return _M_widen[static_cast<unsigned char>(__c)]; }
++
++ const char*
++ ctype<wchar_t>::
++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
++ {
++ while (__lo < __hi)
++ {
++ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
++ ++__lo;
++ ++__dest;
++ }
++ return __hi;
++ }
++
++ char
++ ctype<wchar_t>::
++ do_narrow(wchar_t __wc, char __dfault) const
++ {
++ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
++ return _M_narrow[__wc];
++ const int __c = wctob(__wc);
++ return (__c == EOF ? __dfault : static_cast<char>(__c));
++ }
++
++ const wchar_t*
++ ctype<wchar_t>::
++ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
++ char* __dest) const
++ {
++ if (_M_narrow_ok)
++ while (__lo < __hi)
++ {
++ if (*__lo >= 0 && *__lo < 128)
++ *__dest = _M_narrow[*__lo];
++ else
++ {
++ const int __c = wctob(*__lo);
++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
++ }
++ ++__lo;
++ ++__dest;
++ }
++ else
++ while (__lo < __hi)
++ {
++ const int __c = wctob(*__lo);
++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
++ ++__lo;
++ ++__dest;
++ }
++ return __hi;
++ }
++
++ void
++ ctype<wchar_t>::_M_initialize_ctype() throw()
++ {
++ wint_t __i;
++ for (__i = 0; __i < 128; ++__i)
++ {
++ const int __c = wctob(__i);
++ if (__c == EOF)
++ break;
++ else
++ _M_narrow[__i] = static_cast<char>(__c);
++ }
++ if (__i == 128)
++ _M_narrow_ok = true;
++ else
++ _M_narrow_ok = false;
++ for (size_t __i = 0;
++ __i < sizeof(_M_widen) / sizeof(wint_t); ++__i)
++ _M_widen[__i] = btowc(__i);
++ }
++#endif // _GLIBCXX_USE_WCHAR_T
++}
diff --git a/gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__base.h b/gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__base.h
new file mode 100644
index 0000000..6861c74
--- /dev/null
+++ b/gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__base.h
@@ -0,0 +1,65 @@
+$NetBSD: patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__base.h,v 1.2 2013/01/31 20:07:17 marino Exp $
+
+--- libstdc++-v3/config/os/bsd/dragonfly/ctype_base.h.orig 2012-06-22 10:35:30.000000000 +0000
++++ libstdc++-v3/config/os/bsd/dragonfly/ctype_base.h
+@@ -0,0 +1,60 @@
++// Locale support -*- C++ -*-
++
++// Copyright (C) 2000, 2003, 2009, 2010 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 3, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// 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/>.
++
++//
++// ISO C++ 14882: 22.1 Locales
++//
++
++// Information as gleaned from /usr/include/ctype.h on DragonFly.
++// Full details can be found from git repo at:
++// http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/include/ctype.h
++
++namespace std _GLIBCXX_VISIBILITY(default)
++{
++_GLIBCXX_BEGIN_NAMESPACE_VERSION
++
++ /// @brief Base class for ctype.
++ struct ctype_base
++ {
++ // Non-standard typedefs.
++ typedef const int* __to_type;
++
++ // NB: Offsets into ctype<char>::_M_table force a particular size
++ // on the mask type. Because of this, we don't use an enum.
++ typedef uint16_t mask;
++ static const mask upper = _CTYPEMASK_U;
++ static const mask lower = _CTYPEMASK_L;
++ static const mask alpha = _CTYPEMASK_A;
++ static const mask digit = _CTYPEMASK_D;
++ static const mask xdigit = _CTYPEMASK_X;
++ static const mask space = _CTYPEMASK_S;
++ static const mask print = _CTYPEMASK_R;
++ static const mask graph = _CTYPEMASK_G;
++ static const mask cntrl = _CTYPEMASK_C;
++ static const mask punct = _CTYPEMASK_P;
++ static const mask alnum = _CTYPEMASK_A | _CTYPEMASK_D;
++ };
++
++_GLIBCXX_END_NAMESPACE_VERSION
++} // namespace
diff --git a/gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__configure__char.cc b/gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__configure__char.cc
new file mode 100644
index 0000000..2c32ed6
--- /dev/null
+++ b/gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__configure__char.cc
@@ -0,0 +1,104 @@
+$NetBSD: patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__configure__char.cc,v 1.1 2012/06/23 22:13:02 marino Exp $
+
+--- libstdc++-v3/config/os/bsd/dragonfly/ctype_configure_char.cc.orig 2012-06-22 10:35:30.000000000 +0000
++++ libstdc++-v3/config/os/bsd/dragonfly/ctype_configure_char.cc
+@@ -0,0 +1,99 @@
++// Locale support -*- C++ -*-
++
++// Copyright (C) 2011 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 3, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// 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/>.
++
++/** @file ctype_configure_char.cc */
++
++//
++// ISO C++ 14882: 22.1 Locales
++//
++
++#include <locale>
++#include <cstdlib>
++#include <cstring>
++
++namespace std _GLIBCXX_VISIBILITY(default)
++{
++_GLIBCXX_BEGIN_NAMESPACE_VERSION
++
++// Information as gleaned from /usr/include/ctype.h
++
++ const ctype_base::mask*
++ ctype<char>::classic_table() throw()
++ { return 0; }
++
++ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
++ size_t __refs)
++ : facet(__refs), _M_del(__table != 0 && __del),
++ _M_toupper(NULL), _M_tolower(NULL),
++ _M_table(__table ? __table : classic_table())
++ {
++ memset(_M_widen, 0, sizeof(_M_widen));
++ _M_widen_ok = 0;
++ memset(_M_narrow, 0, sizeof(_M_narrow));
++ _M_narrow_ok = 0;
++ }
++
++ ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
++ : facet(__refs), _M_del(__table != 0 && __del),
++ _M_toupper(NULL), _M_tolower(NULL),
++ _M_table(__table ? __table : classic_table())
++ {
++ memset(_M_widen, 0, sizeof(_M_widen));
++ _M_widen_ok = 0;
++ memset(_M_narrow, 0, sizeof(_M_narrow));
++ _M_narrow_ok = 0;
++ }
++
++ char
++ ctype<char>::do_toupper(char __c) const
++ { return ::toupper((int) __c); }
++
++ const char*
++ ctype<char>::do_toupper(char* __low, const char* __high) const
++ {
++ while (__low < __high)
++ {
++ *__low = ::toupper((int) *__low);
++ ++__low;
++ }
++ return __high;
++ }
++
++ char
++ ctype<char>::do_tolower(char __c) const
++ { return ::tolower((int) __c); }
++
++ const char*
++ ctype<char>::do_tolower(char* __low, const char* __high) const
++ {
++ while (__low < __high)
++ {
++ *__low = ::tolower((int) *__low);
++ ++__low;
++ }
++ return __high;
++ }
++
++_GLIBCXX_END_NAMESPACE_VERSION
++} // namespace
diff --git a/gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__inline.h b/gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__inline.h
new file mode 100644
index 0000000..9bacb4f
--- /dev/null
+++ b/gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__inline.h
@@ -0,0 +1,166 @@
+$NetBSD: patch-libstdc++-v3_config_os_bsd_dragonfly_ctype__inline.h,v 1.2 2013/01/31 20:07:17 marino Exp $
+
+--- libstdc++-v3/config/os/bsd/dragonfly/ctype_inline.h.orig 2012-06-22 10:35:30.000000000 +0000
++++ libstdc++-v3/config/os/bsd/dragonfly/ctype_inline.h
+@@ -0,0 +1,161 @@
++// Locale support -*- C++ -*-
++
++// Copyright (C) 2000, 2003, 2004, 2005, 2009, 2010
++// Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 3, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// 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/>.
++
++/** @file bits/ctype_inline.h
++ * This is an internal header file, included by other library headers.
++ * Do not attempt to use it directly. @headername{locale}
++ */
++
++//
++// ISO C++ 14882: 22.1 Locales
++//
++
++// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
++// functions go in ctype.cc
++
++namespace std _GLIBCXX_VISIBILITY(default)
++{
++_GLIBCXX_BEGIN_NAMESPACE_VERSION
++
++ bool
++ ctype<char>::
++ is(mask __m, char __c) const
++ {
++ if (_M_table)
++ return _M_table[static_cast<unsigned char>(__c)] & __m;
++ else
++ return __libc_ctype_ [__c + 1] & __m;
++ }
++
++ const char*
++ ctype<char>::
++ is(const char* __low, const char* __high, mask* __vec) const
++ {
++ if (_M_table)
++ while (__low < __high)
++ *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
++ else
++ for (;__low < __high; ++__vec, ++__low)
++ {
++ mask __m = 0;
++ if (this->is(upper, *__low)) __m |= upper;
++ if (this->is(lower, *__low)) __m |= lower;
++ if (this->is(alpha, *__low)) __m |= alpha;
++ if (this->is(digit, *__low)) __m |= digit;
++ if (this->is(xdigit, *__low)) __m |= xdigit;
++ if (this->is(space, *__low)) __m |= space;
++ if (this->is(print, *__low)) __m |= print;
++ if (this->is(graph, *__low)) __m |= graph;
++ if (this->is(cntrl, *__low)) __m |= cntrl;
++ if (this->is(punct, *__low)) __m |= punct;
++ // Do not include explicit line for alnum mask since it is a
++ // pure composite of masks on DragonFly.
++ *__vec = __m;
++ }
++ return __high;
++ }
++
++ const char*
++ ctype<char>::
++ scan_is(mask __m, const char* __low, const char* __high) const
++ {
++ if (_M_table)
++ while (__low < __high
++ && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
++ ++__low;
++ else
++ while (__low < __high && !this->is(__m, *__low))
++ ++__low;
++ return __low;
++ }
++
++ const char*
++ ctype<char>::
++ scan_not(mask __m, const char* __low, const char* __high) const
++ {
++ if (_M_table)
++ while (__low < __high
++ && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
++ ++__low;
++ else
++ while (__low < __high && this->is(__m, *__low) != 0)
++ ++__low;
++ return __low;
++ }
++
++#ifdef _GLIBCXX_USE_WCHAR_T
++ inline bool
++ ctype<wchar_t>::
++ do_is(mask __m, wchar_t __c) const
++ {
++ return __libc_ctype_ [__c + 1] & __m;
++ }
++
++ inline const wchar_t*
++ ctype<wchar_t>::
++ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
++ {
++ for (; __lo < __hi; ++__vec, ++__lo)
++ {
++ mask __m = 0;
++ if (isupper (*__lo)) __m |= _CTYPEMASK_U;
++ if (islower (*__lo)) __m |= _CTYPEMASK_L;
++ if (isdigit (*__lo)) __m |= _CTYPEMASK_D;
++ if (isspace (*__lo)) __m |= _CTYPEMASK_S;
++ if (ispunct (*__lo)) __m |= _CTYPEMASK_P;
++ if (isblank (*__lo)) __m |= _CTYPEMASK_B;
++ if (iscntrl (*__lo)) __m |= _CTYPEMASK_C;
++ if (isalpha (*__lo)) __m |= _CTYPEMASK_A;
++ if (isgraph (*__lo)) __m |= _CTYPEMASK_G;
++ if (isprint (*__lo)) __m |= _CTYPEMASK_R;
++ if (isxdigit(*__lo)) __m |= _CTYPEMASK_X;
++ /* alnum already covered = alpha | digit */
++
++ *__vec = __m;
++ }
++ return __hi;
++ }
++
++ inline const wchar_t*
++ ctype<wchar_t>::
++ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
++ {
++ while (__lo < __hi && !(__libc_ctype_ [*__lo + 1] & __m))
++ ++__lo;
++ return __lo;
++ }
++
++ inline const wchar_t*
++ ctype<wchar_t>::
++ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
++ {
++ while (__lo < __hi && (__libc_ctype_ [*__lo + 1] & __m))
++ ++__lo;
++ return __lo;
++ }
++#endif
++
++_GLIBCXX_END_NAMESPACE_VERSION
++} // namespace
diff --git a/gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_os__defines.h b/gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_os__defines.h
new file mode 100644
index 0000000..16b7b5d
--- /dev/null
+++ b/gcc47/patches/patch-libstdc++-v3_config_os_bsd_dragonfly_os__defines.h
@@ -0,0 +1,46 @@
+$NetBSD: patch-libstdc++-v3_config_os_bsd_dragonfly_os__defines.h,v 1.1 2012/06/23 22:13:02 marino Exp $
+
+--- libstdc++-v3/config/os/bsd/dragonfly/os_defines.h.orig 2012-06-22 10:35:30.000000000 +0000
++++ libstdc++-v3/config/os/bsd/dragonfly/os_defines.h
+@@ -0,0 +1,41 @@
++// Specific definitions for BSD -*- C++ -*-
++
++// Copyright (C) 2000, 2009, 2010 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library. This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 3, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++// GNU General Public License for more details.
++
++// 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/>.
++
++
++#ifndef _GLIBCXX_OS_DEFINES
++#define _GLIBCXX_OS_DEFINES 1
++
++// System-specific #define, typedefs, corrections, etc, go here. This
++// file will come before all others.
++
++/* FreeBSD approach, likely a mistake for DragonFly.
++#define _GLIBCXX_USE_C99_CHECK 1
++#define _GLIBCXX_USE_C99_DYNAMIC (!(__ISO_C_VISIBLE >= 1999))
++#define _GLIBCXX_USE_C99_LONG_LONG_CHECK 1
++#define _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC (_GLIBCXX_USE_C99_DYNAMIC || !defined __LONG_LONG_SUPPORTED)
++#define _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_CHECK 1
++#define _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_DYNAMIC defined _XOPEN_SOURCE
++*/
++
++#endif
diff --git a/gcc47/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h b/gcc47/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h
new file mode 100644
index 0000000..786c218
--- /dev/null
+++ b/gcc47/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h
@@ -0,0 +1,37 @@
+$NetBSD: patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h,v 1.3 2013/05/22 13:14:19 joerg Exp $
+
+--- libstdc++-v3/config/os/bsd/netbsd/ctype_base.h.orig 2012-08-06 14:34:27.000000000 +0000
++++ libstdc++-v3/config/os/bsd/netbsd/ctype_base.h
+@@ -43,9 +43,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // 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 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 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;
diff --git a/gcc47/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc b/gcc47/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc
new file mode 100644
index 0000000..f7c0320
--- /dev/null
+++ b/gcc47/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc
@@ -0,0 +1,57 @@
+$NetBSD: patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc,v 1.1 2013/05/22 13:14:19 joerg Exp $
+
+--- libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc.orig 2011-03-31 16:06:12.000000000 +0000
++++ libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc
+@@ -38,11 +38,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // 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()
+- { return _C_ctype_ + 1; }
++#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 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ char
+ ctype<char>::do_toupper(char __c) const
+- { return ::toupper((int) __c); }
++ { return ::toupper((int)(unsigned char) __c); }
+
+ const char*
+ ctype<char>::do_toupper(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+- *__low = ::toupper((int) *__low);
++ *__low = ::toupper((int)(unsigned char) *__low);
+ ++__low;
+ }
+ return __high;
+@@ -84,14 +90,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ char
+ ctype<char>::do_tolower(char __c) const
+- { return ::tolower((int) __c); }
++ { return ::tolower((int)(unsigned char) __c); }
+
+ const char*
+ ctype<char>::do_tolower(char* __low, const char* __high) const
+ {
+ while (__low < __high)
+ {
+- *__low = ::tolower((int) *__low);
++ *__low = ::tolower((int)(unsigned char) *__low);
+ ++__low;
+ }
+ return __high;
diff --git a/gcc47/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__inline.h b/gcc47/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__inline.h
new file mode 100644
index 0000000..5b2bba6
--- /dev/null
+++ b/gcc47/patches/patch-libstdc++-v3_config_os_bsd_netbsd_ctype__inline.h
@@ -0,0 +1,13 @@
+$NetBSD: patch-libstdc++-v3_config_os_bsd_netbsd_ctype__inline.h,v 1.1 2013/05/22 13:14:19 joerg Exp $
+
+--- libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h.orig 2011-01-30 22:39:36.000000000 +0000
++++ libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h
+@@ -48,7 +48,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 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;
+ }
+
diff --git a/gcc47/patches/patch-libstdc++-v3_configure b/gcc47/patches/patch-libstdc++-v3_configure
new file mode 100644
index 0000000..a179a38
--- /dev/null
+++ b/gcc47/patches/patch-libstdc++-v3_configure
@@ -0,0 +1,47 @@
+$NetBSD: patch-libstdc++-v3_configure,v 1.2 2012/12/01 02:29:32 sbd Exp $
+
+--- libstdc++-v3/configure.orig 2012-08-06 14:34:27.000000000 +0000
++++ libstdc++-v3/configure
+@@ -15704,7 +15704,7 @@ $as_echo "stdio" >&6; }
+ if test "${enable_clocale+set}" = set; then :
+ enableval=$enable_clocale;
+ case "$enableval" in
+- generic|gnu|ieee_1003.1-2001|newlib|yes|no|auto) ;;
++ generic|gnu|ieee_1003.1-2001|newlib|darwin|dragonfly|yes|no|auto) ;;
+ *) as_fn_error "Unknown argument to enable/disable clocale" "$LINENO" 5 ;;
+ esac
+
+@@ -15742,6 +15742,9 @@ fi
+ darwin* | freebsd*)
+ enable_clocale_flag=darwin
+ ;;
++ dragonfly*)
++ enable_clocale_flag=dragonfly
++ ;;
+ *)
+ if test x"$with_newlib" = x"yes"; then
+ enable_clocale_flag=newlib
+@@ -15878,6 +15881,23 @@ $as_echo "darwin or freebsd" >&6; }
+ CMESSAGES_H=config/locale/generic/messages_members.h
+ CMESSAGES_CC=config/locale/generic/messages_members.cc
+ CMONEY_CC=config/locale/generic/monetary_members.cc
++ CNUMERIC_CC=config/locale/generic/numeric_members.cc
++ CTIME_H=config/locale/generic/time_members.h
++ CTIME_CC=config/locale/generic/time_members.cc
++ CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
++ ;;
++ dragonfly)
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: dragonfly" >&5
++$as_echo "dragonfly" >&6; }
++
++ CLOCALE_H=config/locale/generic/c_locale.h
++ CLOCALE_CC=config/locale/dragonfly/c_locale.cc
++ CCODECVT_CC=config/locale/generic/codecvt_members.cc
++ CCOLLATE_CC=config/locale/generic/collate_members.cc
++ CCTYPE_CC=config/locale/dragonfly/ctype_members.cc
++ CMESSAGES_H=config/locale/generic/messages_members.h
++ CMESSAGES_CC=config/locale/generic/messages_members.cc
++ CMONEY_CC=config/locale/generic/monetary_members.cc
+ CNUMERIC_CC=config/locale/generic/numeric_members.cc
+ CTIME_H=config/locale/generic/time_members.h
+ CTIME_CC=config/locale/generic/time_members.cc
diff --git a/gcc47/patches/patch-libstdc++-v3_configure.host b/gcc47/patches/patch-libstdc++-v3_configure.host
new file mode 100644
index 0000000..365ae71
--- /dev/null
+++ b/gcc47/patches/patch-libstdc++-v3_configure.host
@@ -0,0 +1,14 @@
+$NetBSD: patch-libstdc++-v3_configure.host,v 1.1 2012/06/23 22:13:02 marino Exp $
+
+--- libstdc++-v3/configure.host.orig 2012-02-10 18:10:12.000000000 +0000
++++ libstdc++-v3/configure.host
+@@ -239,6 +239,9 @@ case "${host_os}" in
+ os_include_dir="os/djgpp"
+ error_constants_dir="os/djgpp"
+ ;;
++ dragonfly*)
++ os_include_dir="os/bsd/dragonfly"
++ ;;
+ freebsd*)
+ os_include_dir="os/bsd/freebsd"
+ ;;
diff --git a/gcc47/patches/patch-ltmain.sh b/gcc47/patches/patch-ltmain.sh
new file mode 100644
index 0000000..9ad5d76
--- /dev/null
+++ b/gcc47/patches/patch-ltmain.sh
@@ -0,0 +1,13 @@
+$NetBSD: patch-ltmain.sh,v 1.1 2014/05/10 14:14:58 richard Exp $
+
+--- ltmain.sh.orig 2011-01-13 18:51:10.000000000 +0000
++++ ltmain.sh
+@@ -976,7 +976,7 @@ func_enable_tag ()
+
+
+ case $host in
+- *cygwin* | *mingw* | *pw32* | *cegcc*)
++ *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* )
+ # don't eliminate duplications in $postdeps and $predeps
+ opt_duplicate_compiler_generated_deps=:
+ ;;
diff --git a/gcc47/version.mk b/gcc47/version.mk
new file mode 100644
index 0000000..d398954
--- /dev/null
+++ b/gcc47/version.mk
@@ -0,0 +1,2 @@
+# $NetBSD: version.mk,v 1.5 2015/03/12 14:53:13 ryoon Exp $
+GCC47_DIST_VERSION:= 4.7.4
Home |
Main Index |
Thread Index |
Old Index