summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authorwiz <wiz>2015-04-25 10:32:07 +0000
committerwiz <wiz>2015-04-25 10:32:07 +0000
commit52f1c43de6a26d3720dc90681eed1ffef816d5fb (patch)
treee5a6190170e738b22c0f961aae9579f147aa6573 /lang
parent824cee1559a861f19bd22942e4d65ac3c073bbf4 (diff)
downloadpkgsrc-52f1c43de6a26d3720dc90681eed1ffef816d5fb.tar.gz
Re-Import gcc2-2.95.3nb7 as lang/gcc2 (previously lang/gcc).
This directory contains the GNU Compiler Collection (GCC) version 2.95. It includes all of the support for compiling C, C++, Objective C, Fortran, Java, and Chill. The GNU Compiler Collection is free software. See the file COPYING for copying permission. See the file gcc.texi (together with other files that it includes) for installation and porting information. The file INSTALL contains a copy of the installation information, as plain ASCII. See the Bugs chapter of the GCC Manual for how to report bugs usefully. An online readable version of the manual is in the files gcc.info*.
Diffstat (limited to 'lang')
-rw-r--r--lang/gcc2/DESCR14
-rw-r--r--lang/gcc2/MESSAGE8
-rw-r--r--lang/gcc2/Makefile119
-rw-r--r--lang/gcc2/PLIST200
-rw-r--r--lang/gcc2/buildlink3.mk25
-rw-r--r--lang/gcc2/distinfo31
-rw-r--r--lang/gcc2/files/UPDATE.txt40
-rw-r--r--lang/gcc2/files/arm_netbsd-elf.h158
-rw-r--r--lang/gcc2/files/gcc.mk7
-rw-r--r--lang/gcc2/files/i386_netbsd-elf.h661
-rw-r--r--lang/gcc2/files/i386_xm-uwin.h39
-rw-r--r--lang/gcc2/files/m68k_netbsd-elf.h649
-rw-r--r--lang/gcc2/files/mips_t-mipseb1
-rw-r--r--lang/gcc2/files/rs6000_netbsd.h73
-rw-r--r--lang/gcc2/files/sh_netbsd-elf-little.h50
-rw-r--r--lang/gcc2/files/sh_netbsd-elf.h166
-rw-r--r--lang/gcc2/files/sparc_netbsd-elf-common.h69
-rw-r--r--lang/gcc2/files/sparc_netbsd-elf.h42
-rw-r--r--lang/gcc2/files/sparc_netbsd64.h182
-rw-r--r--lang/gcc2/files/sparc_t-netbsd2
-rw-r--r--lang/gcc2/files/vax_netbsd-elf.h101
-rw-r--r--lang/gcc2/files/xm-netbsd.h32
-rw-r--r--lang/gcc2/files/xm-target64.h6
-rw-r--r--lang/gcc2/patches/patch-Makefile.in15
-rw-r--r--lang/gcc2/patches/patch-aa42
-rw-r--r--lang/gcc2/patches/patch-ab75
-rw-r--r--lang/gcc2/patches/patch-ac26
-rw-r--r--lang/gcc2/patches/patch-ad7
-rw-r--r--lang/gcc2/patches/patch-ae7
-rw-r--r--lang/gcc2/patches/patch-af161
-rw-r--r--lang/gcc2/patches/patch-ag361
-rw-r--r--lang/gcc2/patches/patch-ah15
-rw-r--r--lang/gcc2/patches/patch-ai20
-rw-r--r--lang/gcc2/patches/patch-aj13
-rw-r--r--lang/gcc2/patches/patch-ak13
-rw-r--r--lang/gcc2/patches/patch-al13
-rw-r--r--lang/gcc2/patches/patch-am20
-rw-r--r--lang/gcc2/patches/patch-gcc_Makefile.in356
-rw-r--r--lang/gcc2/patches/patch-gcc_ch_Make-lang.in36
-rw-r--r--lang/gcc2/patches/patch-gcc_cp_Make-lang.in68
-rw-r--r--lang/gcc2/patches/patch-gcc_f_Make-lang.in105
-rw-r--r--lang/gcc2/patches/patch-gcc_intl_Makefile.in39
-rw-r--r--lang/gcc2/patches/patch-gcc_java_Make-lang.in34
-rw-r--r--lang/gcc2/patches/patch-libchill_Makefile.in19
-rw-r--r--lang/gcc2/patches/patch-libf2c_Makefile.in19
-rw-r--r--lang/gcc2/patches/patch-libio_Makefile.in31
46 files changed, 4170 insertions, 0 deletions
diff --git a/lang/gcc2/DESCR b/lang/gcc2/DESCR
new file mode 100644
index 00000000000..10db7cd4b30
--- /dev/null
+++ b/lang/gcc2/DESCR
@@ -0,0 +1,14 @@
+This directory contains the GNU Compiler Collection (GCC) version 2.95.
+It includes all of the support for compiling C, C++, Objective C, Fortran,
+Java, and Chill.
+
+The GNU Compiler Collection is free software. See the file COPYING for copying
+permission.
+
+See the file gcc.texi (together with other files that it includes) for
+installation and porting information. The file INSTALL contains a
+copy of the installation information, as plain ASCII.
+
+See the Bugs chapter of the GCC Manual for how to report bugs
+usefully. An online readable version of the manual is in the files
+gcc.info*.
diff --git a/lang/gcc2/MESSAGE b/lang/gcc2/MESSAGE
new file mode 100644
index 00000000000..41d68358261
--- /dev/null
+++ b/lang/gcc2/MESSAGE
@@ -0,0 +1,8 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+To use ${PKGNAME} include
+"${PREFIX}/share/examples/${DISTNAME}/mk.conf"
+in your BSD style makefile.
+
+===========================================================================
diff --git a/lang/gcc2/Makefile b/lang/gcc2/Makefile
new file mode 100644
index 00000000000..66e4b3366c2
--- /dev/null
+++ b/lang/gcc2/Makefile
@@ -0,0 +1,119 @@
+# $NetBSD: Makefile,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+DISTNAME= gcc-2.95.3
+PKGNAME= ${DISTNAME:S/gcc/gcc2/}
+PKGREVISION= 7
+CATEGORIES= lang
+MASTER_SITES= ${MASTER_SITE_GNU:=gcc/}
+
+PATCH_SITES= ${MASTER_SITE_LOCAL}
+PATCHFILES= gcc-2.95.3-diff-2002-08-29.gz
+
+#
+# Synced from patches against main source tree as of 2002-03-28
+#
+MAINTAINER= pkgsrc-users@NetBSD.org
+HOMEPAGE= http://gcc.gnu.org/
+COMMENT= GNU Compiler Collection, version 2
+
+NOT_FOR_PLATFORM= Darwin-*-* Interix-*-* *-*-x86_64 DragonFly-*-*
+NOT_FOR_PLATFORM+= NetBSD-[6789]*-*
+
+USE_TOOLS+= gmake bison
+MAKEFLAGS+= GMAKE_LOCALE=no
+
+HAS_CONFIGURE= YES
+CONFIGURE_SCRIPT= ${WRKSRC}/configure
+CONFIGURE_ARGS+= --host=${MACHINE_GNU_PLATFORM:Q}
+CONFIGURE_ARGS+= --prefix=${GCC_PREFIX:Q}
+CONFIGURE_ARGS+= --enable-shared
+
+USE_TOOLS+= chmod
+MAKE_ENV+= ac_cv_prog_chmod=${TOOLS_CHMOD:Q}
+MAKE_ENV+= SHELL=${CONFIG_SHELL}
+
+CONFIGURE_DIRS= ${WRKDIR}/objdir
+BUILD_DIRS= ${CONFIGURE_DIRS}
+
+FILES_SUBST+= DISTNAME=${DISTNAME:Q} \
+ GCC_PREFIX=${GCC_PREFIX:Q}
+MESSAGE_SUBST+= DISTNAME=${DISTNAME}
+PLIST_SUBST+= DISTNAME=${DISTNAME:Q} \
+ GCC_PREFIX=${GCC_PREFIX:S|^${PREFIX}/||:Q}
+
+INFO_FILES= yes
+
+.include "../../mk/bsd.prefs.mk"
+
+.if !empty(MACHINE_PLATFORM:MNetBSD-4*)
+GCC_REQD+= 3.0
+USE_PKGSRC_GCC= yes
+.endif
+
+.if ${OPSYS} == "SunOS"
+CONFLICTS+= gcc-[0-9]* pgcc-[0-9]*
+. if ${CC:M*gcc*} == ""
+BUILD_TARGET= bootstrap
+. endif
+# we know it's a GNU toolchain on Linux and the BSDs.
+.elif ${OPSYS:M*BSD} != "" || ${OPSYS} == "Linux"
+CONFIGURE_ARGS+= --with-gnu-as
+CONFIGURE_ARGS+= --with-gnu-ld
+.else
+# play it safe, force a bootstrap build if we don't know for sure it
+# is gcc.
+. if ${CC:M*gcc*} == ""
+BUILD_TARGET= bootstrap
+. endif
+.endif
+
+GCC_PREFIX= ${PREFIX}/${DISTNAME}
+GCC_VERSION= ${PKGVERSION:C|nb.*||}
+GCC_ARCHDIR= ${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${GCC_VERSION}
+
+post-extract:
+ ${MKDIR} ${WRKSRC}
+ ${CP} ${FILESDIR}/xm-netbsd.h ${WRKSRC}/gcc/config
+ ${CP} ${FILESDIR}/xm-target64.h ${WRKSRC}/gcc/config
+ for file in ${FILESDIR}/*_* ; do \
+ arch=`${BASENAME} $${file} | ${SED} -e "s/_.*//"`; \
+ dest=`${BASENAME} $${file} | ${SED} -e "s/$${arch}_//"`; \
+ ${MKDIR} ${WRKSRC}/gcc/config/$${arch}; \
+ ${CP} $${file} ${WRKSRC}/gcc/config/$${arch}/$${dest}; \
+ done
+ ${RM} ${WRKSRC}/gcc/config/alpha/netbsd-elf.h
+ ${RM} ${WRKSRC}/gcc/config/arm/t-netbsd
+ ${RM} ${WRKSRC}/gcc/config/mips/x-netbsd
+ ${RM} ${WRKSRC}/libf2c/libF77/dtime_.c
+ ${RM} ${WRKSRC}/libf2c/libF77/etime_.c
+
+pre-configure:
+ ${MKDIR} ${BUILD_DIRS}
+ cd ${WRKSRC} && contrib/egcs_update --touch
+
+post-build:
+ @${SED} ${FILES_SUBST_SED} ${FILESDIR}/gcc.mk > ${WRKDIR}/gcc.mk
+
+.if ${OPSYS} == "SunOS"
+#
+# remove empty file and directories that show up when one does:
+# make install; make deinstall; make install
+#
+post-install:
+ -cd ${DESTDIR}${GCC_ARCHDIR}/include && ${RM} -f fixed && ${RMDIR} v7 v9
+.else
+post-install:
+. if exists(/usr/include/g++/FlexLexer.h)
+ ${LN} -fs /usr/include/g++/FlexLexer.h \
+ ${DESTDIR}${GCC_PREFIX}/include/g++-3/FlexLexer.h
+. endif
+ ${RM} -f ${DESTDIR}${GCC_ARCHDIR}/include/curses.h ${DESTDIR}${GCC_PREFIX}/bin/cc
+.endif
+ ${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/share/examples/${DISTNAME}
+ ${INSTALL_DATA} ${WRKDIR}/gcc.mk ${DESTDIR}${PREFIX}/share/examples/${DISTNAME}/mk.conf
+ ${LN} -s gcc ${DESTDIR}${GCC_PREFIX}/bin/cc
+
+.include "../../mk/bsd.pkg.mk"
+
+# Make bootstrap with compiler != gcc possible.
+LDFLAGS= ${_STRIPFLAG_CC}
diff --git a/lang/gcc2/PLIST b/lang/gcc2/PLIST
new file mode 100644
index 00000000000..336d920aa26
--- /dev/null
+++ b/lang/gcc2/PLIST
@@ -0,0 +1,200 @@
+@comment $NetBSD: PLIST,v 1.1 2015/04/25 10:32:07 wiz Exp $
+${GCC_PREFIX}/bin/c++
+${GCC_PREFIX}/bin/c++filt
+${GCC_PREFIX}/bin/cc
+${GCC_PREFIX}/bin/chill
+${GCC_PREFIX}/bin/cpp
+${GCC_PREFIX}/bin/g++
+${GCC_PREFIX}/bin/g77
+${GCC_PREFIX}/bin/gcc
+${GCC_PREFIX}/bin/gcj
+${GCC_PREFIX}/bin/gcjh
+${GCC_PREFIX}/bin/gcov
+${GCC_PREFIX}/bin/${MACHINE_GNU_PLATFORM}-gcc
+${GCC_PREFIX}/bin/jcf-dump
+${GCC_PREFIX}/bin/jv-scan
+${GCC_PREFIX}/${MACHINE_GNU_PLATFORM}/include/_G_config.h
+${GCC_PREFIX}/include/g++-3/FlexLexer.h
+${GCC_PREFIX}/include/g++-3/PlotFile.h
+${GCC_PREFIX}/include/g++-3/SFile.h
+${GCC_PREFIX}/include/g++-3/algo.h
+${GCC_PREFIX}/include/g++-3/algobase.h
+${GCC_PREFIX}/include/g++-3/algorithm
+${GCC_PREFIX}/include/g++-3/alloc.h
+${GCC_PREFIX}/include/g++-3/bitset
+${GCC_PREFIX}/include/g++-3/builtinbuf.h
+${GCC_PREFIX}/include/g++-3/bvector.h
+${GCC_PREFIX}/include/g++-3/cassert
+${GCC_PREFIX}/include/g++-3/cctype
+${GCC_PREFIX}/include/g++-3/cerrno
+${GCC_PREFIX}/include/g++-3/cfloat
+${GCC_PREFIX}/include/g++-3/ciso646
+${GCC_PREFIX}/include/g++-3/climits
+${GCC_PREFIX}/include/g++-3/clocale
+${GCC_PREFIX}/include/g++-3/cmath
+${GCC_PREFIX}/include/g++-3/complex
+${GCC_PREFIX}/include/g++-3/complex.h
+${GCC_PREFIX}/include/g++-3/csetjmp
+${GCC_PREFIX}/include/g++-3/csignal
+${GCC_PREFIX}/include/g++-3/cstdarg
+${GCC_PREFIX}/include/g++-3/cstddef
+${GCC_PREFIX}/include/g++-3/cstdio
+${GCC_PREFIX}/include/g++-3/cstdlib
+${GCC_PREFIX}/include/g++-3/cstring
+${GCC_PREFIX}/include/g++-3/ctime
+${GCC_PREFIX}/include/g++-3/cwchar
+${GCC_PREFIX}/include/g++-3/cwctype
+${GCC_PREFIX}/include/g++-3/defalloc.h
+${GCC_PREFIX}/include/g++-3/deque
+${GCC_PREFIX}/include/g++-3/deque.h
+${GCC_PREFIX}/include/g++-3/editbuf.h
+${GCC_PREFIX}/include/g++-3/floatio.h
+${GCC_PREFIX}/include/g++-3/fstream
+${GCC_PREFIX}/include/g++-3/fstream.h
+${GCC_PREFIX}/include/g++-3/function.h
+${GCC_PREFIX}/include/g++-3/functional
+${GCC_PREFIX}/include/g++-3/hash_map
+${GCC_PREFIX}/include/g++-3/hash_map.h
+${GCC_PREFIX}/include/g++-3/hash_set
+${GCC_PREFIX}/include/g++-3/hash_set.h
+${GCC_PREFIX}/include/g++-3/hashtable.h
+${GCC_PREFIX}/include/g++-3/heap.h
+${GCC_PREFIX}/include/g++-3/indstream.h
+${GCC_PREFIX}/include/g++-3/iolibio.h
+${GCC_PREFIX}/include/g++-3/iomanip
+${GCC_PREFIX}/include/g++-3/iomanip.h
+${GCC_PREFIX}/include/g++-3/iosfwd
+${GCC_PREFIX}/include/g++-3/iostdio.h
+${GCC_PREFIX}/include/g++-3/iostream
+${GCC_PREFIX}/include/g++-3/iostream.h
+${GCC_PREFIX}/include/g++-3/iostreamP.h
+${GCC_PREFIX}/include/g++-3/istream.h
+${GCC_PREFIX}/include/g++-3/iterator
+${GCC_PREFIX}/include/g++-3/iterator.h
+${GCC_PREFIX}/include/g++-3/libio.h
+${GCC_PREFIX}/include/g++-3/libioP.h
+${GCC_PREFIX}/include/g++-3/list
+${GCC_PREFIX}/include/g++-3/list.h
+${GCC_PREFIX}/include/g++-3/map
+${GCC_PREFIX}/include/g++-3/map.h
+${GCC_PREFIX}/include/g++-3/memory
+${GCC_PREFIX}/include/g++-3/multimap.h
+${GCC_PREFIX}/include/g++-3/multiset.h
+${GCC_PREFIX}/include/g++-3/numeric
+${GCC_PREFIX}/include/g++-3/ostream.h
+${GCC_PREFIX}/include/g++-3/pair.h
+${GCC_PREFIX}/include/g++-3/parsestream.h
+${GCC_PREFIX}/include/g++-3/pfstream.h
+${GCC_PREFIX}/include/g++-3/procbuf.h
+${GCC_PREFIX}/include/g++-3/pthread_alloc
+${GCC_PREFIX}/include/g++-3/pthread_alloc.h
+${GCC_PREFIX}/include/g++-3/queue
+${GCC_PREFIX}/include/g++-3/rope
+${GCC_PREFIX}/include/g++-3/rope.h
+${GCC_PREFIX}/include/g++-3/ropeimpl.h
+${GCC_PREFIX}/include/g++-3/set
+${GCC_PREFIX}/include/g++-3/set.h
+${GCC_PREFIX}/include/g++-3/slist
+${GCC_PREFIX}/include/g++-3/slist.h
+${GCC_PREFIX}/include/g++-3/sstream
+${GCC_PREFIX}/include/g++-3/stack
+${GCC_PREFIX}/include/g++-3/stack.h
+${GCC_PREFIX}/include/g++-3/std/bastring.cc
+${GCC_PREFIX}/include/g++-3/std/bastring.h
+${GCC_PREFIX}/include/g++-3/std/complext.cc
+${GCC_PREFIX}/include/g++-3/std/complext.h
+${GCC_PREFIX}/include/g++-3/std/dcomplex.h
+${GCC_PREFIX}/include/g++-3/std/fcomplex.h
+${GCC_PREFIX}/include/g++-3/std/gslice.h
+${GCC_PREFIX}/include/g++-3/std/gslice_array.h
+${GCC_PREFIX}/include/g++-3/std/indirect_array.h
+${GCC_PREFIX}/include/g++-3/std/ldcomplex.h
+${GCC_PREFIX}/include/g++-3/std/mask_array.h
+${GCC_PREFIX}/include/g++-3/std/slice.h
+${GCC_PREFIX}/include/g++-3/std/slice_array.h
+${GCC_PREFIX}/include/g++-3/std/std_valarray.h
+${GCC_PREFIX}/include/g++-3/std/straits.h
+${GCC_PREFIX}/include/g++-3/std/valarray_array.h
+${GCC_PREFIX}/include/g++-3/std/valarray_array.tcc
+${GCC_PREFIX}/include/g++-3/std/valarray_meta.h
+${GCC_PREFIX}/include/g++-3/stdexcept
+${GCC_PREFIX}/include/g++-3/stdiostream.h
+${GCC_PREFIX}/include/g++-3/stl.h
+${GCC_PREFIX}/include/g++-3/stl_algo.h
+${GCC_PREFIX}/include/g++-3/stl_algobase.h
+${GCC_PREFIX}/include/g++-3/stl_alloc.h
+${GCC_PREFIX}/include/g++-3/stl_bvector.h
+${GCC_PREFIX}/include/g++-3/stl_config.h
+${GCC_PREFIX}/include/g++-3/stl_construct.h
+${GCC_PREFIX}/include/g++-3/stl_deque.h
+${GCC_PREFIX}/include/g++-3/stl_function.h
+${GCC_PREFIX}/include/g++-3/stl_hash_fun.h
+${GCC_PREFIX}/include/g++-3/stl_hash_map.h
+${GCC_PREFIX}/include/g++-3/stl_hash_set.h
+${GCC_PREFIX}/include/g++-3/stl_hashtable.h
+${GCC_PREFIX}/include/g++-3/stl_heap.h
+${GCC_PREFIX}/include/g++-3/stl_iterator.h
+${GCC_PREFIX}/include/g++-3/stl_list.h
+${GCC_PREFIX}/include/g++-3/stl_map.h
+${GCC_PREFIX}/include/g++-3/stl_multimap.h
+${GCC_PREFIX}/include/g++-3/stl_multiset.h
+${GCC_PREFIX}/include/g++-3/stl_numeric.h
+${GCC_PREFIX}/include/g++-3/stl_pair.h
+${GCC_PREFIX}/include/g++-3/stl_queue.h
+${GCC_PREFIX}/include/g++-3/stl_raw_storage_iter.h
+${GCC_PREFIX}/include/g++-3/stl_relops.h
+${GCC_PREFIX}/include/g++-3/stl_rope.h
+${GCC_PREFIX}/include/g++-3/stl_set.h
+${GCC_PREFIX}/include/g++-3/stl_slist.h
+${GCC_PREFIX}/include/g++-3/stl_stack.h
+${GCC_PREFIX}/include/g++-3/stl_tempbuf.h
+${GCC_PREFIX}/include/g++-3/stl_tree.h
+${GCC_PREFIX}/include/g++-3/stl_uninitialized.h
+${GCC_PREFIX}/include/g++-3/stl_vector.h
+${GCC_PREFIX}/include/g++-3/stream.h
+${GCC_PREFIX}/include/g++-3/streambuf.h
+${GCC_PREFIX}/include/g++-3/strfile.h
+${GCC_PREFIX}/include/g++-3/string
+${GCC_PREFIX}/include/g++-3/strstream
+${GCC_PREFIX}/include/g++-3/strstream.h
+${GCC_PREFIX}/include/g++-3/tempbuf.h
+${GCC_PREFIX}/include/g++-3/tree.h
+${GCC_PREFIX}/include/g++-3/type_traits.h
+${GCC_PREFIX}/include/g++-3/utility
+${GCC_PREFIX}/include/g++-3/valarray
+${GCC_PREFIX}/include/g++-3/vector
+${GCC_PREFIX}/include/g++-3/vector.h
+${GCC_PREFIX}/info/chill.info
+${GCC_PREFIX}/info/cpp.info
+${GCC_PREFIX}/info/g77.info
+${GCC_PREFIX}/info/gcc.info
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/cc1
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/cc1chill
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/cc1obj
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/cc1plus
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/collect2
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/cpp0
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/f771
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/include/README
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/include/exception
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/include/float.h
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/include/limits.h
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/include/math.h
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/include/new
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/include/new.h
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/include/syslimits.h
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/include/typeinfo
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/jc1
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/jvgenmain
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/libgcc.a
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/libstdc++.a
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/libstdc++.so
+${GCC_PREFIX}/lib/gcc-lib/${MACHINE_GNU_PLATFORM}/${PKGVERSION}/specs
+${GCC_PREFIX}/lib/libiberty.a
+${GCC_PREFIX}/lib/libstdc++.a.4.0
+${GCC_PREFIX}/lib/libstdc++.so.4.0
+${GCC_PREFIX}/man/man1/cccp.1
+${GCC_PREFIX}/man/man1/g++.1
+${GCC_PREFIX}/man/man1/g77.1
+${GCC_PREFIX}/man/man1/gcc.1
+share/examples/${PKGNAME}/mk.conf
diff --git a/lang/gcc2/buildlink3.mk b/lang/gcc2/buildlink3.mk
new file mode 100644
index 00000000000..dbb19759d01
--- /dev/null
+++ b/lang/gcc2/buildlink3.mk
@@ -0,0 +1,25 @@
+# $NetBSD: buildlink3.mk,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+.include "../../mk/bsd.fast.prefs.mk"
+
+BUILDLINK_TREE+= gcc2
+
+.if !defined(GCC2_BUILDLINK3_MK)
+GCC2_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.gcc2+= gcc2>=2.95
+BUILDLINK_ABI_DEPENDS.gcc2+= gcc2>=2.95.3nb7
+BUILDLINK_PKGSRCDIR.gcc2?= ../../lang/gcc2
+BUILDLINK_LIBDIRS.gcc2?= \
+ ${_GCC_PREFIX:S/^${BUILDLINK_PREFIX.gcc2}\///}lib \
+ ${_GCC_ARCHDIR:S/^${BUILDLINK_PREFIX.gcc2}\///}
+
+# Packages that link against shared libraries need a full dependency.
+. if defined(_USE_GCC_SHLIB)
+BUILDLINK_DEPMETHOD.gcc2+= full
+. else
+BUILDLINK_DEPMETHOD.gcc2?= build
+. endif
+.endif # GCC2_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -gcc2
diff --git a/lang/gcc2/distinfo b/lang/gcc2/distinfo
new file mode 100644
index 00000000000..bef68f3be3b
--- /dev/null
+++ b/lang/gcc2/distinfo
@@ -0,0 +1,31 @@
+$NetBSD: distinfo,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+SHA1 (gcc-2.95.3.tar.gz) = 535d27038d161c0e7c2662702e11a48aa97ef622
+RMD160 (gcc-2.95.3.tar.gz) = 2c506b7e80cb2b4d9953f4f9753d581cb885f610
+Size (gcc-2.95.3.tar.gz) = 12911721 bytes
+SHA1 (gcc-2.95.3-diff-2002-08-29.gz) = 9e54a31e78070cba3f6840275350bd0cbf20fe84
+RMD160 (gcc-2.95.3-diff-2002-08-29.gz) = cdfa97ed33ad01b5b33f745bdfacf26ec2568b53
+Size (gcc-2.95.3-diff-2002-08-29.gz) = 564720 bytes
+SHA1 (patch-Makefile.in) = 1d13564b97e2bf97f0bf807e7bd42647e918bc84
+SHA1 (patch-aa) = 1d9db3e2fecfd3070abcc930dbe4b37669efb3a7
+SHA1 (patch-ab) = 527cc1593adb1d3e56546fc9791b430921137621
+SHA1 (patch-ac) = 1f95d19e3ee2ea61d366745a330df085c530fd50
+SHA1 (patch-ad) = 2fb8cda55220bd202a4b7948277d00f293718caf
+SHA1 (patch-ae) = b9721d3e89a93736b926e1efcfb9d0fb4904277f
+SHA1 (patch-af) = 72d27bfecb2633a1f184cfe9cc8b1194c0d57dfe
+SHA1 (patch-ag) = bb4d84561d20d2379a71a442b8711b2c54cf4bf2
+SHA1 (patch-ah) = 777b4c19c7d86007c69ec9b8c157c73294695241
+SHA1 (patch-ai) = ce25852c0694163b3e880a700304e56edbc9069d
+SHA1 (patch-aj) = 9c957c4e61b67efdb92796fe04e22931cb103b5d
+SHA1 (patch-ak) = cf546c843a3370220360c01b7c7b09365ac1b506
+SHA1 (patch-al) = 4ac1f94d5f12d4419fe7d92f5e3c9aa3b3158a33
+SHA1 (patch-am) = bc18d2055d5af97d648a04af8c89be2627db700b
+SHA1 (patch-gcc_Makefile.in) = 145c9069fd0214c6728f49dc3ee7e8ab5192e828
+SHA1 (patch-gcc_ch_Make-lang.in) = b1d623bd160a68ec5bbb06d7e35420a4d4d4a691
+SHA1 (patch-gcc_cp_Make-lang.in) = 139f754fb020974956d803f6ff920d473b538a90
+SHA1 (patch-gcc_f_Make-lang.in) = 377e02b3a5e2db5dbdc6a0cd27afaba21b9ef1b9
+SHA1 (patch-gcc_intl_Makefile.in) = ee25ce37bb5cd14486e00f40c306a56cd8904d9c
+SHA1 (patch-gcc_java_Make-lang.in) = cd26e7b2dfd5e836eec1078c814ab0dbdd534106
+SHA1 (patch-libchill_Makefile.in) = af050b445fced4f1d54bd88b782c8321975c782d
+SHA1 (patch-libf2c_Makefile.in) = 655592a4107c6f67d4edfd364633dc2f3bd7bba7
+SHA1 (patch-libio_Makefile.in) = fbced91c499898f49ff06913b51a7528be0ea4ee
diff --git a/lang/gcc2/files/UPDATE.txt b/lang/gcc2/files/UPDATE.txt
new file mode 100644
index 00000000000..2c7e23e601c
--- /dev/null
+++ b/lang/gcc2/files/UPDATE.txt
@@ -0,0 +1,40 @@
+# $NetBSD: UPDATE.txt,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+This file documents the steps taken to update this package.
+
+=) Extract sources
+
+ make clean && make extract
+
+=) Copy to .orig directory excluding CVS directories
+
+ mkdir -p /some/tmp/dir/gcc-2.95.3.orig
+ cd work/gcc-2.95.3
+ tar --exclude CVS -cvf - gcc include lib{f2c,iberty,io,stdc++} texinfo | ( cd /some/tmp/dir/gcc-2.95.3.orig ; tar -xf - )
+
+=) Update in-tree gcc sources
+
+ cd /usr/src/gnu/dist/toolchain && cvs update
+
+=) Copy over the new sources excluding CVS directories
+
+ mkdir /some/tmp/dir/gcc-2.95.3
+ cd /usr/src/gnu/dist/toolchain
+ tar --exclude CVS -cvf - gcc include lib{f2c,iberty,io,stdc++} texinfo | ( cd /some/tmp/dir/gcc-2.95.3 ; tar -xf - )
+
+=) Create patch file
+
+ mkdir /some/tmp/dir/foo
+ cd /some/tmp/dir/foo && diff -u2 -r -N ../gcc-2.95.3.orig ../gcc-2.95.3 > gcc-2.95.3-diff-`date '+%Y-%m-%d'`
+ gzip gcc-2.95.3-diff-`date '+%Y-%m-%d'`
+
+=) copy the patch file to your distfiles directory, and 'make makesum'. Now proceed with
+ creating any pkgsrc specific patches for gcc, placing them in patches/ as usual.
+
+=) when its all tested and working, upload the patchfile
+ to ftp.netbsd.org:/pub/NetBSD/packages/distfiles/LOCAL_PORTS/
+
+=) go to pkgsrc/lang/gcc-ssp and do a 'make mps'. Verify that you have not broken that pkg.
+
+Hopefully this procedure will make maintaining this package a little easier.
+
diff --git a/lang/gcc2/files/arm_netbsd-elf.h b/lang/gcc2/files/arm_netbsd-elf.h
new file mode 100644
index 00000000000..6d66c9716d3
--- /dev/null
+++ b/lang/gcc2/files/arm_netbsd-elf.h
@@ -0,0 +1,158 @@
+/* NetBSD/arm (RiscBSD) version.
+ Copyright (C) 1993, 1994, 1997, 1998 Free Software Foundation, Inc.
+ Contributed by Mark Brinicombe (amb@physig.ph.kcl.ac.uk)
+
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
+
+GNU CC 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 GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* Human-readable target name for version string. */
+#define TARGET_VERSION fputs (" (ARM NetBSD/ELF)", stderr);
+
+/*#undef ASM_DECLARE_FUNCTION_NAME*/
+
+/* ARM6 family default cpu. */
+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
+
+#define TARGET_DEFAULT \
+ (ARM_FLAG_APCS_32 \
+ | ARM_FLAG_SOFT_FLOAT \
+ | ARM_FLAG_ATPCS_STACK_ALIGN \
+ | ARM_FLAG_SHORT_BYTE)
+
+/* APCS-32 is the default for ELF anyway. */
+/* Unsigned chars are the default anyway. */
+
+#include "arm/elf.h"
+
+/* We use VFP format for doubles. */
+/* XXX should be run-time configurable */
+#undef FLOAT_WORDS_BIG_ENDIAN
+#define FLOAT_WORDS_BIG_ENDIAN (TARGET_HARD_FLOAT || TARGET_BIG_END)
+/* This gets redefined in config/netbsd.h. */
+#undef TARGET_MEM_FUNCTIONS
+
+/* How large values are returned */
+/* We override the default here because the default is to follow the
+ APCS rules and we want to follow the (simpler) ATPCS rules. */
+#undef RETURN_IN_MEMORY
+#define RETURN_IN_MEMORY(TYPE) \
+ (AGGREGATE_TYPE_P (TYPE) && int_size_in_bytes (TYPE) > 4)
+
+#define NETBSD_ELF
+
+#include <netbsd.h>
+
+/* Override standard NetBSD asm spec. What do they know? */
+#undef ASM_SPEC
+/* Don't bother telling the assembler the CPU type -- assume the compiler
+ won't generate bogus code and anyone using asm() knows what they're
+ doing. */
+#define ASM_SPEC "%{mbig-endian:-EB} \
+ %{mapcs-26:-mapcs-26} %{!mapcs-26:-mapcs-32} \
+ %{mapcs-float:-mapcs-float} \
+ %{mthumb-interwork:-mthumb-interwork} \
+ %{fpic:-k} %{fPIC:-k}"
+
+/* Some defines for CPP. */
+
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES "\
+-D__arm__ -D__NetBSD__ -D__ELF__ \
+-Asystem(unix) -Asystem(NetBSD) -Acpu(arm) -Amachine(arm)"
+
+/* Define _POSIX_SOURCE if necessary. */
+#undef CPP_SPEC
+#define CPP_SPEC "\
+%(cpp_cpu_arch) %(cpp_apcs_pc) %(cpp_float) %(cpp_endian) \
+%{posix:-D_POSIX_SOURCE} \
+"
+
+/* Because TARGET_DEFAULT sets ARM_FLAG_SOFT_FLOAT */
+#undef CPP_FLOAT_DEFAULT_SPEC
+#define CPP_FLOAT_DEFAULT_SPEC "-D__SOFTFP__ -D__VFP_FP__"
+
+/* Because we use VFP-format floats in the soft-float case */
+#undef CPP_FLOAT_SPEC
+#define CPP_FLOAT_SPEC "\
+%{msoft-float:\
+ %{mhard-float:%e-msoft-float and -mhard_float may not be used together} \
+ -D__SOFTFP__ -D__VFP_FP__} \
+%{!mhard-float:%{!msoft-float:%(cpp_float_default)}} \
+"
+
+#undef SIZE_TYPE
+#define SIZE_TYPE "long unsigned int"
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "long int"
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "int"
+
+#undef WCHAR_UNSIGNED
+#define WCHAR_UNSIGNED 0
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
+
+#define HANDLE_SYSV_PRAGMA
+
+/* We don't have any limit on the length as out debugger is GDB. */
+#undef DBX_CONTIN_LENGTH
+
+/* NetBSD does its profiling differently to the Acorn compiler. We
+ don't need a word following the mcount call; and to skip it
+ requires either an assembly stub or use of fomit-frame-pointer when
+ compiling the profiling functions. */
+
+#undef FUNCTION_PROFILER
+#define FUNCTION_PROFILER(STREAM,LABELNO) \
+{ \
+ fprintf(STREAM, "\tmov\t%sip, %slr\n", REGISTER_PREFIX, REGISTER_PREFIX); \
+ fprintf(STREAM, "\tbl\t__mcount\n"); \
+}
+
+/* On the ARM `@' introduces a comment, so we must use something else
+ for .type directives. */
+#undef TYPE_OPERAND_FMT
+#define TYPE_OPERAND_FMT "%%%s"
+
+/* VERY BIG NOTE : Change of structure alignment for RiscBSD.
+ There are consequences you should be aware of...
+
+ Normally GCC/arm uses a structure alignment of 32 for compatibility
+ with armcc. This means that structures are padded to a word
+ boundary. Historically, NetBSD/arm has used an alignment of 8, and ARM
+ seem to be moving that way in their toolchain so we'll keep it.
+
+ This has several side effects that should be considered.
+ 1. Structures will only be aligned to the size of the largest member.
+ i.e. structures containing only bytes will be byte aligned.
+ structures containing shorts will be half word alinged.
+ structures containing ints will be word aligned.
+
+ This means structures should be padded to a word boundary if
+ alignment of 32 is required for byte structures etc.
+
+ 2. A potential performance penalty may exist if strings are no longer
+ word aligned. GCC will not be able to use word load/stores to copy
+ short strings.
+*/
+#undef STRUCTURE_SIZE_BOUNDARY
+#define STRUCTURE_SIZE_BOUNDARY 8
+
+#define DEFAULT_SHORT_ENUMS 1
diff --git a/lang/gcc2/files/gcc.mk b/lang/gcc2/files/gcc.mk
new file mode 100644
index 00000000000..ff7e26c4570
--- /dev/null
+++ b/lang/gcc2/files/gcc.mk
@@ -0,0 +1,7 @@
+# $NetBSD: gcc.mk,v 1.1 2015/04/25 10:32:07 wiz Exp $
+#
+# make configuration file for @DISTNAME@
+
+CC= @GCC_PREFIX@/bin/gcc
+CPP= @GCC_PREFIX@/bin/cpp
+CXX= @GCC_PREFIX@/bin/g++
diff --git a/lang/gcc2/files/i386_netbsd-elf.h b/lang/gcc2/files/i386_netbsd-elf.h
new file mode 100644
index 00000000000..80eda210ea0
--- /dev/null
+++ b/lang/gcc2/files/i386_netbsd-elf.h
@@ -0,0 +1,661 @@
+/* Definitions of target machine for GNU compiler,
+ for i386 NetBSD systems.
+ Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
+
+GNU CC 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 GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* This is used on i386 platforms that use the ELF format.
+ This was taken from the NetBSD/alpha configuration, and modified
+ for NetBSD/i386 by Christos Zoulas <christos@netbsd.org> */
+
+/* Get generic i386 definitions. */
+
+#include <i386/gstabs.h>
+
+/* Get perform_* macros to build libgcc.a. */
+#include <i386/perform.h>
+
+/* Get generic NetBSD ELF definitions. We will override these if necessary. */
+
+#define NETBSD_ELF
+#include <netbsd.h>
+
+#define OBJECT_FORMAT_ELF
+
+/* This goes away when the math-emulator is fixed */
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT \
+ (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
+
+/*
+ * DBX stabs definitions. Same as Solaris and other i386 ELF platforms.
+ */
+
+#undef DBX_CONTIN_CHAR
+#define DBX_CONTIN_CHAR '?'
+
+/* When generating stabs debugging, use N_BINCL entries. */
+
+#define DBX_USE_BINCL
+
+/* Make LBRAC and RBRAC addresses relative to the start of the
+ function. The native Solaris stabs debugging format works this
+ way, gdb expects it, and it reduces the number of relocation
+ entries. */
+
+#define DBX_BLOCKS_FUNCTION_RELATIVE 1
+
+/* When using stabs, gcc2_compiled must be a stabs entry, not an
+ ordinary symbol, or gdb won't see it. Furthermore, since gdb reads
+ the input piecemeal, starting with each N_SO, it's a lot easier if
+ the gcc2 flag symbol is *after* the N_SO rather than before it. So
+ we emit an N_OPT stab there. */
+
+#define ASM_IDENTIFY_GCC(FILE) \
+do \
+ { \
+ if (write_symbols != DBX_DEBUG) \
+ fputs ("gcc2_compiled.:\n", FILE); \
+ } \
+while (0)
+
+#define ASM_IDENTIFY_GCC_AFTER_SOURCE(FILE) \
+do \
+ { \
+ if (write_symbols == DBX_DEBUG) \
+ fputs ("\t.stabs\t\"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE); \
+ } \
+while (0)
+
+/* Like block addresses, stabs line numbers are relative to the
+ current function. */
+
+#define ASM_OUTPUT_SOURCE_LINE(file, line) \
+do \
+ { \
+ static int sym_lineno = 1; \
+ fprintf (file, ".stabn 68,0,%d,.LM%d-", \
+ line, sym_lineno); \
+ assemble_name (file, \
+ XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
+ fprintf (file, "\n.LM%d:\n", sym_lineno); \
+ sym_lineno += 1; \
+ } \
+while (0)
+
+/* In order for relative line numbers to work, we must output the
+ stabs entry for the function name first. */
+
+#define DBX_FUNCTION_FIRST
+
+/* Generate a blank trailing N_SO to mark the end of the .o file, since
+ we can't depend upon the linker to mark .o file boundaries with
+ embedded stabs. (XXX do we need this?) */
+
+#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
+do \
+ { \
+ text_section (); \
+ fprintf (FILE, \
+ "\t.stabs \"\",%d,0,0,.Letext\n.Letext:\n", N_SO); \
+ } \
+while (0)
+
+
+#undef ASM_FINAL_SPEC
+
+/* Names to predefine in the preprocessor for this target machine.
+ XXX NetBSD, by convention, shouldn't do __alpha, but lots of applications
+ expect it because that's what OSF/1 does. */
+
+/* NetBSD Extension to GNU C: __KPRINTF_ATTRIBUTE__ */
+
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES "-D__NetBSD__ -D__ELF__ -Asystem(unix) -Asystem(NetBSD) -Acpu(i386) -Amachine(i386)"
+
+/* Make gcc agree with <machine/ansi.h> */
+
+#undef SIZE_TYPE
+#define SIZE_TYPE "unsigned int"
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "int"
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "int"
+
+#undef WCHAR_UNSIGNED
+#define WCHAR_UNSIGNED 0
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
+
+/* Output assembler code to FILE to increment profiler label # LABELNO
+ for profiling a function entry. Under NetBSD/i386, the assembler does
+ nothing special with -pg. */
+
+#undef ASM_APP_ON
+#define ASM_APP_ON "#APP\n"
+
+#undef ASM_APP_OFF
+#define ASM_APP_OFF "#NO_APP\n"
+
+#define bsd4_4
+#undef HAS_INIT_SECTION
+
+#undef ASM_FILE_START
+#define ASM_FILE_START(FILE) \
+{ \
+ output_file_directive (FILE, main_input_filename); \
+ fprintf (FILE, "\t.version\t\"01.01\"\n"); \
+}
+
+/* Provide a LINK_SPEC appropriate for a NetBSD/alpha ELF target. Only
+ the linker emulation is i386-specific. The rest are
+ common to all ELF targets, except for the name of the start function. */
+
+#undef LINK_SPEC
+#define LINK_SPEC \
+ "-m elf_i386 \
+ %{assert*} %{R*} \
+ %{shared:-shared} \
+ %{!shared: \
+ -dc -dp \
+ %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
+ %{static:-static}}"
+
+#undef DEFAULT_VTABLE_THUNKS
+#define DEFAULT_VTABLE_THUNKS 1
+
+/* Attach a special .ident directive to the end of the file to identify
+ the version of GCC which compiled this code. The format of the
+ .ident string is patterned after the ones produced by native svr4
+ C compilers. */
+
+/* Output #ident as a .ident. */
+
+/* This is how to allocate empty space in some section. The .zero
+ pseudo-op is used for this on most svr4 assemblers. */
+#undef SKIP_ASM_OP
+#define SKIP_ASM_OP "\t.zero"
+
+#undef ASM_OUTPUT_SKIP
+#define ASM_OUTPUT_SKIP(FILE,SIZE) \
+ fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE))
+
+/* Output the label which precedes a jumptable. Note that for all svr4
+ systems where we actually generate jumptables (which is to say every
+ svr4 target except i386, where we use casesi instead) we put the jump-
+ tables into the .rodata section and since other stuff could have been
+ put into the .rodata section prior to any given jumptable, we have to
+ make sure that the location counter for the .rodata section gets pro-
+ perly re-aligned prior to the actual beginning of the jump table. */
+
+#define ALIGN_ASM_OP ".align"
+
+#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL
+#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
+ ASM_OUTPUT_ALIGN ((FILE), 2);
+#endif
+
+#undef ASM_OUTPUT_CASE_LABEL
+#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \
+ do { \
+ ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \
+ ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \
+ } while (0)
+
+/* The standard SVR4 assembler seems to require that certain builtin
+ library routines (e.g. .udiv) be explicitly declared as .globl
+ in each assembly file where they are referenced. */
+
+#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
+ ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
+
+/* This says how to output assembler code to declare an
+ uninitialized external linkage data object. Under SVR4,
+ the linker seems to want the alignment of data objects
+ to depend on their types. We do exactly that here. */
+
+#define COMMON_ASM_OP ".comm"
+
+#undef ASM_OUTPUT_ALIGN
+#define ASM_OUTPUT_ALIGN(FILE,LOG) \
+ if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1 << (LOG))
+
+#undef ASM_OUTPUT_ALIGNED_COMMON
+#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
+do { \
+ fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \
+ assemble_name ((FILE), (NAME)); \
+ fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
+} while (0)
+
+/* This says how to output assembler code to declare an
+ uninitialized internal linkage data object. Under SVR4,
+ the linker seems to want the alignment of data objects
+ to depend on their types. We do exactly that here. */
+
+#define LOCAL_ASM_OP ".local"
+
+#undef ASM_OUTPUT_ALIGNED_LOCAL
+#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
+do { \
+ fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP); \
+ assemble_name ((FILE), (NAME)); \
+ fprintf ((FILE), "\n"); \
+ ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
+} while (0)
+
+/* This is the pseudo-op used to generate a 32-bit word of data with a
+ specific value in some section. */
+
+#define INT_ASM_OP ".long"
+
+/* This is the pseudo-op used to generate a contiguous sequence of byte
+ values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
+ AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */
+
+#undef ASCII_DATA_ASM_OP
+#define ASCII_DATA_ASM_OP ".ascii"
+
+/* Support const sections and the ctors and dtors sections for g++.
+ Note that there appears to be two different ways to support const
+ sections at the moment. You can either #define the symbol
+ READONLY_DATA_SECTION (giving it some code which switches to the
+ readonly data section) or else you can #define the symbols
+ EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
+ SELECT_RTX_SECTION. We do both here just to be on the safe side. */
+
+#define USE_CONST_SECTION 1
+
+#define CONST_SECTION_ASM_OP ".section\t.rodata"
+
+/* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
+
+ Note that we want to give these sections the SHF_WRITE attribute
+ because these sections will actually contain data (i.e. tables of
+ addresses of functions in the current root executable or shared library
+ file) and, in the case of a shared library, the relocatable addresses
+ will have to be properly resolved/relocated (and then written into) by
+ the dynamic linker when it actually attaches the given shared library
+ to the executing process. (Note that on SVR4, you may wish to use the
+ `-z text' option to the ELF linker, when building a shared library, as
+ an additional check that you are doing everything right. But if you do
+ use the `-z text' option when building a shared library, you will get
+ errors unless the .ctors and .dtors sections are marked as writable
+ via the SHF_WRITE attribute.) */
+
+#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\""
+#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\""
+
+/* On svr4, we *do* have support for the .init and .fini sections, and we
+ can put stuff in there to be executed before and after `main'. We let
+ crtstuff.c and other files know this by defining the following symbols.
+ The definitions say how to change sections to the .init and .fini
+ sections. This is the same for all known svr4 assemblers. */
+
+#define INIT_SECTION_ASM_OP ".section\t.init"
+#define FINI_SECTION_ASM_OP ".section\t.fini"
+
+/* A default list of other sections which we might be "in" at any given
+ time. For targets that use additional sections (e.g. .tdesc) you
+ should override this definition in the target-specific file which
+ includes this file. */
+
+#undef EXTRA_SECTIONS
+#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
+
+/* A default list of extra section function definitions. For targets
+ that use additional sections (e.g. .tdesc) you should override this
+ definition in the target-specific file which includes this file. */
+
+#undef EXTRA_SECTION_FUNCTIONS
+#define EXTRA_SECTION_FUNCTIONS \
+ CONST_SECTION_FUNCTION \
+ CTORS_SECTION_FUNCTION \
+ DTORS_SECTION_FUNCTION
+
+#undef READONLY_DATA_SECTION
+#define READONLY_DATA_SECTION() const_section ()
+
+extern void text_section ();
+
+#define CONST_SECTION_FUNCTION \
+void \
+const_section () \
+{ \
+ if (!USE_CONST_SECTION) \
+ text_section(); \
+ else if (in_section != in_const) \
+ { \
+ fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
+ in_section = in_const; \
+ } \
+}
+
+#define CTORS_SECTION_FUNCTION \
+void \
+ctors_section () \
+{ \
+ if (in_section != in_ctors) \
+ { \
+ fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
+ in_section = in_ctors; \
+ } \
+}
+
+#define DTORS_SECTION_FUNCTION \
+void \
+dtors_section () \
+{ \
+ if (in_section != in_dtors) \
+ { \
+ fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
+ in_section = in_dtors; \
+ } \
+}
+
+/* Switch into a generic section.
+ This is currently only used to support section attributes.
+
+ We make the section read-only and executable for a function decl,
+ read-only for a const data decl, and writable for a non-const data decl. */
+#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
+ fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \
+ (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
+ (DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "aw")
+
+
+/* A C statement (sans semicolon) to output an element in the table of
+ global constructors. */
+#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
+ do { \
+ ctors_section (); \
+ fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
+ assemble_name (FILE, NAME); \
+ fprintf (FILE, "\n"); \
+ } while (0)
+
+/* A C statement (sans semicolon) to output an element in the table of
+ global destructors. */
+#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
+ do { \
+ dtors_section (); \
+ fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
+ assemble_name (FILE, NAME); \
+ fprintf (FILE, "\n"); \
+ } while (0)
+
+/* A C statement or statements to switch to the appropriate
+ section for output of DECL. DECL is either a `VAR_DECL' node
+ or a constant of some sort. RELOC indicates whether forming
+ the initial value of DECL requires link-time relocations. */
+
+#define SELECT_SECTION(DECL,RELOC) \
+{ \
+ if (TREE_CODE (DECL) == STRING_CST) \
+ { \
+ if (! flag_writable_strings) \
+ const_section (); \
+ else \
+ data_section (); \
+ } \
+ else if (TREE_CODE (DECL) == VAR_DECL) \
+ { \
+ if ((flag_pic && RELOC) \
+ || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
+ || !DECL_INITIAL (DECL) \
+ || (DECL_INITIAL (DECL) != error_mark_node \
+ && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
+ data_section (); \
+ else \
+ const_section (); \
+ } \
+ else \
+ const_section (); \
+}
+
+/* A C statement or statements to switch to the appropriate
+ section for output of RTX in mode MODE. RTX is some kind
+ of constant in RTL. The argument MODE is redundant except
+ in the case of a `const_int' rtx. Currently, these always
+ go into the const section. */
+
+#undef SELECT_RTX_SECTION
+#define SELECT_RTX_SECTION(MODE,RTX) const_section()
+
+/* Define the strings used for the special svr4 .type and .size directives.
+ These strings generally do not vary from one system running svr4 to
+ another, but if a given system (e.g. m88k running svr) needs to use
+ different pseudo-op names for these, they may be overridden in the
+ file which includes this one. */
+
+#define TYPE_ASM_OP ".type"
+#define SIZE_ASM_OP ".size"
+
+/* The following macro defines the format used to output the second
+ operand of the .type assembler directive. Different svr4 assemblers
+ expect various different forms for this operand. The one given here
+ is just a default. You may need to override it in your machine-
+ specific tm.h file (depending upon the particulars of your assembler). */
+
+#define TYPE_OPERAND_FMT "@%s"
+
+/* Write the extra assembler code needed to declare a function's result.
+ Most svr4 assemblers don't require any special declaration of the
+ result value, but there are exceptions. */
+
+#ifndef ASM_DECLARE_RESULT
+#define ASM_DECLARE_RESULT(FILE, RESULT)
+#endif
+
+/* These macros generate the special .type and .size directives which
+ are used to set the corresponding fields of the linker symbol table
+ entries in an ELF object file under SVR4. These macros also output
+ the starting labels for the relevant functions/objects. */
+
+/* Write the extra assembler code needed to declare a function properly.
+ Some svr4 assemblers need to also have something extra said about the
+ function's return value. We allow for that here. */
+
+#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
+ do { \
+ fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
+ assemble_name (FILE, NAME); \
+ putc (',', FILE); \
+ fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
+ putc ('\n', FILE); \
+ ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
+ ASM_OUTPUT_LABEL(FILE, NAME); \
+ } while (0)
+
+/* Write the extra assembler code needed to declare an object properly. */
+
+#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
+ do { \
+ fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
+ assemble_name (FILE, NAME); \
+ putc (',', FILE); \
+ fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
+ putc ('\n', FILE); \
+ size_directive_output = 0; \
+ if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
+ { \
+ size_directive_output = 1; \
+ fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
+ assemble_name (FILE, NAME); \
+ putc (',', FILE); \
+ fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \
+ int_size_in_bytes (TREE_TYPE (DECL))); \
+ fputc ('\n', FILE); \
+ } \
+ ASM_OUTPUT_LABEL(FILE, NAME); \
+ } while (0)
+
+/* Output the size directive for a decl in rest_of_decl_compilation
+ in the case where we did not do so before the initializer.
+ Once we find the error_mark_node, we know that the value of
+ size_directive_output was set
+ by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
+
+#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
+do { \
+ char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
+ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
+ && ! AT_END && TOP_LEVEL \
+ && DECL_INITIAL (DECL) == error_mark_node \
+ && !size_directive_output) \
+ { \
+ size_directive_output = 1; \
+ fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
+ assemble_name (FILE, name); \
+ putc (',', FILE); \
+ fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \
+ int_size_in_bytes (TREE_TYPE (DECL))); \
+ fputc ('\n', FILE); \
+ } \
+ } while (0)
+
+/* This is how to declare the size of a function. */
+
+#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
+ do { \
+ if (!flag_inhibit_size_directive) \
+ { \
+ char label[256]; \
+ static int labelno; \
+ labelno++; \
+ ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
+ ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
+ fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
+ assemble_name (FILE, (FNAME)); \
+ fprintf (FILE, ","); \
+ assemble_name (FILE, label); \
+ fprintf (FILE, "-"); \
+ assemble_name (FILE, (FNAME)); \
+ putc ('\n', FILE); \
+ } \
+ } while (0)
+
+/* This is how we tell the assembler that two symbols have the same value. */
+
+#define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
+ do { assemble_name(FILE, NAME1); \
+ fputs(" = ", FILE); \
+ assemble_name(FILE, NAME2); \
+ fputc('\n', FILE); } while (0)
+
+/* A table of bytes codes used by the ASM_OUTPUT_ASCII and
+ ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table
+ corresponds to a particular byte value [0..255]. For any
+ given byte value, if the value in the corresponding table
+ position is zero, the given character can be output directly.
+ If the table value is 1, the byte must be output as a \ooo
+ octal escape. If the tables value is anything else, then the
+ byte value should be output as a \ followed by the value
+ in the table. Note that we can use standard UN*X escape
+ sequences for many control characters, but we don't use
+ \a to represent BEL because some svr4 assemblers (e.g. on
+ the i386) don't know about that. Also, we don't use \v
+ since some versions of gas, such as 2.2 did not accept it. */
+
+#define ESCAPES \
+"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
+\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
+\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\
+\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\
+\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
+\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
+\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
+\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1"
+
+/* Some svr4 assemblers have a limit on the number of characters which
+ can appear in the operand of a .string directive. If your assembler
+ has such a limitation, you should define STRING_LIMIT to reflect that
+ limit. Note that at least some svr4 assemblers have a limit on the
+ actual number of bytes in the double-quoted string, and that they
+ count each character in an escape sequence as one byte. Thus, an
+ escape sequence like \377 would count as four bytes.
+
+ If your target assembler doesn't support the .string directive, you
+ should define this to zero.
+*/
+
+#define STRING_LIMIT ((unsigned) 256)
+
+#define STRING_ASM_OP ".string"
+
+/*
+ * We always use gas here, so we don't worry about ECOFF assembler problems.
+ */
+#undef TARGET_GAS
+#define TARGET_GAS (1)
+
+#if 0
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+#endif
+
+/* The following macros are stolen from i386v4.h */
+/* These have to be defined to get PIC code correct */
+
+/* This is how to output an element of a case-vector that is relative.
+ This is only used for PIC code. See comments by the `casesi' insn in
+ i386.md for an explanation of the expression this outputs. */
+
+#undef ASM_OUTPUT_ADDR_DIFF_ELT
+#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
+ fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
+
+/* Indicate that jump tables go in the text section. This is
+ necessary when compiling PIC code. */
+
+#define JUMP_TABLES_IN_TEXT_SECTION 1
+
+/* Default to pcc-struct-return, because this is the ELF abi and
+ we don't care about compatibility with older gcc versions. */
+#define DEFAULT_PCC_STRUCT_RETURN 1
+
+/* Profiling routines, partially copied from i386/osfrose.h. */
+
+/* Redefine this to use %eax instead of %edx. */
+#undef FUNCTION_PROFILER
+#define FUNCTION_PROFILER(FILE, LABELNO) \
+{ \
+ if (flag_pic) \
+ { \
+ fprintf (FILE, "\tcall __mcount@PLT\n"); \
+ } \
+ else \
+ { \
+ fprintf (FILE, "\tcall __mcount\n"); \
+ } \
+}
+
+/* Put relocations in the constant pool in the writable data section. */
+#undef SELECT_RTX_SECTION
+#define SELECT_RTX_SECTION(MODE,RTX) \
+{ \
+ if (flag_pic && symbolic_operand (RTX)) \
+ data_section (); \
+ else \
+ readonly_data_section (); \
+}
diff --git a/lang/gcc2/files/i386_xm-uwin.h b/lang/gcc2/files/i386_xm-uwin.h
new file mode 100644
index 00000000000..2e1ecde0fa7
--- /dev/null
+++ b/lang/gcc2/files/i386_xm-uwin.h
@@ -0,0 +1,39 @@
+/* Configuration for GNU C-compiler for hosting on Windows32.
+ using GNU tools and the Windows32 API Library.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ Contributed by Mumit Khan <khan@xraylith.wisc.edu>.
+
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
+
+GNU CC 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 GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifndef ONLY_INT_FIELD
+#define ONLY_INT_FIELDS 1
+#endif
+
+#ifndef USE_PROTOTYPES
+#define USE_PROTOTYPES 1
+#endif
+
+/* U/WIN system calls only support '/' */
+#undef DIR_SEPARATOR
+#define DIR_SEPARATOR '/'
+#undef EXECUTABLE_SUFFIX
+#define EXECUTABLE_SUFFIX ".exe"
+
+#undef PATH_SEPARATOR
+#define PATH_SEPARATOR ':'
+
diff --git a/lang/gcc2/files/m68k_netbsd-elf.h b/lang/gcc2/files/m68k_netbsd-elf.h
new file mode 100644
index 00000000000..f815bc140b9
--- /dev/null
+++ b/lang/gcc2/files/m68k_netbsd-elf.h
@@ -0,0 +1,649 @@
+/* Definitions of target machine for GNU compiler, for m68k NetBSD platforms
+ using the ELF object format.
+ Largely derived from alpha/netbsd.h, i386/netbsd-elf.h and m68k/linux.h.
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC 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 1, or (at your option)
+any later version.
+
+GNU CC 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 GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#define MOTOROLA /* Use Motorola syntax */
+#define USE_GAS /* But GAS wants jbsr instead of jsr */
+
+/* Get generic m68k definitions. */
+
+#include <m68k/m68k.h>
+
+/* Get generic NetBSD ELF definitions. We will override if necessary. */
+
+#define NETBSD_ELF
+#include <netbsd.h>
+
+/* Default target comes from config.gcc */
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT TARGET_CPU_DEFAULT
+
+
+/* Don't try using XFmode on the 68010. */
+#if TARGET_DEFAULT == 0
+#undef LONG_DOUBLE_TYPE_SIZE
+#define LONG_DOUBLE_TYPE_SIZE 64
+
+/* Use software floating point emulator for REAL_ARITHMETIC and
+ decimal <-> binary conversion. */
+#define REAL_ARITHMETIC
+#endif
+
+#ifdef __mc68010__
+#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
+#endif
+
+
+#define bsd4_4
+#undef HAS_INIT_SECTION
+
+
+#define EXTRA_SPECS \
+ { "cpp_cpu_default_spec", CPP_CPU_DEFAULT_SPEC }, \
+ { "cpp_cpu_spec", CPP_CPU_SPEC }, \
+ { "cpp_fpu_spec", CPP_FPU_SPEC }, \
+ { "asm_default_spec", ASM_DEFAULT_SPEC },
+
+
+#define CPP_CPU_SPEC \
+ "%{m68010:-D__mc68010__} \
+ %{m68020:-D__mc68020__} \
+ %{m68030:-D__mc68030__} \
+ %{m68040:-D__mc68040__} \
+ %(cpp_cpu_default_spec)"
+
+
+#undef TARGET_VERSION
+#if TARGET_DEFAULT & MASK_68020
+#define TARGET_VERSION fprintf (stderr, " (NetBSD/m68k ELF)");
+#define CPP_CPU_DEFAULT_SPEC "%{!m680*:-D__mc68020__}"
+#define ASM_DEFAULT_SPEC "%{!m680*:-m68020}"
+#else
+#define TARGET_VERSION fprintf (stderr, " (NetBSD/68010 ELF)");
+#define CPP_CPU_DEFAULT_SPEC "%{!m680*:-D__mc68010__}"
+#define ASM_DEFAULT_SPEC "%{!m680*:-m68010}"
+#endif
+
+
+#if TARGET_DEFAULT & MASK_68881
+#define CPP_FPU_SPEC "%{!msoft-float:-D__HAVE_68881__ -D__HAVE_FPU__}"
+#else
+#define CPP_FPU_SPEC "%{m68881:-D__HAVE_68881__ -D__HAVE_FPU__}"
+#endif
+
+
+#undef CPP_SPEC
+#define CPP_SPEC \
+ "%{posix:-D_POSIX_SOURCE} %(cpp_cpu_spec) %(cpp_fpu_spec)"
+
+
+#undef ASM_SPEC
+#define ASM_SPEC \
+ " %| %(asm_default_spec) \
+ %{m68010} %{m68020} %{m68030} %{m68040} %{m68060} \
+ %{fpic:-k} %{fPIC:-k -K}"
+
+
+/* Provide a set of pre-definitions and pre-assertions appropriate for
+ the m68k running svr4. */
+
+/* NetBSD extension to GNU C: __KPRINTF_ATTRIBUTE__ */
+
+#define CPP_PREDEFINES "\
+-D__m68k__ -D__NetBSD__ -D__ELF__ -D__KPRINTF_ATTRIBUTE__ -D__SVR4_ABI__ \
+-D__motorola__ -Asystem(unix) -Asystem(NetBSD) -Acpu(m68k) -Amachine(m68k)"
+
+/* This is BSD, so it wants DBX format. */
+
+#define DBX_DEBUGGING_INFO
+
+/* Make GCC agree with <machine/ansi.h>. */
+
+#undef SIZE_TYPE
+#define SIZE_TYPE "unsigned int"
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "int"
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "int"
+
+#undef WCHAR_UNSIGNED
+#define WCHAR_UNSIGNED 0
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
+
+#undef ASM_APP_ON
+#define ASM_APP_ON "#APP\n"
+
+#undef ASM_APP_OFF
+#define ASM_APP_OFF "#NO_APP\n"
+
+/* Here are four prefixes that are used by asm_fprintf to
+ facilitate customization for alternate assembler syntaxes.
+ Machines with no likelihood of an alternate syntax need not
+ define these and need not use asm_fprintf. */
+
+/* The prefix for register names. Note that REGISTER_NAMES
+ is supposed to include this prefix. Also note that this is NOT an
+ fprintf format string, it is a literal string */
+
+#undef REGISTER_PREFIX
+#define REGISTER_PREFIX "%"
+
+/* The prefix for local (compiler generated) labels.
+ These labels will not appear in the symbol table. */
+
+#undef LOCAL_LABEL_PREFIX
+#define LOCAL_LABEL_PREFIX "."
+
+/* The prefix to add to user-visible assembler symbols. */
+
+#undef USER_LABEL_PREFIX
+#define USER_LABEL_PREFIX ""
+
+#define ASM_COMMENT_START "|"
+
+/* How to refer to registers in assembler output.
+ This sequence is indexed by compiler's hard-register-number.
+ Motorola format uses different register names than defined in m68k.h.
+ We also take this chance to convert 'a6' to 'fp' */
+
+#undef REGISTER_NAMES
+
+#ifndef SUPPORT_SUN_FPA
+
+#define REGISTER_NAMES \
+{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
+ "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", \
+ "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" }
+
+#else /* SUPPORTED_SUN_FPA */
+
+#define REGISTER_NAMES \
+{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
+ "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", \
+ "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7", \
+ "%fpa0", "%fpa1", "%fpa2", "%fpa3", "%fpa4", "%fpa5", "%fpa6","%fpa7", \
+ "%fpa8", "%fpa9", "%fpa10","%fpa11","%fpa12","%fpa13","%fpa14","%fpa15", \
+ "%fpa16","%fpa17","%fpa18","%fpa19","%fpa20","%fpa21","%fpa22","%fpa23", \
+ "%fpa24","%fpa25","%fpa26","%fpa27","%fpa28","%fpa29","%fpa30","%fpa31" }
+
+#endif /* defined SUPPORT_SUN_FPA */
+
+/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
+ keep switch tables in the text section. */
+
+#define JUMP_TABLES_IN_TEXT_SECTION 1
+
+/* Use the default action for outputting the case label. */
+#undef ASM_OUTPUT_CASE_LABEL
+#define ASM_RETURN_CASE_JUMP \
+ do { \
+ if (TARGET_5200) \
+ return "ext%.l %0\n\tjmp %%pc@(2,%0:l)"; \
+ else \
+ return "jmp %%pc@(2,%0:w)"; \
+ } while (0)
+
+/* This is how to output an assembler line that says to advance the
+ location counter to a multiple of 2**LOG bytes. */
+
+#undef ALIGN_ASM_OP
+#define ALIGN_ASM_OP ".align"
+
+#undef ASM_OUTPUT_ALIGN
+#define ASM_OUTPUT_ALIGN(FILE,LOG) \
+do { \
+ if ((LOG) > 0) \
+ fprintf ((FILE), "\t%s %u\n", ALIGN_ASM_OP, 1 << (LOG)); \
+} while (0)
+
+/* If defined, a C expression whose value is a string containing the
+ assembler operation to identify the following data as uninitialized global
+ data. */
+
+#define BSS_SECTION_ASM_OP ".section\t.bss"
+
+/* A C statement (sans semicolon) to output to the stdio stream
+ FILE the assembler definition of uninitialized global DECL named
+ NAME whose size is SIZE bytes and alignment is ALIGN bytes.
+ Try to use asm_output_aligned_bss to implement this macro. */
+
+#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
+ asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
+
+/* Section output setup. */
+
+#define USE_CONST_SECTION 1
+
+#define BSS_SECTION_ASM_OP ".section\t.bss"
+#define CONST_SECTION_ASM_OP ".section\t.rodata"
+#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\""
+#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\""
+#define INIT_SECTION_ASM_OP ".section\t.init"
+#define FINI_SECTION_ASM_OP ".section\t.fini"
+
+#undef EXTRA_SECTIONS
+#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
+
+#undef EXTRA_SECTION_FUNCTIONS
+#define EXTRA_SECTION_FUNCTIONS \
+ CONST_SECTION_FUNCTION \
+ CTORS_SECTION_FUNCTION \
+ DTORS_SECTION_FUNCTION
+
+#undef READONLY_DATA_SECTION
+#define READONLY_DATA_SECTION() const_section ()
+
+extern void text_section ();
+
+#define CONST_SECTION_FUNCTION \
+void \
+const_section () \
+{ \
+ if (!USE_CONST_SECTION) \
+ text_section(); \
+ else if (in_section != in_const) \
+ { \
+ fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
+ in_section = in_const; \
+ } \
+}
+
+#define CTORS_SECTION_FUNCTION \
+void \
+ctors_section () \
+{ \
+ if (in_section != in_ctors) \
+ { \
+ fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
+ in_section = in_ctors; \
+ } \
+}
+
+#define DTORS_SECTION_FUNCTION \
+void \
+dtors_section () \
+{ \
+ if (in_section != in_dtors) \
+ { \
+ fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
+ in_section = in_dtors; \
+ } \
+}
+
+/* Switch into a generic section.
+ This is currently only used to support section attributes.
+
+ We make the section read-only and executable for a function decl,
+ read-only for a const data decl, and writable for a non-const data decl. */
+#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
+ fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \
+ (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
+ (DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "aw")
+
+/* A C statement (sans semicolon) to output an element in the table of
+ global constructors. */
+#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
+ do { \
+ ctors_section (); \
+ fprintf (FILE, "\t.long\t "); \
+ assemble_name (FILE, NAME); \
+ fprintf (FILE, "\n"); \
+ } while (0)
+
+/* A C statement (sans semicolon) to output an element in the table of
+ global destructors. */
+#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
+ do { \
+ dtors_section (); \
+ fprintf (FILE, "\t.long\t "); \
+ assemble_name (FILE, NAME); \
+ fprintf (FILE, "\n"); \
+ } while (0)
+
+/* These macros generate the special .type and .size directives which
+ are used to set the corresponding fields of the linker symbol table
+ entries in an ELF object file under SVR4. These macros also output
+ the starting labels for the relevant functions/objects. */
+
+/* Write the extra assembler code needed to declare a function properly.
+ Some svr4 assemblers need to also have something extra said about the
+ function's return value. We allow for that here. */
+
+#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
+ do { \
+ fprintf (FILE, "\t%s\t", TYPE_ASM_OP); \
+ assemble_name (FILE, NAME); \
+ putc (',', FILE); \
+ fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
+ putc ('\n', FILE); \
+ ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
+ ASM_OUTPUT_LABEL(FILE, NAME); \
+ } while (0)
+
+/* Write the extra assembler code needed to declare an object properly. */
+
+#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
+ do { \
+ fprintf (FILE, "\t%s\t", TYPE_ASM_OP); \
+ assemble_name (FILE, NAME); \
+ putc (',', FILE); \
+ fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
+ putc ('\n', FILE); \
+ size_directive_output = 0; \
+ if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
+ { \
+ size_directive_output = 1; \
+ fprintf (FILE, "\t%s\t", SIZE_ASM_OP); \
+ assemble_name (FILE, NAME); \
+ putc (',', FILE); \
+ fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \
+ int_size_in_bytes (TREE_TYPE (DECL))); \
+ fputc ('\n', FILE); \
+ } \
+ ASM_OUTPUT_LABEL(FILE, NAME); \
+ } while (0)
+
+/* Output the size directive for a decl in rest_of_decl_compilation
+ in the case where we did not do so before the initializer.
+ Once we find the error_mark_node, we know that the value of
+ size_directive_output was set
+ by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
+
+#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
+do { \
+ char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
+ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
+ && ! AT_END && TOP_LEVEL \
+ && DECL_INITIAL (DECL) == error_mark_node \
+ && !size_directive_output) \
+ { \
+ size_directive_output = 1; \
+ fprintf (FILE, "\t%s\t", SIZE_ASM_OP); \
+ assemble_name (FILE, name); \
+ putc (',', FILE); \
+ fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \
+ int_size_in_bytes (TREE_TYPE (DECL))); \
+ fputc ('\n', FILE); \
+ } \
+ } while (0)
+
+/* This is how to declare the size of a function. */
+
+#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
+ do { \
+ if (!flag_inhibit_size_directive) \
+ { \
+ char label[256]; \
+ static int labelno; \
+ labelno++; \
+ ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
+ ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
+ fprintf (FILE, "\t%s\t", SIZE_ASM_OP); \
+ assemble_name (FILE, (FNAME)); \
+ fprintf (FILE, ","); \
+ assemble_name (FILE, label); \
+ fprintf (FILE, "-"); \
+ assemble_name (FILE, (FNAME)); \
+ putc ('\n', FILE); \
+ } \
+ } while (0)
+
+/* This is how we tell the assembler that two symbols have the same value. */
+
+#define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
+ do { assemble_name(FILE, NAME1); \
+ fputs(" = ", FILE); \
+ assemble_name(FILE, NAME2); \
+ fputc('\n', FILE); } while (0)
+
+#undef ASM_OUTPUT_COMMON
+#undef ASM_OUTPUT_LOCAL
+#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
+( fputs (".comm ", (FILE)), \
+ assemble_name ((FILE), (NAME)), \
+ fprintf ((FILE), ",%u\n", (SIZE)))
+
+#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
+( fputs (".lcomm ", (FILE)), \
+ assemble_name ((FILE), (NAME)), \
+ fprintf ((FILE), ",%u\n", (SIZE)))
+
+/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
+ keep switch tables in the text section. */
+
+#define JUMP_TABLES_IN_TEXT_SECTION 1
+
+/* Output assembler code to FILE to increment profiler label # LABELNO
+ for profiling a function entry. */
+
+#undef FUNCTION_PROFILER
+#define FUNCTION_PROFILER(FILE, LABELNO) \
+do { \
+ asm_fprintf (FILE, "\tlea (%LLP%d,%Rpc),%Ra1\n", (LABELNO)); \
+ if (flag_pic) \
+ fprintf (FILE, "\tbsr.l __mcount@PLTPC\n"); \
+ else \
+ fprintf (FILE, "\tjbsr __mcount\n"); \
+} while (0)
+
+/* Register in which address to store a structure value is passed to a
+ function. The default in m68k.h is a1. For m68k/SVR4 it is a0. */
+
+#undef STRUCT_VALUE_REGNUM
+#define STRUCT_VALUE_REGNUM 8
+
+/* Register in which static-chain is passed to a function. The
+ default in m68k.h is a0, but that is already the struct value
+ regnum. Make it a1 instead. */
+
+#undef STATIC_CHAIN_REGNUM
+#define STATIC_CHAIN_REGNUM 9
+
+/* How to renumber registers for dbx and gdb.
+ On the Sun-3, the floating point registers have numbers
+ 18 to 25, not 16 to 23 as they do in the compiler. */
+
+#define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2)
+
+/* Do not break .stabs pseudos into continuations. */
+
+#define DBX_CONTIN_LENGTH 0
+
+/* 1 if N is a possible register number for a function value. For
+ m68k/SVR4 allow d0, a0, or fp0 as return registers, for integral,
+ pointer, or floating types, respectively. Reject fp0 if not using
+ a 68881 coprocessor. */
+
+#undef FUNCTION_VALUE_REGNO_P
+#define FUNCTION_VALUE_REGNO_P(N) \
+ ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
+
+/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
+ more than one register. */
+
+#undef NEEDS_UNTYPED_CALL
+#define NEEDS_UNTYPED_CALL 1
+
+/* Define how to generate (in the callee) the output value of a
+ function and how to find (in the caller) the value returned by a
+ function. VALTYPE is the data type of the value (as a tree). If
+ the precise function being called is known, FUNC is its
+ FUNCTION_DECL; otherwise, FUNC is 0. For m68k/SVR4 generate the
+ result in d0, a0, or fp0 as appropriate. */
+
+#undef FUNCTION_VALUE
+#define FUNCTION_VALUE(VALTYPE, FUNC) \
+ (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881 \
+ ? gen_rtx_REG (TYPE_MODE (VALTYPE), 16) \
+ : (POINTER_TYPE_P (VALTYPE) \
+ ? gen_rtx_REG (TYPE_MODE (VALTYPE), 8) \
+ : gen_rtx_REG (TYPE_MODE (VALTYPE), 0)))
+
+/* For compatibility with the large body of existing code which does
+ not always properly declare external functions returning pointer
+ types, the m68k/SVR4 convention is to copy the value returned for
+ pointer functions from a0 to d0 in the function epilogue, so that
+ callers that have neglected to properly declare the callee can
+ still find the correct return value. */
+
+extern int current_function_returns_pointer;
+#define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
+do { \
+ if ((current_function_returns_pointer) && \
+ ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode)) \
+ asm_fprintf (FILE, "\tmove.l %Ra0,%Rd0\n"); \
+} while (0);
+
+/* Define how to find the value returned by a library function
+ assuming the value has mode MODE.
+ For m68k/SVR4 look for integer values in d0, pointer values in d0
+ (returned in both d0 and a0), and floating values in fp0. */
+
+#undef LIBCALL_VALUE
+#define LIBCALL_VALUE(MODE) \
+ ((((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode) \
+ && TARGET_68881) \
+ ? gen_rtx_REG (MODE, 16) \
+ : gen_rtx_REG (MODE, 0))
+
+/* Boundary (in *bits*) on which stack pointer should be aligned.
+ The m68k/SVR4 convention is to keep the stack pointer longword aligned. */
+
+#undef STACK_BOUNDARY
+#define STACK_BOUNDARY 32
+
+/* Alignment of field after `int : 0' in a structure.
+ For m68k/SVR4, this is the next longword boundary. */
+
+#undef EMPTY_FIELD_BOUNDARY
+#define EMPTY_FIELD_BOUNDARY 32
+
+/* No data type wants to be aligned rounder than this.
+ For m68k/SVR4, some types (doubles for example) are aligned on 8 byte
+ boundaries */
+
+#undef BIGGEST_ALIGNMENT
+#define BIGGEST_ALIGNMENT 64
+
+/* In m68k svr4, a symbol_ref rtx can be a valid PIC operand if it is
+ an operand of a function call. */
+#undef LEGITIMATE_PIC_OPERAND_P
+#define LEGITIMATE_PIC_OPERAND_P(X) \
+ ((! symbolic_operand (X, VOIDmode) \
+ && ! (GET_CODE (X) == CONST_DOUBLE && CONST_DOUBLE_MEM (X) \
+ && GET_CODE (CONST_DOUBLE_MEM (X)) == MEM \
+ && symbolic_operand (XEXP (CONST_DOUBLE_MEM (X), 0), VOIDmode))) \
+ || (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_FLAG (X)))
+
+/* Turn off function cse if we are doing PIC. We always want function
+ call to be done as `bsr foo@PLTPC', so it will force the assembler
+ to create the PLT entry for `foo'. Doing function cse will cause
+ the address of `foo' to be loaded into a register, which is exactly
+ what we want to avoid when we are doing PIC on svr4 m68k. */
+#undef SUBTARGET_OVERRIDE_OPTIONS
+#define SUBTARGET_OVERRIDE_OPTIONS \
+ if (flag_pic) flag_no_function_cse = 1;
+
+/* For m68k SVR4, structures are returned using the reentrant
+ technique. */
+
+#undef PCC_STATIC_STRUCT_RETURN
+
+/* The svr4 ABI for the m68k says that records and unions are returned
+ in memory. */
+
+#define DEFAULT_PCC_STRUCT_RETURN 1
+
+/* Output code to add DELTA to the first argument, and then jump to FUNCTION.
+ Used for C++ multiple inheritance. */
+#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
+do { \
+ if (DELTA > 0 && DELTA <= 8) \
+ asm_fprintf (FILE, "\taddq.l %I%d,4(%Rsp)\n", DELTA); \
+ else if (DELTA < 0 && DELTA >= -8) \
+ asm_fprintf (FILE, "\tsubq.l %I%d,4(%Rsp)\n", -DELTA); \
+ else \
+ asm_fprintf (FILE, "\tadd.l %I%d,4(%Rsp)\n", DELTA); \
+ \
+ if (flag_pic) \
+ { \
+ fprintf (FILE, "\tbra.l "); \
+ assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
+ fprintf (FILE, "@PLTPC\n"); \
+ } \
+ else \
+ { \
+ fprintf (FILE, "\tjmp "); \
+ assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
+ fprintf (FILE, "\n"); \
+ } \
+} while (0)
+
+/* Output assembler code for a block containing the constant parts
+ of a trampoline, leaving space for the variable parts. */
+
+/* On m68k svr4, the trampoline is different from the generic version
+ in that we use a1 as the static call chain. */
+
+#undef TRAMPOLINE_TEMPLATE
+#define TRAMPOLINE_TEMPLATE(FILE) \
+{ \
+ ASM_OUTPUT_SHORT (FILE, GEN_INT (0x227a)); \
+ ASM_OUTPUT_SHORT (FILE, GEN_INT (8)); \
+ ASM_OUTPUT_SHORT (FILE, GEN_INT (0x2f3a)); \
+ ASM_OUTPUT_SHORT (FILE, GEN_INT (8)); \
+ ASM_OUTPUT_SHORT (FILE, GEN_INT (0x4e75)); \
+ ASM_OUTPUT_INT (FILE, const0_rtx); \
+ ASM_OUTPUT_INT (FILE, const0_rtx); \
+}
+
+/* Redefine since we are using a different trampoline */
+#undef TRAMPOLINE_SIZE
+#define TRAMPOLINE_SIZE 18
+
+/* Emit RTL insns to initialize the variable parts of a trampoline.
+ FNADDR is an RTX for the address of the function's pure code.
+ CXT is an RTX for the static chain value for the function. */
+
+#undef INITIALIZE_TRAMPOLINE
+#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
+{ \
+ emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 10)), CXT); \
+ emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 14)), FNADDR); \
+}
+
+/* Provide a LINK_SPEC appropriate for a NetBSD ELF target.
+ Differs only in explicit emulation selection. */
+#undef LINK_SPEC
+#define LINK_SPEC \
+ "-m m68kelfnbsd \
+ %{assert*} \
+ %{shared:-shared} \
+ %{!shared: \
+ -dc -dp \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
+ %{static:-static}}"
diff --git a/lang/gcc2/files/mips_t-mipseb b/lang/gcc2/files/mips_t-mipseb
new file mode 100644
index 00000000000..9379a12f6a8
--- /dev/null
+++ b/lang/gcc2/files/mips_t-mipseb
@@ -0,0 +1 @@
+T_CFLAGS +=-DTARGET_BIG_ENDIAN_DEFAULT
diff --git a/lang/gcc2/files/rs6000_netbsd.h b/lang/gcc2/files/rs6000_netbsd.h
new file mode 100644
index 00000000000..80f52ae9032
--- /dev/null
+++ b/lang/gcc2/files/rs6000_netbsd.h
@@ -0,0 +1,73 @@
+/* Start with SVR4 defaults. */
+#include <rs6000/sysv4.h>
+
+/* Get generic NetBSD definitions. */
+
+#define NETBSD_ELF
+#include <netbsd.h>
+
+#undef SDB_DEBUGGING_INFO
+#define SDB_DEBUGGING_INFO
+#undef DBX_DEBUGGING_INFO
+#define DBX_DEBUGGING_INFO
+
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+
+/* Names to predefine in the preprocessor for this target machine. */
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES "\
+-D__powerpc__ -D__NetBSD__ -D__ELF__ \
+-Asystem(unix) -Asystem(NetBSD) -Acpu(powerpc) -Amachine(powerpc)"
+
+/* Make gcc agree with <machine/ansi.h> */
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "int"
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
+
+/* Don't default to pcc-struct-return, because gcc is the only compiler, and
+ we want to retain compatibility with older gcc versions. */
+#define DEFAULT_PCC_STRUCT_RETURN 0
+
+/* XXX Duplicated from sysv4.h --thorpej@netbsd.org
+ Pass -mppc to the assembler, since that is what powerpc.h currently
+ implies */
+#undef ASM_SPEC
+#define ASM_SPEC \
+ "-u \
+%{mcpu=601: -m601} %{!mcpu=601: -mppc} \
+%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
+%{mrelocatable} \
+%{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian}"
+
+/* The `multiple' instructions may not be universally implemented.
+ We avoid their use here. */
+#undef CC1_SPEC
+#define CC1_SPEC "-mno-multiple"
+
+/* Provide a LINK_SPEC approriate for NetBSD. */
+#undef LINK_SPEC
+#define LINK_SPEC " \
+ %{O*:-O3} %{!O*:-O1} \
+ %{assert*} %{R*} \
+ %{shared:-shared} \
+ %{!shared: \
+ -dc -dp \
+ %{!nostdlib:%{!r*:%{!e*:-e _start}}} \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
+ %{static:-static}}"
+
+/* XXX Sort of a mix of ../netbsd.h and sysv4.h --thorpej@netbsd.org
+ Provide a CPP_SPEC appropriate for NetBSD. Currently we just deal with
+ the GCC option `-posix' and the calling convention definition. */
+
+#undef CPP_SPEC
+#define CPP_SPEC "\
+%{posix:-D_POSIX_SOURCE} \
+%{msoft-float:-D_SOFT_FLOAT} \
+%{mcall-sysv: -D_CALL_SYSV} %{mcall-aix: -D_CALL_AIX} %{!mcall-sysv: %{!mcall-aix: -D_CALL_SYSV}}"
diff --git a/lang/gcc2/files/sh_netbsd-elf-little.h b/lang/gcc2/files/sh_netbsd-elf-little.h
new file mode 100644
index 00000000000..2a4c8ceafa8
--- /dev/null
+++ b/lang/gcc2/files/sh_netbsd-elf-little.h
@@ -0,0 +1,50 @@
+/* Definitions of target machine for gcc for Hitachi Super-H using ELF.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Contributed by Ian Lance Taylor <ian@cygnus.com>.
+
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
+
+GNU CC 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 GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#undef CPP_SPEC
+#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} \
+%{!mb:-D__LITTLE_ENDIAN__} \
+%{m1:-D__sh1__} \
+%{m2:-D__sh2__} \
+%{m3:-D__sh3__} \
+%{m3e:-D__SH3E__} \
+%{m4-single-only:-D__SH4_SINGLE_ONLY__} \
+%{m4-single:-D__SH4_SINGLE__} \
+%{m4:-D__SH4__} \
+%{!m1:%{!m2:%{!m3:%{!m3e:%{!m4:%{!m4-single:%{!m4-single-only:-D__sh1__}}}}}}} \
+%{mhitachi:-D__HITACHI__}"
+
+/* Pass -ml and -mrelax to the assembler and linker. */
+#undef ASM_SPEC
+#define ASM_SPEC "%{!mb:-little} %{mrelax:-relax}"
+
+#undef LINK_SPEC
+#define LINK_SPEC \
+"%{mb:-m elf32shnbsd} %{mrelax:-relax} \
+ %{assert*} \
+ %{shared:-shared} \
+ %{!shared: \
+ -dc -dp \
+ %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
+ %{static:-static}}"
diff --git a/lang/gcc2/files/sh_netbsd-elf.h b/lang/gcc2/files/sh_netbsd-elf.h
new file mode 100644
index 00000000000..ae8d550043f
--- /dev/null
+++ b/lang/gcc2/files/sh_netbsd-elf.h
@@ -0,0 +1,166 @@
+/* Definitions of target machine for gcc for Hitachi Super-H using ELF.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Contributed by Ian Lance Taylor <ian@cygnus.com>.
+
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
+
+GNU CC 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 GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* Mostly like the regular SH configuration. */
+#include "sh/sh.h"
+
+/* No SDB debugging info. */
+#undef SDB_DEBUGGING_INFO
+
+/* Undefine some macros defined in both sh.h and svr4.h. */
+#undef IDENT_ASM_OP
+#undef ASM_FILE_END
+#undef ASM_OUTPUT_SOURCE_LINE
+#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
+#undef CTORS_SECTION_ASM_OP
+#undef DTORS_SECTION_ASM_OP
+#undef ASM_OUTPUT_SECTION_NAME
+#undef ASM_OUTPUT_CONSTRUCTOR
+#undef ASM_OUTPUT_DESTRUCTOR
+#undef ASM_DECLARE_FUNCTION_NAME
+#undef PREFERRED_DEBUGGING_TYPE
+#undef MAX_OFILE_ALIGNMENT
+
+/* Be ELF-like. */
+#include "svr4.h"
+
+/* Get generic NetBSD ELF definitions. */
+#define NETBSD_ELF
+#include <netbsd.h>
+
+#define OBJECT_FORMAT_ELF
+
+/* NetBSD uses the SVR4 convention for user-visible assembler symbols,
+ not the SH convention. */
+
+#undef LOCAL_LABEL_PREFIX
+#define LOCAL_LABEL_PREFIX "."
+
+#undef ASM_FILE_START
+#define ASM_FILE_START(FILE) do { \
+ output_file_directive ((FILE), main_input_filename); \
+ if (TARGET_LITTLE_ENDIAN) \
+ fprintf ((FILE), "\t.little\n"); \
+} while (0)
+
+#undef CPP_SPEC
+#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} \
+%{ml:-D__LITTLE_ENDIAN__} \
+%{m1:-D__sh1__} \
+%{m2:-D__sh2__} \
+%{m3:-D__sh3__} \
+%{m3e:-D__SH3E__} \
+%{m4-single-only:-D__SH4_SINGLE_ONLY__} \
+%{m4-single:-D__SH4_SINGLE__} \
+%{m4:-D__SH4__} \
+%{!m1:%{!m2:%{!m3:%{!m3e:%{!m4:%{!m4-single:%{!m4-single-only:-D__sh1__}}}}}}} \
+%{mhitachi:-D__HITACHI__}"
+
+/* Let code know that this is ELF. */
+#define CPP_PREDEFINES \
+"-D__sh__ -D__NetBSD__ -D__ELF__ -D__NO_LEADING_UNDERSCORES__ \
+-D__KPRINTF_ATTRIBUTE__ \
+-Asystem(unix) -Asystem(NetBSD) -Acpu(sh) -Amachine(sh)"
+
+/* Pass -ml and -mrelax to the assembler and linker. */
+#undef ASM_SPEC
+#define ASM_SPEC "%{ml:-little} %{mrelax:-relax}"
+
+#undef LINK_SPEC
+#define LINK_SPEC \
+"%{ml:-m elf32shlnbsd} %{mrelax:-relax} \
+ %{assert*} \
+ %{shared:-shared} \
+ %{!shared: \
+ -dc -dp \
+ %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
+ %{static:-static}}"
+
+/* svr4.h undefined DBX_REGISTER_NUMBER, so we need to define it
+ again. */
+#define DBX_REGISTER_NUMBER(REGNO) \
+ (((REGNO) >= 22 && (REGNO) <= 39) ? ((REGNO) + 1) : (REGNO))
+
+#undef ASM_GENERATE_INTERNAL_LABEL
+#define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
+ sprintf ((STRING), "*%s%s%d", LOCAL_LABEL_PREFIX, (PREFIX), (NUM))
+
+#undef ASM_OUTPUT_INTERNAL_LABEL
+#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
+ asm_fprintf ((FILE), "%L%s%d:\n", (PREFIX), (NUM))
+
+#undef ASM_OUTPUT_SOURCE_LINE
+#define ASM_OUTPUT_SOURCE_LINE(file, line) \
+do \
+ { \
+ static int sym_lineno = 1; \
+ asm_fprintf ((file), ".stabn 68,0,%d,%LLM%d-", \
+ (line), sym_lineno); \
+ assemble_name ((file), \
+ XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
+ asm_fprintf ((file), "\n%LLM%d:\n", sym_lineno); \
+ sym_lineno += 1; \
+ } \
+while (0)
+
+#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
+#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
+do { \
+ text_section (); \
+ fprintf ((FILE), "\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO); \
+} while (0)
+
+/* HANDLE_SYSV_PRAGMA (defined by svr4.h) takes precedence over HANDLE_PRAGMA.
+ We want to use the HANDLE_PRAGMA from sh.h. */
+#undef HANDLE_SYSV_PRAGMA
+
+/* XXX shouldn't use "1f"-style labels */
+#undef FUNCTION_PROFILER
+#define FUNCTION_PROFILER(STREAM,LABELNO) \
+{ \
+ fprintf((STREAM), "\tmov.l\t11f,r1\n"); \
+ fprintf((STREAM), "\tmova\t12f,r0\n"); \
+ fprintf((STREAM), "\tjmp\t@r1\n"); \
+ fprintf((STREAM), "\tnop\n"); \
+ fprintf((STREAM), "\t.align\t2\n"); \
+ fprintf((STREAM), "11:\t.long\t__mcount\n"); \
+ fprintf((STREAM), "12:\n"); \
+}
+
+/* Make gcc agree with <machine/ansi.h> */
+
+#undef SIZE_TYPE
+#define SIZE_TYPE "unsigned int"
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "int"
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "int"
+
+#undef WCHAR_UNSIGNED
+#define WCHAR_UNSIGNED 0
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
diff --git a/lang/gcc2/files/sparc_netbsd-elf-common.h b/lang/gcc2/files/sparc_netbsd-elf-common.h
new file mode 100644
index 00000000000..89af4182e61
--- /dev/null
+++ b/lang/gcc2/files/sparc_netbsd-elf-common.h
@@ -0,0 +1,69 @@
+/* NetBSD/sparc ELF common 32/64 bit configuration */
+
+#define OBJECT_FORMAT_ELF
+#define NETBSD_ELF
+#include <netbsd.h>
+
+/* Fix up CPP_SPEC. This merges the code from <netbsd.h> and <sparc/sparc.h> */
+#undef CPP_SPEC
+#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} \
+%(cpp_cpu) %(cpp_arch) %(cpp_endian) %(cpp_subtarget)"
+
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES "-D__sparc__ -D__NetBSD__ -D__ELF__ \
+-Asystem(unix) -Asystem(NetBSD)"
+
+#undef SIZE_TYPE
+#define SIZE_TYPE "long unsigned int"
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "long int"
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "int"
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
+
+#undef WCHAR_UNSIGNED
+#define WCHAR_UNSIGNED 0
+
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+
+/* This is the char to use for continuation (in case we need to turn
+ continuation back on). */
+#undef DBX_CONTIN_CHAR
+#define DBX_CONTIN_CHAR '?'
+
+#undef DBX_REGISTER_NUMBER
+#define DBX_REGISTER_NUMBER(REGNO) \
+ (TARGET_FLAT && REGNO == FRAME_POINTER_REGNUM ? 31 : REGNO)
+
+/* This is how to output a definition of an internal numbered label where
+ PREFIX is the class of label and NUM is the number within the class. */
+
+#undef ASM_OUTPUT_INTERNAL_LABEL
+#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
+ fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
+
+/* This is how to store into the string LABEL
+ the symbol_ref name of an internal numbered label where
+ PREFIX is the class of label and NUM is the number within the class.
+ This is suitable for output with `assemble_name'. */
+
+#undef ASM_GENERATE_INTERNAL_LABEL
+#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
+ sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
+
+#undef ASM_SPEC
+#define ASM_SPEC "%{fpic:-K PIC} %{fPIC:-K PIC} \
+%{mlittle-endian:-EL} \
+%(asm_cpu) %(asm_arch)\
+"
+
+#undef STDC_0_IN_SYSTEM_HEADERS
+
+/* XXX Redefine this; <sparc/sparc.h> mucks with it. */
+#undef TARGET_VERSION
+#define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
diff --git a/lang/gcc2/files/sparc_netbsd-elf.h b/lang/gcc2/files/sparc_netbsd-elf.h
new file mode 100644
index 00000000000..dcfa9dece28
--- /dev/null
+++ b/lang/gcc2/files/sparc_netbsd-elf.h
@@ -0,0 +1,42 @@
+/* NetBSD/sparc ELF configuration */
+
+/*
+ * Pull in generic SPARC ELF configuration, and then clean up
+ * afterwards
+ */
+#include <sparc/elf.h>
+
+/* Name the target CPU. */
+#ifndef TARGET_CPU_DEFAULT
+#define TARGET_CPU_DEFAULT TARGET_CPU_sparc
+#endif
+
+#undef MULDI3_LIBCALL
+#undef DIVDI3_LIBCALL
+#undef UDIVDI3_LIBCALL
+#undef MODDI3_LIBCALL
+#undef UMODDI3_LIBCALL
+#undef INIT_SUBTARGET_OPTABS
+#define INIT_SUBTARGET_OPTABS
+
+#undef CPP_SUBTARGET_SPEC
+#define CPP_SUBTARGET_SPEC "-D__sparc"
+
+#include <sparc/netbsd-elf-common.h>
+
+#undef LINK_SPEC
+#define LINK_SPEC \
+ "-m elf32_sparc \
+ %{assert*} %{R*} \
+ %{shared:-shared} \
+ %{!shared: \
+ -dy -dc -dp \
+ %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
+ %{static:-static}}"
+
+/* Name the port. */
+#undef TARGET_NAME
+#define TARGET_NAME "sparc-netbsdelf"
diff --git a/lang/gcc2/files/sparc_netbsd64.h b/lang/gcc2/files/sparc_netbsd64.h
new file mode 100644
index 00000000000..2f9a984befc
--- /dev/null
+++ b/lang/gcc2/files/sparc_netbsd64.h
@@ -0,0 +1,182 @@
+/* NetBSD/sparc64 ELF configuration */
+
+/*
+ * Pull in generic SPARC64 ELF configuration, and then clean up
+ * afterwards
+ */
+
+/* Let us output 32 bit code as well */
+#define SPARC_BI_ARCH
+
+/* Name the target CPU. This must be before <sparc/sparc.h>. */
+#ifndef TARGET_CPU_DEFAULT
+#define TARGET_CPU_DEFAULT TARGET_CPU_ultrasparc
+#endif
+
+#include <sparc/sp64-elf.h>
+
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT \
+(MASK_V9 + MASK_PTR64 + MASK_64BIT + /* MASK_HARD_QUAD */ \
+ + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU + MASK_STACK_BIAS)
+
+#undef SPARC_DEFAULT_CMODEL
+#define SPARC_DEFAULT_CMODEL CM_MEDANY
+
+#undef INIT_SUBTARGET_OPTABS
+#define INIT_SUBTARGET_OPTABS
+
+#include <sparc/netbsd-elf-common.h>
+
+#undef CPP_SUBTARGET_SPEC
+#define CPP_SUBTARGET_SPEC "-D__sparc64__"
+
+#undef LINK_SPEC64
+#define LINK_SPEC64 \
+ "-m elf64_sparc \
+ %{assert*} %{R*} \
+ %{shared:-shared} \
+ %{!shared: \
+ -dy -dc -dp \
+ %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
+ %{static:-static}}"
+
+#undef LINK_SPEC
+#define LINK_SPEC LINK_SPEC64
+
+#ifdef SPARC_BI_ARCH
+
+#undef STARTFILE_SPEC64
+#define STARTFILE_SPEC64 \
+ "%{!shared: \
+ %{pg:gcrt0%O%s} \
+ %{!pg: \
+ %{p:gcrt0%O%s} \
+ %{!p:crt0%O%s}}} \
+ %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}"
+
+#undef STARTFILE_SPEC32
+#define STARTFILE_SPEC32 \
+ "%{!shared: \
+ %{pg:/usr/lib/32/gcrt0%O%s} \
+ %{!pg: \
+ %{p:/usr/lib/32/gcrt0%O%s} \
+ %{!p:/usr/lib/32/crt0%O%s}}} \
+ %{!shared:/usr/lib/32/crtbegin%O%s} %{shared:/usr/lib/32/crtbeginS%O%s}"
+
+#undef STARTFILE_SPEC
+#if DEFAULT_ARCH32_P
+#define STARTFILE_SPEC "\
+%{m32:" STARTFILE_SPEC32 "} \
+%{m64:" STARTFILE_SPEC64 "} \
+%{!m32:%{!m64:" STARTFILE_SPEC32 "}}"
+#else
+#define STARTFILE_SPEC "\
+%{m32:" STARTFILE_SPEC32 "} \
+%{m64:" STARTFILE_SPEC64 "} \
+%{!m32:%{!m64:" STARTFILE_SPEC64 "}}"
+#endif
+
+#undef ENDFILE_SPEC64
+#define ENDFILE_SPEC64 \
+ "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
+
+#undef ENDFILE_SPEC32
+#define ENDFILE_SPEC32 \
+ "%{!shared:/usr/lib/32/crtend%O%s} %{shared:/usr/lib/32/crtendS%O%s}"
+
+#undef ENDFILE_SPEC
+#if DEFAULT_ARCH32_P
+#define ENDFILE_SPEC "\
+%{m32:" ENDFILE_SPEC32 "} \
+%{m64:" ENDFILE_SPEC64 "} \
+%{!m32:%{!m64:" ENDFILE_SPEC32 "}}"
+#else
+#define ENDFILE_SPEC "\
+%{m32:" ENDFILE_SPEC32 "} \
+%{m64:" ENDFILE_SPEC64 "} \
+%{!m32:%{!m64:" ENDFILE_SPEC64 "}}"
+#endif
+
+#undef SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS \
+ { "link_arch32", LINK_ARCH32_SPEC }, \
+ { "link_arch64", LINK_ARCH64_SPEC }, \
+ { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
+ { "link_arch", LINK_ARCH_SPEC },
+
+#undef LINK_ARCH32_SPEC
+#define LINK_ARCH32_SPEC \
+ "-m elf32_sparc \
+ -Y P,/usr/lib/32 \
+ %{assert*} %{R*} \
+ %{shared:-shared} \
+ %{!shared: \
+ -dy -dc -dp \
+ %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
+ %{static:-static}}"
+
+#undef LINK_ARCH64_SPEC
+#define LINK_ARCH64_SPEC LINK_SPEC64
+
+#define LINK_ARCH_SPEC "\
+%{m32:%(link_arch32)} \
+%{m64:%(link_arch64)} \
+%{!m32:%{!m64:%(link_arch_default)}} \
+"
+
+#define LINK_ARCH_DEFAULT_SPEC \
+(DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
+
+#undef LINK_SPEC
+#define LINK_SPEC "\
+%(link_arch) \
+%{mlittle-endian:-EL} \
+"
+
+#undef CC1_SPEC
+#if DEFAULT_ARCH32_P
+#define CC1_SPEC "\
+%{sun4:} %{target:} \
+%{mcypress:-mcpu=cypress} \
+%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
+%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
+%{m64:-mptr64 -mcpu=ultrasparc -mstack-bias %{p*:-mcmodel=medlow}
+%{p:-mcmodel=medlow}} \
+"
+#else
+#define CC1_SPEC "\
+%{sun4:} %{target:} \
+%{mcypress:-mcpu=cypress} \
+%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
+%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
+%{m32:-mptr32 -mcpu=cypress -mno-stack-bias} \
+%{!m32:%{p*:-mcmodel=medlow}} \
+"
+#endif
+
+#if DEFAULT_ARCH32_P
+#define MULTILIB_DEFAULTS { "m32" }
+#else
+#define MULTILIB_DEFAULTS { "m64" }
+#endif
+
+#undef CPP_SUBTARGET_SPEC
+#define CPP_SUBTARGET_SPEC \
+(DEFAULT_ARCH32_P ? "\
+%{m64:-D__sparc64__}%{!m64:-D__sparc} \
+" : "\
+%{!m32:-D__sparc64__}%{m32:-D__sparc} \
+")
+
+#endif /* SPARC_BI_ARCH */
+
+/* Name the port. */
+#undef TARGET_NAME
+#define TARGET_NAME "sparc64-netbsd"
diff --git a/lang/gcc2/files/sparc_t-netbsd b/lang/gcc2/files/sparc_t-netbsd
new file mode 100644
index 00000000000..27da77cbe79
--- /dev/null
+++ b/lang/gcc2/files/sparc_t-netbsd
@@ -0,0 +1,2 @@
+# The NetBSD libc has all the needed libgcc1 stubs.
+LIBGCC1_TEST=
diff --git a/lang/gcc2/files/vax_netbsd-elf.h b/lang/gcc2/files/vax_netbsd-elf.h
new file mode 100644
index 00000000000..f996e9c5ecb
--- /dev/null
+++ b/lang/gcc2/files/vax_netbsd-elf.h
@@ -0,0 +1,101 @@
+/* Definitions of target machine for GNU compiler,
+ for vax NetBSD systems.
+ Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
+
+GNU CC 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 GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* This is used on vax platforms that use the ELF format.
+ This was taken from the NetBSD/alpha configuration, and modified
+ for NetBSD/vax by Matt Thomas <matt@netbsd.org> */
+
+/* Get generic NetBSD ELF definitions. We will override these if necessary. */
+
+#define NETBSD_ELF
+#include "vax/netbsd.h"
+
+#undef REGISTER_PREFIX
+#define REGISTER_PREFIX "%"
+
+/* Redefine this with register prefixes. */
+#undef VAX_ISTREAM_SYNC
+#define VAX_ISTREAM_SYNC "movpsl -(%sp)\n\tpushal 1(%pc)\n\trei"
+
+#undef SIZE_TYPE
+#define SIZE_TYPE "long unsigned int"
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "long int"
+
+/* We always use gas here */
+#undef TARGET_GAS
+#define TARGET_GAS (1)
+
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT 0
+
+#define TARGET_MEM_FUNCTIONS /* include mem* calls */
+
+#undef PCC_STATIC_STRUCT_RETURN /* let's be reentrant */
+
+#if 1
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+#define DBX_OUTPUT_FUNCTION_END(file,decl) \
+ do \
+ { \
+ if (DECL_SECTION_NAME (decl) == NULL_TREE) \
+ text_section (); \
+ else \
+ named_section (decl, NULL, 1); \
+ } \
+ while (0)
+#endif
+
+#undef DWARF_DEBUGGING_INFO
+#undef DWARF2_DEBUGGING_INFO
+
+/* Profiling routines */
+
+#undef FUNCTION_PROFILER
+#define FUNCTION_PROFILER(FILE, LABELNO) \
+ fprintf (FILE, "\tmovab .LP%d,r0\n\tjsb __mcount+2\n", (LABELNO))
+
+/* Use sjlj exceptions. */
+#undef DWARF2_UNWIND_INFO /* just to be safe */
+
+#undef ASM_FINAL_SPEC
+
+/* Names to predefine in the preprocessor for this target machine. */
+
+/* NetBSD Extension to GNU C: __KPRINTF_ATTRIBUTE__ */
+
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES "\
+-D__vax__ -D__NetBSD__ -D__ELF__ \
+-Asystem(unix) -Asystem(NetBSD) -Acpu(vax) -Amachine(vax)"
+
+/* The VAX wants no space between the case instruction and the
+ jump table. */
+#undef ASM_OUTPUT_BEFORE_CASE_LABEL
+#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE)
+
+/* Get the udiv/urem calls out of the user's namespace */
+
+#undef UDIVSI3_LIBCALL
+#define UDIVSI3_LIBCALL "*__udiv"
+#undef UMODSI3_LIBCALL
+#define UMODSI3_LIBCALL "*__urem"
diff --git a/lang/gcc2/files/xm-netbsd.h b/lang/gcc2/files/xm-netbsd.h
new file mode 100644
index 00000000000..6fa7342ae7a
--- /dev/null
+++ b/lang/gcc2/files/xm-netbsd.h
@@ -0,0 +1,32 @@
+/* Configuration for GNU C-compiler for hosts running NetBSD.
+ Copyright (C) 1995 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
+
+GNU CC 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 GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* This file defines machine-independent things specific to a host
+ running NetBSD. This file should not be specified as $xm_file itself;
+ instead $xm_file should be CPU/xm-netbsd.h, which should include both
+ CPU/xm-CPU.h and this file xm-netbsd.h. */
+
+#undef POSIX
+#define POSIX
+
+/* Ensure we get gnu C's defaults. */
+#ifdef __GNUC__
+#define alloca __builtin_alloca
+#endif
diff --git a/lang/gcc2/files/xm-target64.h b/lang/gcc2/files/xm-target64.h
new file mode 100644
index 00000000000..47a0ace4b19
--- /dev/null
+++ b/lang/gcc2/files/xm-target64.h
@@ -0,0 +1,6 @@
+/* Hack to extend HOST_WIDE_INT on 64-bit target cross compilers. */
+
+#ifdef __GNUC__
+#define HOST_WIDE_INT long long
+#define HOST_BITS_PER_WIDE_INT 64
+#endif
diff --git a/lang/gcc2/patches/patch-Makefile.in b/lang/gcc2/patches/patch-Makefile.in
new file mode 100644
index 00000000000..0f438e2b00e
--- /dev/null
+++ b/lang/gcc2/patches/patch-Makefile.in
@@ -0,0 +1,15 @@
+$NetBSD: patch-Makefile.in,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- Makefile.in.orig 1999-06-22 22:44:42.000000000 +0000
++++ Makefile.in
+@@ -1670,8 +1670,8 @@ install-target: $(INSTALL_TARGET_MODULES
+ ### other supporting targets
+
+ MAKEDIRS= \
+- $(prefix) \
+- $(exec_prefix)
++ $(DESTDIR)$(prefix) \
++ $(DESTDIR)$(exec_prefix)
+ .PHONY: installdirs
+ installdirs: mkinstalldirs
+ $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
diff --git a/lang/gcc2/patches/patch-aa b/lang/gcc2/patches/patch-aa
new file mode 100644
index 00000000000..136e0805467
--- /dev/null
+++ b/lang/gcc2/patches/patch-aa
@@ -0,0 +1,42 @@
+$NetBSD: patch-aa,v 1.1 2015/04/25 10:32:07 wiz Exp $
+from revision 1.5 of patch-ae:
+
+Hand edit the alpha/netbsd.h patch. -current gcc relies on a new linker script
+which only differs in setting the entry point. Let this use the default
+linker script for alpha but force the entry point so this will work on older
+NetBSD installs for alpha. For NetBSD-1.6 and newer, we don't need to change
+the link spec.
+
+--- ../gcc-2.95.3/gcc/config/alpha/netbsd.h.orig Tue Nov 25 17:51:14 2003
++++ ../gcc-2.95.3/gcc/config/alpha/netbsd.h
+@@ -58,6 +58,8 @@ Boston, MA 02111-1307, USA. */
+ common to all ELF targets, except for the name of the start function. */
+
+ #undef LINK_SPEC
++#include <sys/param.h>
++#if defined(__NetBSD_Version__) && __NetBSD_Version__ >= 106000000
+ #define LINK_SPEC \
+ "-m elf64alpha_nbsd \
+ %{O*:-O3} %{!O*:-O1} \
+@@ -70,6 +72,21 @@ Boston, MA 02111-1307, USA. */
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
+ %{static:-static}}"
++#else
++#define LINK_SPEC \
++ "-m elf64alpha \
++ -e __start \
++ %{O*:-O3} %{!O*:-O1} \
++ %{assert*} %{R*} \
++ %{shared:-shared} \
++ %{!shared: \
++ -dc -dp \
++ %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
++ %{!static: \
++ %{rdynamic:-export-dynamic} \
++ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
++ %{static:-static}}"
++#endif
+
+ /* Names to predefine in the preprocessor for this target machine.
+ XXX NetBSD, by convention, shouldn't do __alpha, but lots of applications
diff --git a/lang/gcc2/patches/patch-ab b/lang/gcc2/patches/patch-ab
new file mode 100644
index 00000000000..1c95a32f369
--- /dev/null
+++ b/lang/gcc2/patches/patch-ab
@@ -0,0 +1,75 @@
+$NetBSD: patch-ab,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+Enable building the shared libstdc++
+
+also make the sersion number the same as the one we ship with netbsd-1.6 as
+we use the same sources.
+
+--- libstdc++/Makefile.in.orig 2011-07-12 16:44:41.000000000 +0400
++++ libstdc++/Makefile.in 2011-07-12 16:56:07.000000000 +0400
+@@ -14,7 +14,7 @@
+ # along with this library; see the file COPYING. If not, write to the Free
+ # Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+-VERSION = 2.10.0nb1
++VERSION = 4.0
+ INTERFACE = 3
+
+ gxx_include_dir=${includedir}/g++
+@@ -43,7 +43,7 @@
+
+ STAMP = bigstmp
+
+-LIBS = $(ARLIB) $(ARLINK)
++LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
+
+ #### package, host, target, and site dependent Makefile fragments come in here.
+ ##
+@@ -263,34 +263,34 @@
+ if [ -z "$(MULTISUBDIR)" ]; then \
+ cd $(srcdir); \
+ for FILE in $(HEADERS); do \
+- rm -f $(gxx_include_dir)/$$FILE ; \
++ rm -f $(DESTDIR)$(gxx_include_dir)/$$FILE ; \
+ if [ -f stl/$$FILE ]; then \
+- $(INSTALL_DATA) stl/$$FILE $(gxx_include_dir)/$$FILE ; \
++ $(INSTALL_DATA) stl/$$FILE $(DESTDIR)$(gxx_include_dir)/$$FILE ; \
+ else \
+- $(INSTALL_DATA) $$FILE $(gxx_include_dir)/$$FILE ; \
++ $(INSTALL_DATA) $$FILE $(DESTDIR)$(gxx_include_dir)/$$FILE ; \
+ fi ; \
+- chmod a-x $(gxx_include_dir)/$$FILE ; \
++ chmod a-x $(DESTDIR)$(gxx_include_dir)/$$FILE ; \
+ done ; \
+ for FILE in *.h std/*.h std/*.cc std/*.tcc; do \
+- rm -f $(gxx_include_dir)/$$FILE ; \
+- $(INSTALL_DATA) $$FILE $(gxx_include_dir)/$$FILE ; \
+- chmod a-x $(gxx_include_dir)/$$FILE ; \
++ rm -f $(DESTDIR)$(gxx_include_dir)/$$FILE ; \
++ $(INSTALL_DATA) $$FILE $(DESTDIR)$(gxx_include_dir)/$$FILE ; \
++ chmod a-x $(DESTDIR)$(gxx_include_dir)/$$FILE ; \
+ done ; \
+ cd stl; \
+ for FILE in *.h; do \
+- rm -f $(gxx_include_dir)/$$FILE ; \
+- $(INSTALL_DATA) $$FILE $(gxx_include_dir)/$$FILE ; \
+- chmod a-x $(gxx_include_dir)/$$FILE ; \
++ rm -f $(DESTDIR)$(gxx_include_dir)/$$FILE ; \
++ $(INSTALL_DATA) $$FILE $(DESTDIR)$(gxx_include_dir)/$$FILE ; \
++ chmod a-x $(DESTDIR)$(gxx_include_dir)/$$FILE ; \
+ done ; \
+ else true ; \
+ fi
+ rootme=`pwd`/ ; export rootme ; \
+ if [ x$(enable_version_specific_runtime_libs) != xyes ]; then \
+- INSTALLDIR=$(libdir); \
++ INSTALLDIR=$(DESTDIR)$(libdir); \
+ else \
+- INSTALLDIR=$(libsubdir); \
++ INSTALLDIR=$(DESTDIR)$(libsubdir); \
+ fi; \
+- INSTALLLINKDIR=$(libsubdir); \
++ INSTALLLINKDIR=$(DESTDIR)$(libsubdir); \
+ if [ $${INSTALLLINKDIR}$(MULTISUBDIR) = $${INSTALLDIR}$(MULTISUBDIR) ]; then \
+ RELINSTALLDIR=; \
+ elif [ x$(MULTISUBDIR) = x ]; then \
diff --git a/lang/gcc2/patches/patch-ac b/lang/gcc2/patches/patch-ac
new file mode 100644
index 00000000000..c325be408e0
--- /dev/null
+++ b/lang/gcc2/patches/patch-ac
@@ -0,0 +1,26 @@
+$NetBSD: patch-ac,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- libiberty/Makefile.in.orig 2011-07-12 16:13:20.000000000 +0400
++++ libiberty/Makefile.in 2011-07-12 16:41:39.000000000 +0400
+@@ -57,7 +57,7 @@
+ LIBCFLAGS = $(CFLAGS)
+ RANLIB = @RANLIB@
+
+-PICFLAG =
++PICFLAG = -fPIC -DPIC
+
+ MAKEOVERRIDES =
+
+@@ -155,9 +155,9 @@
+ install: install_to_$(INSTALL_DEST) install-subdir
+
+ install_to_libdir: all
+- $(INSTALL_DATA) $(TARGETLIB) $(libdir)$(MULTISUBDIR)/$(TARGETLIB)n
+- ( cd $(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
+- mv -f $(libdir)$(MULTISUBDIR)/$(TARGETLIB)n $(libdir)$(MULTISUBDIR)/$(TARGETLIB)
++ $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n
++ ( cd $(DESTDIR)$(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
++ mv -f $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)
+ @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
+
+ install_to_tooldir: all
diff --git a/lang/gcc2/patches/patch-ad b/lang/gcc2/patches/patch-ad
new file mode 100644
index 00000000000..163523ef17d
--- /dev/null
+++ b/lang/gcc2/patches/patch-ad
@@ -0,0 +1,7 @@
+$NetBSD: patch-ad,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- ../gcc-2.95.3/config/mh-sparcpic.orig Thu Feb 5 19:33:03 1998
++++ ../gcc-2.95.3/config/mh-sparcpic
+@@ -1 +1 @@
+-PICFLAG=`case "${LIBCFLAGS} ${LIBCXXFLAGS}" in *-fpic* ) echo -fpic ;; * ) echo -fPIC ;; esac`
++PICFLAG=`case '${LIBCFLAGS} ${LIBCXXFLAGS}' in *-fpic* ) echo -fpic ;; * ) echo -fPIC ;; esac`
diff --git a/lang/gcc2/patches/patch-ae b/lang/gcc2/patches/patch-ae
new file mode 100644
index 00000000000..3280b9bc4c0
--- /dev/null
+++ b/lang/gcc2/patches/patch-ae
@@ -0,0 +1,7 @@
+$NetBSD: patch-ae,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- ../gcc-2.95.3/config/mt-sparcpic.orig Thu Feb 5 19:33:04 1998
++++ ../gcc-2.95.3/config/mt-sparcpic
+@@ -1 +1 @@
+-PICFLAG_FOR_TARGET=`case "${LIBCFLAGS} ${LIBCXXFLAGS}" in *-fpic* ) echo -fpic ;; * ) echo -fPIC ;; esac`
++PICFLAG_FOR_TARGET=`case '${LIBCFLAGS} ${LIBCXXFLAGS}' in *-fpic* ) echo -fpic ;; * ) echo -fPIC ;; esac`
diff --git a/lang/gcc2/patches/patch-af b/lang/gcc2/patches/patch-af
new file mode 100644
index 00000000000..cedb7b2e3cc
--- /dev/null
+++ b/lang/gcc2/patches/patch-af
@@ -0,0 +1,161 @@
+$NetBSD: patch-af,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- ../gcc-2.95.3/gcc/config/netbsd.h
++++ ../gcc-2.95.3/gcc/config/netbsd.h.orig
+@@ -36,10 +36,13 @@
+
+
+ /* Provide a CPP_SPEC appropriate for NetBSD. Current we just deal with
+- the GCC option `-posix'. */
++ the GCC option `-posix'. We also deal with -pthread, which is required
++ for the 2.95.3 STL to work. */
+
+ #undef CPP_SPEC
+-#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE}"
++#define CPP_SPEC \
++ "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
++ %{pthread:-D_REENTRANT -D_PTHREADS}"
+
+ /* Provide an ASM_SPEC appropriate for NetBSD. Currently we only deal
+ with the options for generating PIC code. */
+@@ -54,7 +57,8 @@
+
+ #undef LIB_SPEC
+ #define LIB_SPEC \
+- "%{posix:%{!p:%{!pg:-lposix}}%{p:-lposix_p}%{pg:-lposix_p}} \
++ "%{pthread:%{!p:%{!pg:-lpthread}}%{p:-lpthread_p}%{pg:-lpthread_p}} \
++ %{posix:%{!p:%{!pg:-lposix}}%{p:-lposix_p}%{pg:-lposix_p}} \
+ %{!shared:%{!symbolic:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}}"
+
+ /* Provide a LIBGCC_SPEC appropriate for NetBSD. We also want to exclude
+@@ -64,7 +68,7 @@
+ #ifdef NETBSD_NATIVE
+ #define LIBGCC_SPEC "%{!symbolic:%{!shared:%{!p:%{!pg:-lgcc}}}%{shared:-lgcc_pic}%{p:-lgcc_p}%{pg:-lgcc_p}}"
+ #else
+-#define LIBGCC_SPEC "%{!shared:%{!symbolic:-lgcc}}"
++#define LIBGCC_SPEC "%{!symbolic:%{!shared:-lgcc}%{shared:-lgcc_pic}}"
+ #endif
+
+ /* #ifdef NETBSD_AOUT */
+@@ -147,6 +151,96 @@
+ #define ASM_DECLARE_RESULT(FILE, RESULT)
+ #endif
+
++/* NetBSD a.out support begins here. */
++
++#ifndef NETBSD_ELF
++
++#undef DWARF_DEBUGGING_INFO /* XXX */
++#undef DWARF2_DEBUGGING_INFO /* XXX */
++
++/* Write the extra assembler code needed to declare a function properly.
++ Some svr4 assemblers need to also have something extra said about the
++ function's return value. We allow for that here. */
++
++#undef ASM_DECLARE_FUNCTION_NAME
++#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
++ do { \
++ fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
++ assemble_name (FILE, NAME); \
++ putc (',', FILE); \
++ fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
++ putc ('\n', FILE); \
++ ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
++ ASM_OUTPUT_LABEL(FILE, NAME); \
++ } while (0)
++
++/* Write the extra assembler code needed to declare an object properly. */
++
++#undef ASM_DECLARE_OBJECT_NAME
++#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
++ do { \
++ fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
++ assemble_name (FILE, NAME); \
++ putc (',', FILE); \
++ fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
++ putc ('\n', FILE); \
++ size_directive_output = 0; \
++ if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
++ { \
++ size_directive_output = 1; \
++ fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
++ assemble_name (FILE, NAME); \
++ fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
++ } \
++ ASM_OUTPUT_LABEL(FILE, NAME); \
++ } while (0)
++
++/* Output the size directive for a decl in rest_of_decl_compilation
++ in the case where we did not do so before the initializer.
++ Once we find the error_mark_node, we know that the value of
++ size_directive_output was set
++ by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
++
++#undef ASM_FINISH_DECLARE_OBJECT
++#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
++do { \
++ char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
++ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
++ && ! AT_END && TOP_LEVEL \
++ && DECL_INITIAL (DECL) == error_mark_node \
++ && !size_directive_output) \
++ { \
++ size_directive_output = 1; \
++ fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
++ assemble_name (FILE, name); \
++ fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
++ } \
++ } while (0)
++
++/* This is how to declare the size of a function. */
++
++#undef ASM_DECLARE_FUNCTION_SIZE
++#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
++ do { \
++ if (!flag_inhibit_size_directive) \
++ { \
++ char label[256]; \
++ static int labelno; \
++ labelno++; \
++ ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
++ ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
++ fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
++ assemble_name (FILE, (FNAME)); \
++ fprintf (FILE, ","); \
++ assemble_name (FILE, label); \
++ fprintf (FILE, "-"); \
++ assemble_name (FILE, (FNAME)); \
++ putc ('\n', FILE); \
++ } \
++ } while (0)
++
++#endif
++
+ /* NetBSD ELF support begins here. */
+
+ #ifdef NETBSD_ELF
+@@ -167,6 +261,7 @@
+ %{!pg: \
+ %{p:gcrt0%O%s} \
+ %{!p:crt0%O%s}}} \
++ %:if-exists(crti%O%s) \
+ %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}"
+
+ /* Provide an ENDFILE_SPEC appropriate for NetBSD ELF targets. Here we
+@@ -175,13 +270,14 @@
+
+ #undef ENDFILE_SPEC
+ #define ENDFILE_SPEC \
+- "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
++ "%{!shared:crtend%O%s} %{shared:crtendS%O%s} \
++ %:if-exists(crtn%O%s)"
+
+ /* Provide a LINK_SPEC appropriate for a NetBSD ELF target. */
+
+ #undef LINK_SPEC
+ #define LINK_SPEC \
+- "%{assert*} \
++ "%{assert*} %{R*} \
+ %{shared:-shared} \
+ %{!shared: \
+ -dc -dp \
diff --git a/lang/gcc2/patches/patch-ag b/lang/gcc2/patches/patch-ag
new file mode 100644
index 00000000000..1050f37f12b
--- /dev/null
+++ b/lang/gcc2/patches/patch-ag
@@ -0,0 +1,361 @@
+$NetBSD: patch-ag,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- ../gcc-2.95.3/gcc/gcc.c.orig
++++ ../gcc-2.95.3/gcc/gcc.c
+@@ -189,9 +189,13 @@
+ static void clear_failure_queue PROTO((void));
+ static int check_live_switch PROTO((int, int));
+ static const char *handle_braces PROTO((const char *));
++static const struct spec_function *lookup_spec_function PROTO((const char *));
++static const char *eval_spec_function PROTO((const char *, const char *));
++static const char *handle_spec_function PROTO((const char *));
+ static char *save_string PROTO((const char *, int));
+ extern int do_spec PROTO((const char *));
+ static int do_spec_1 PROTO((const char *, int, const char *));
++static int do_spec_2 PROTO((const char *));
+ static const char *find_file PROTO((const char *));
+ static int is_directory PROTO((const char *, const char *, int));
+ static void validate_switches PROTO((const char *));
+@@ -216,6 +220,7 @@
+ static void process_command PROTO ((int, char **));
+ static int execute PROTO ((void));
+ static void unused_prefix_warnings PROTO ((struct path_prefix *));
++static void alloc_args PROTO ((void));
+ static void clear_args PROTO ((void));
+ static void fatal_error PROTO ((int));
+
+@@ -231,6 +236,8 @@
+ /* Number of extra output files that lang_specific_pre_link may generate. */
+ extern int lang_specific_extra_outfiles;
+
++static const char *if_exists_spec_function PROTO ((int, const char **));
++
+ /* Specs are strings containing lines, each of which (if not blank)
+ is made up of a program name, and arguments separated by spaces.
+ The program name must be exact and start from root, since no path
+@@ -335,6 +342,12 @@
+ %* substitute the variable part of a matched option. (See below.)
+ Note that each comma in the substituted string is replaced by
+ a single space.
++ %:function(args)
++ Call the named function FUNCTION, passing it ARGS. ARGS is
++ first processed as a nested spec string, then split into an
++ argument vector in the usual fashion. The function returns
++ a string which is processed as if it had appeared literally
++ as part of the current spec.
+ %{S} substitutes the -S switch, if that switch was given to CC.
+ If that switch was not specified, this substitutes nothing.
+ Here S is a metasyntactic variable.
+@@ -1162,6 +1175,24 @@
+ static struct spec_list *specs = (struct spec_list *)0;
+
+
++/* The mapping of a spec function name to the C function that
++ implements it. */
++struct spec_function
++{
++ const char *name;
++ const char *(*func) PROTO ((int, const char **));
++};
++
++/* List of static spec functions. */
++
++static const struct spec_function static_spec_functions[] =
++{
++ { "if-exists", if_exists_spec_function },
++ { 0, 0 }
++};
++
++static int processing_spec_function;
++
+ /* Initialize the specs lookup routines. */
+
+ static void
+@@ -1404,6 +1435,15 @@
+
+ static const char *multilib_dir;
+
++/* Allocate the argument vector. */
++
++static void
++alloc_args ()
++{
++ argbuf_length = 10;
++ argbuf = (char **) xmalloc (argbuf_length * sizeof (char *));
++}
++
+ /* Clear out the vector of arguments (after a command is executed). */
+
+ static void
+@@ -2211,6 +2251,9 @@
+
+ struct command *commands; /* each command buffer with above info. */
+
++ if (processing_spec_function)
++ abort ();
++
+ /* Count # of piped commands. */
+ for (n_commands = 1, i = 0; i < argbuf_index; i++)
+ if (strcmp (argbuf[i], "|") == 0)
+@@ -3360,14 +3403,7 @@
+ {
+ int value;
+
+- clear_args ();
+- arg_going = 0;
+- delete_this_arg = 0;
+- this_is_output_file = 0;
+- this_is_library_file = 0;
+- input_from_pipe = 0;
+-
+- value = do_spec_1 (spec, 0, NULL_PTR);
++ value = do_spec_2 (spec);
+
+ /* Force out any unfinished command.
+ If -pipe, this forces out the last command if it ended in `|'. */
+@@ -3383,6 +3419,20 @@
+ return value;
+ }
+
++static int
++do_spec_2 (spec)
++ const char *spec;
++{
++ clear_args ();
++ arg_going = 0;
++ delete_this_arg = 0;
++ this_is_output_file = 0;
++ this_is_library_file = 0;
++ input_from_pipe = 0;
++
++ return do_spec_1 (spec, 0, NULL_PTR);
++}
++
+ /* Process the sub-spec SPEC as a portion of a larger spec.
+ This is like processing a whole spec except that we do
+ not initialize at the beginning and we do not supply a
+@@ -4068,6 +4118,12 @@
+ return -1;
+ break;
+
++ case ':':
++ p = handle_spec_function (p);
++ if (p == 0)
++ return -1;
++ break;
++
+ case '%':
+ obstack_1grow (&obstack, '%');
+ break;
+@@ -4222,7 +4278,173 @@
+ arg_going = 1;
+ }
+
+- return 0; /* End of string */
++ /* End of string. If we are processing a spec function, we need to
++ end any pending argument. */
++ if (processing_spec_function && arg_going)
++ {
++ obstack_1grow (&obstack, 0);
++ string = obstack_finish (&obstack);
++ if (this_is_library_file)
++ string = find_file (string);
++ store_arg (string, delete_this_arg, this_is_output_file);
++ if (this_is_output_file)
++ outfiles[input_file_number] = string;
++ arg_going = 0;
++ }
++
++ return 0;
++}
++
++/* Look up a spec function. */
++
++static const struct spec_function *
++lookup_spec_function (name)
++ const char *name;
++{
++ static const struct spec_function * const spec_function_tables[] =
++ {
++ static_spec_functions,
++ };
++ const struct spec_function *sf;
++ unsigned int i;
++
++ for (i = 0; i < ARRAY_SIZE (spec_function_tables); i++)
++ {
++ for (sf = spec_function_tables[i]; sf->name != NULL; sf++)
++ if (strcmp (sf->name, name) == 0)
++ return sf;
++ }
++
++ return NULL;
++}
++
++/* Evaluate a spec function. */
++
++static const char *
++eval_spec_function (func, args)
++ const char *func, *args;
++{
++ const struct spec_function *sf;
++ const char *funcval;
++
++ /* Saved spec processing context. */
++ int save_argbuf_index;
++ int save_argbuf_length;
++ char **save_argbuf;
++
++ int save_arg_going;
++ int save_delete_this_arg;
++ int save_this_is_output_file;
++ int save_this_is_library_file;
++ int save_input_from_pipe;
++
++
++ sf = lookup_spec_function (func);
++ if (sf == NULL)
++ fatal ("unknown spec function `%s'", func);
++
++ /* Push the spec processing context. */
++ save_argbuf_index = argbuf_index;
++ save_argbuf_length = argbuf_length;
++ save_argbuf = argbuf;
++
++ save_arg_going = arg_going;
++ save_delete_this_arg = delete_this_arg;
++ save_this_is_output_file = this_is_output_file;
++ save_this_is_library_file = this_is_library_file;
++ save_input_from_pipe = input_from_pipe;
++
++ /* Create a new spec processing context, and build the function
++ arguments. */
++
++ alloc_args ();
++ if (do_spec_2 (args) < 0)
++ fatal ("error in args to spec function `%s'", func);
++
++ /* argbuf_index is an index for the next argument to be inserted, and
++ so contains the count of the args already inserted. */
++
++ funcval = (*sf->func) (argbuf_index, (const char **) argbuf);
++
++ /* Pop the spec processing context. */
++ argbuf_index = save_argbuf_index;
++ argbuf_length = save_argbuf_length;
++ free (argbuf);
++ argbuf = save_argbuf;
++
++ arg_going = save_arg_going;
++ delete_this_arg = save_delete_this_arg;
++ this_is_output_file = save_this_is_output_file;
++ this_is_library_file = save_this_is_library_file;
++ input_from_pipe = save_input_from_pipe;
++
++ return funcval;
++}
++
++/* Handle a spec function call of the form:
++
++ %:function(args)
++
++ ARGS is processed as a spec in a separate context and split into an
++ argument vector in the normal fashion. The function returns a string
++ containing a spec which we then process in the caller's context, or
++ NULL if no processing is required. */
++
++static const char *
++handle_spec_function (p)
++ const char *p;
++{
++ char *func, *args;
++ const char *endp, *funcval;
++ int count;
++
++ processing_spec_function++;
++
++ /* Get the function name. */
++ for (endp = p; *endp != '\0'; endp++)
++ {
++ if (*endp == '(') /* ) */
++ break;
++ /* Only allow [A-Za-z0-9], -, and _ in function names. */
++ if (!ISALNUM (*endp) && !(*endp == '-' || *endp == '_'))
++ fatal ("malformed spec function name");
++ }
++ if (*endp != '(') /* ) */
++ fatal ("no arguments for spec function");
++ func = save_string (p, endp - p);
++ p = ++endp;
++
++ /* Get the arguments. */
++ for (count = 0; *endp != '\0'; endp++)
++ {
++ /* ( */
++ if (*endp == ')')
++ {
++ if (count == 0)
++ break;
++ count--;
++ }
++ else if (*endp == '(') /* ) */
++ count++;
++ }
++ /* ( */
++ if (*endp != ')')
++ fatal ("malformed spec function arguments");
++ args = save_string (p, endp - p);
++ p = ++endp;
++
++ /* p now points to just past the end of the spec function expression. */
++
++ funcval = eval_spec_function (func, args);
++ if (funcval != NULL && do_spec_1 (funcval, 0, NULL) < 0)
++ p = NULL;
++
++ free (func);
++ free (args);
++
++ processing_spec_function--;
++
++ return p;
+ }
+
+ /* Return 0 if we call do_spec_1 and that returns -1. */
+@@ -4674,8 +4896,8 @@
+ signal (SIGPIPE, fatal_error);
+ #endif
+
+- argbuf_length = 10;
+- argbuf = (char **) xmalloc (argbuf_length * sizeof (char *));
++ /* Allocate the argument vector. */
++ alloc_args ();
+
+ obstack_init (&obstack);
+
+@@ -5846,3 +6068,25 @@
+ ++p;
+ }
+ }
++
++/* if-exists built-in spec function.
++
++ Checks to see if the file specified by the absolute pathname in
++ ARGS exists. Returns that pathname if found.
++
++ The usual use for this function is to check for a library file
++ (whose name has been expanded with %s). */
++
++#define IS_ABSOLUTE_PATHNAME(cp) ((cp)[0] == '/')
++
++static const char *
++if_exists_spec_function (argc, argv)
++ int argc;
++ const char **argv;
++{
++ /* Must have only one argument. */
++ if (argc == 1 && IS_ABSOLUTE_PATHNAME (argv[0]) && ! access (argv[0], R_OK))
++ return argv[0];
++
++ return NULL;
++}
diff --git a/lang/gcc2/patches/patch-ah b/lang/gcc2/patches/patch-ah
new file mode 100644
index 00000000000..9177d65546e
--- /dev/null
+++ b/lang/gcc2/patches/patch-ah
@@ -0,0 +1,15 @@
+$NetBSD: patch-ah,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- gcc/ch/loop.c.orig 1999-01-11 05:17:29.000000000 -0800
++++ gcc/ch/loop.c
+@@ -318,8 +318,8 @@ the 'increment_temps' step must incremen
+ (associated with all iterators).
+
+ NOTE: Z.200, section 10.1 says that a block is ...
+- "the actions statement list in a do action, including any
+- loop counter and while control". This means that an exp-
++ ``the actions statement list in a do action, including any
++ loop counter and while control''. This means that an exp-
+ ression in a WHILE control can include references to the
+ loop counters created for the loop''s exclusive use.
+ Example:
diff --git a/lang/gcc2/patches/patch-ai b/lang/gcc2/patches/patch-ai
new file mode 100644
index 00000000000..6333e3fbcf8
--- /dev/null
+++ b/lang/gcc2/patches/patch-ai
@@ -0,0 +1,20 @@
+$NetBSD: patch-ai,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- gcc/java/parse.y.orig 2010-10-12 22:33:34.000000000 +0000
++++ gcc/java/parse.y
+@@ -10164,6 +10164,7 @@ resolve_type_during_patch (type)
+ }
+ /* 5.5 Casting Conversion. error_mark_node is returned if an error is
+ found. Otherwise NODE or something meant to replace it is returned. */
++static tree convert_narrow ();
+
+ static tree
+ patch_cast (node, wfl_operator)
+@@ -10182,7 +10183,6 @@ patch_cast (node, wfl_operator)
+ /* Check on cast that are proven correct at compile time */
+ if (JNUMERIC_TYPE_P (cast_type) && JNUMERIC_TYPE_P (op_type))
+ {
+- static tree convert_narrow ();
+ /* Same type */
+ if (cast_type == op_type)
+ return node;
diff --git a/lang/gcc2/patches/patch-aj b/lang/gcc2/patches/patch-aj
new file mode 100644
index 00000000000..d606b5e1562
--- /dev/null
+++ b/lang/gcc2/patches/patch-aj
@@ -0,0 +1,13 @@
+$NetBSD: patch-aj,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- gcc/f/com.c.orig 2010-10-12 22:37:49.000000000 +0000
++++ gcc/f/com.c
+@@ -11539,7 +11539,7 @@ ffecom_get_invented_identifier (const ch
+ return decl;
+ }
+
+-ffeinfoBasictype
++ffeinfoKindtype
+ ffecom_gfrt_basictype (ffecomGfrt gfrt)
+ {
+ assert (gfrt < FFECOM_gfrt);
diff --git a/lang/gcc2/patches/patch-ak b/lang/gcc2/patches/patch-ak
new file mode 100644
index 00000000000..965fd82c4fa
--- /dev/null
+++ b/lang/gcc2/patches/patch-ak
@@ -0,0 +1,13 @@
+$NetBSD: patch-ak,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- gcc/ch/decl.c.orig 2010-10-12 22:41:57.000000000 +0000
++++ gcc/ch/decl.c
+@@ -4446,7 +4446,7 @@ complete_array_type (type, initial_value
+
+ tree
+ start_struct (code, name)
+- enum chill_tree_code code;
++ enum tree_code code;
+ tree name ATTRIBUTE_UNUSED;
+ {
+ /* If there is already a tag defined at this binding level
diff --git a/lang/gcc2/patches/patch-al b/lang/gcc2/patches/patch-al
new file mode 100644
index 00000000000..e6a94a789a5
--- /dev/null
+++ b/lang/gcc2/patches/patch-al
@@ -0,0 +1,13 @@
+$NetBSD: patch-al,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- gcc/ch/expr.c.orig 2010-10-12 22:47:21.000000000 +0000
++++ gcc/ch/expr.c
+@@ -3490,7 +3490,7 @@ compare_records (exp0, exp1)
+
+ int
+ compare_int_csts (op, val1, val2)
+- enum tree_code op;
++ enum chill_tree_code op;
+ tree val1, val2;
+ {
+ int result;
diff --git a/lang/gcc2/patches/patch-am b/lang/gcc2/patches/patch-am
new file mode 100644
index 00000000000..1a862e4129b
--- /dev/null
+++ b/lang/gcc2/patches/patch-am
@@ -0,0 +1,20 @@
+$NetBSD: patch-am,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- gcc/java/parse.c.orig 2001-03-16 14:13:48.000000000 +0000
++++ gcc/java/parse.c
+@@ -12818,6 +12818,7 @@ resolve_type_during_patch (type)
+ }
+ /* 5.5 Casting Conversion. error_mark_node is returned if an error is
+ found. Otherwise NODE or something meant to replace it is returned. */
++static tree convert_narrow ();
+
+ static tree
+ patch_cast (node, wfl_operator)
+@@ -12836,7 +12837,6 @@ patch_cast (node, wfl_operator)
+ /* Check on cast that are proven correct at compile time */
+ if (JNUMERIC_TYPE_P (cast_type) && JNUMERIC_TYPE_P (op_type))
+ {
+- static tree convert_narrow ();
+ /* Same type */
+ if (cast_type == op_type)
+ return node;
diff --git a/lang/gcc2/patches/patch-gcc_Makefile.in b/lang/gcc2/patches/patch-gcc_Makefile.in
new file mode 100644
index 00000000000..8ec95519437
--- /dev/null
+++ b/lang/gcc2/patches/patch-gcc_Makefile.in
@@ -0,0 +1,356 @@
+$NetBSD: patch-gcc_Makefile.in,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- gcc/Makefile.in.orig 2011-07-15 08:28:24.000000000 +0000
++++ gcc/Makefile.in
+@@ -2159,10 +2159,10 @@ stmp-fixinc: fixinc.sh gsyslimits.h
+ # won't work because libsubdir doesn't exist yet.
+ if [ "$(SYSTEM_HEADER_DIR)" = "$(tooldir)/sys-include" ] \
+ && [ -d $(tooldir)/sys-include ]; then \
+- if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; fi; \
+- if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib; fi; \
+- if [ -d $(libdir)/gcc-lib/$(target_alias) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias) ; fi; \
+- if [ -d $(libdir)/gcc-lib/$(target_alias)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias)/$(version) ; fi; \
++ if [ -d $(DESTDIR)$(libdir) ] ; then true ; else mkdir $(DESTDIR)$(libdir) ; fi; \
++ if [ -d $(DESTDIR)$(libdir)/gcc-lib ] ; then true ; else mkdir $(DESTDIR)$(libdir)/gcc-lib; fi; \
++ if [ -d $(DESTDIR)$(libdir)/gcc-lib/$(target_alias) ] ; then true ; else mkdir $(DESTDIR)$(libdir)/gcc-lib/$(target_alias) ; fi; \
++ if [ -d $(DESTDIR)$(libdir)/gcc-lib/$(target_alias)/$(version) ] ; then true ; else mkdir $(DESTDIR)$(libdir)/gcc-lib/$(target_alias)/$(version) ; fi; \
+ else true; fi
+
+ touch stmp-fixinc
+@@ -2429,11 +2429,11 @@ install-cross-rest: install-float-h-cros
+
+ # Handle cpp installation.
+ install-cpp: cpp$(exeext)
+- -rm -f $(bindir)/$(CPP_INSTALL_NAME)$(exeext)
+- $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(bindir)/$(CPP_INSTALL_NAME)$(exeext)
++ -rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext)
++ $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext)
+ if [ x$(cpp_install_dir) != x ]; then \
+- rm -f $(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
+- $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
++ $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
+ else true; fi
+
+ uninstall-cpp:
+@@ -2449,163 +2449,163 @@ install-float-h-cross: installdirs
+ # if [ -f enquire ] ; then true; else false; fi
+ # Note: don't use -. We should fail right away if enquire was not made.
+ ./enquire -f > $(tmpdir)/float.h
+- -rm -f $(libsubdir)/include/float.h
+- $(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h
++ -rm -f $(DESTDIR)$(libsubdir)/include/float.h
++ $(INSTALL_DATA) $(tmpdir)/float.h $(DESTDIR)$(libsubdir)/include/float.h
+ -rm -f $(tmpdir)/float.h
+- chmod a-x $(libsubdir)/include/float.h
++ chmod a-x $(DESTDIR)$(libsubdir)/include/float.h
+
+ # Create the installation directories.
+ installdirs:
+- -if [ -d $(prefix) ] ; then true ; else mkdir $(prefix) ; chmod a+rx $(prefix) ; fi
+- -if [ -d $(exec_prefix) ] ; then true ; else mkdir $(exec_prefix) ; chmod a+rx $(exec_prefix) ; fi
+- -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; chmod a+rx $(libdir) ; fi
+- -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; chmod a+rx $(libdir)/gcc-lib ; fi
++ -if [ -d $(DESTDIR)$(prefix) ] ; then true ; else mkdir $(DESTDIR)$(prefix) ; chmod a+rx $(DESTDIR)$(prefix) ; fi
++ -if [ -d $(DESTDIR)$(exec_prefix) ] ; then true ; else mkdir $(DESTDIR)$(exec_prefix) ; chmod a+rx $(DESTDIR)$(exec_prefix) ; fi
++ -if [ -d $(DESTDIR)$(libdir) ] ; then true ; else mkdir $(DESTDIR)$(libdir) ; chmod a+rx $(DESTDIR)$(libdir) ; fi
++ -if [ -d $(DESTDIR)$(libdir)/gcc-lib ] ; then true ; else mkdir $(DESTDIR)$(libdir)/gcc-lib ; chmod a+rx $(DESTDIR)$(libdir)/gcc-lib ; fi
+ # This dir isn't currently searched by cpp.
+ # -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; chmod a+rx $(libdir)/gcc-lib/include ; fi
+ -fdir= ; for dir in `echo $(libsubdir) | tr '/' ' '`; do \
+ fdir=$${fdir}/$${dir}; \
+- if [ -d $${fdir} ] ; then true ; else mkdir $${fdir}; chmod a+rx $${fdir}; fi ; \
++ if [ -d $(DESTDIR)$${fdir} ] ; then true ; else mkdir $(DESTDIR)$${fdir}; chmod a+rx $(DESTDIR)$${fdir}; fi ; \
+ done
+- -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
+- -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
+- -if [ -d $(gcc_tooldir) ] ; then true ; else mkdir $(gcc_tooldir) ; chmod a+rx $(gcc_tooldir) ; fi
+- -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi
+- -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi
++ -if [ -d $(DESTDIR)$(bindir) ] ; then true ; else mkdir $(DESTDIR)$(bindir) ; chmod a+rx $(DESTDIR)$(bindir) ; fi
++ -if [ -d $(DESTDIR)$(includedir) ] ; then true ; else mkdir $(DESTDIR)$(includedir) ; chmod a+rx $(DESTDIR)$(includedir) ; fi
++ -if [ -d $(DESTDIR)$(gcc_tooldir) ] ; then true ; else mkdir $(DESTDIR)$(gcc_tooldir) ; chmod a+rx $(DESTDIR)$(gcc_tooldir) ; fi
++ -if [ -d $(DESTDIR)$(assertdir) ] ; then true ; else mkdir $(DESTDIR)$(assertdir) ; chmod a+rx $(DESTDIR)$(assertdir) ; fi
++ -if [ -d $(DESTDIR)$(infodir) ] ; then true ; else mkdir $(DESTDIR)$(infodir) ; chmod a+rx $(DESTDIR)$(infodir) ; fi
+ # We don't use mkdir -p to create the parents of man1dir,
+ # because some systems don't support it.
+ # Instead, we use this technique to create the immediate parent of man1dir.
+ -parent=`echo $(man1dir)|sed -e 's@/[^/]*$$@@'`; \
+- if [ -d $$parent ] ; then true ; else mkdir $$parent ; chmod a+rx $$parent ; fi
+- -if [ -d $(man1dir) ] ; then true ; else mkdir $(man1dir) ; chmod a+rx $(man1dir) ; fi
++ if [ -d $(DESTDIR)$$parent ] ; then true ; else mkdir $(DESTDIR)$$parent ; chmod a+rx $(DESTDIR)$$parent ; fi
++ -if [ -d $(DESTDIR)$(man1dir) ] ; then true ; else mkdir $(DESTDIR)$(man1dir) ; chmod a+rx $(DESTDIR)$(man1dir) ; fi
+
+ # Install the compiler executables built during cross compilation.
+ install-common: native installdirs $(EXTRA_PARTS) lang.install-common
+ for file in $(COMPILERS); do \
+ if [ -f $$file ] ; then \
+- rm -f $(libsubdir)/$$file; \
+- $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
++ rm -f $(DESTDIR)$(libsubdir)/$$file; \
++ $(INSTALL_PROGRAM) $$file $(DESTDIR)$(libsubdir)/$$file; \
+ else true; \
+ fi; \
+ done
+ for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
+ if [ x"$$file" != x.. ]; then \
+- rm -f $(libsubdir)/$$file; \
+- $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
++ rm -f $(DESTDIR)$(libsubdir)/$$file; \
++ $(INSTALL_PROGRAM) $$file $(DESTDIR)$(libsubdir)/$$file; \
+ else true; fi; \
+ done
+ for file in $(EXTRA_PARTS) ..; do \
+ if [ x"$$file" != x.. ]; then \
+- rm -f $(libsubdir)/$$file; \
+- $(INSTALL_DATA) $$file $(libsubdir)/$$file; \
+- chmod a-x $(libsubdir)/$$file; \
++ rm -f $(DESTDIR)$(libsubdir)/$$file; \
++ $(INSTALL_DATA) $$file $(DESTDIR)$(libsubdir)/$$file; \
++ chmod a-x $(DESTDIR)$(libsubdir)/$$file; \
+ else true; fi; \
+ done
+ # Don't mess with specs if it doesn't exist yet.
+ -if [ -f specs ] ; then \
+- rm -f $(libsubdir)/specs; \
+- $(INSTALL_DATA) specs $(libsubdir)/specs; \
+- chmod a-x $(libsubdir)/specs; \
++ rm -f $(DESTDIR)$(libsubdir)/specs; \
++ $(INSTALL_DATA) specs $(DESTDIR)$(libsubdir)/specs; \
++ chmod a-x $(DESTDIR)$(libsubdir)/specs; \
+ fi
+ # Install protoize if it was compiled.
+ -if [ -f protoize$(exeext) ]; \
+ then \
+ if [ -f gcc-cross$(exeext) ] ; then \
+- rm -f $(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \
+- $(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \
+- rm -f $(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \
+- $(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \
++ $(INSTALL_PROGRAM) protoize$(exeext) $(DESTDIR)$(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \
++ $(INSTALL_PROGRAM) unprotoize$(exeext) $(DESTDIR)$(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \
+ else \
+- rm -f $(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \
+- $(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \
+- rm -f $(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \
+- $(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \
++ $(INSTALL_PROGRAM) protoize$(exeext) $(DESTDIR)$(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \
++ $(INSTALL_PROGRAM) unprotoize$(exeext) $(DESTDIR)$(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \
+ fi ; \
+- rm -f $(libsubdir)/SYSCALLS.c.X; \
+- $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
+- chmod a-x $(libsubdir)/SYSCALLS.c.X; \
++ rm -f $(DESTDIR)$(libsubdir)/SYSCALLS.c.X; \
++ $(INSTALL_DATA) SYSCALLS.c.X $(DESTDIR)$(libsubdir)/SYSCALLS.c.X; \
++ chmod a-x $(DESTDIR)$(libsubdir)/SYSCALLS.c.X; \
+ fi
+- -rm -f $(libsubdir)/cpp0$(exeext)
+- $(INSTALL_PROGRAM) cpp0$(exeext) $(libsubdir)/cpp0$(exeext)
++ -rm -f $(DESTDIR)$(libsubdir)/cpp0$(exeext)
++ $(INSTALL_PROGRAM) cpp0$(exeext) $(DESTDIR)$(libsubdir)/cpp0$(exeext)
+ # Install gcov if it was compiled.
+ -if [ -f gcov$(exeext) ]; \
+ then \
+- rm -f $(bindir)/gcov$(exeext); \
+- $(INSTALL_PROGRAM) gcov$(exeext) $(bindir)/$(GCOV_INSTALL_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/gcov$(exeext); \
++ $(INSTALL_PROGRAM) gcov$(exeext) $(DESTDIR)$(bindir)/$(GCOV_INSTALL_NAME)$(exeext); \
+ fi
+
+ # Install the driver program as $(target_alias)-gcc
+ # and also as either gcc (if native) or $(gcc_tooldir)/bin/gcc.
+ install-driver: xgcc$(exeext)
+ -if [ -f gcc-cross$(exeext) ] ; then \
+- rm -f $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
+- $(INSTALL_PROGRAM) gcc-cross$(exeext) $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(GCC_CROSS_NAME)$(exeext); \
++ $(INSTALL_PROGRAM) gcc-cross$(exeext) $(DESTDIR)$(bindir)/$(GCC_CROSS_NAME)$(exeext); \
+ if [ -d $(gcc_tooldir)/bin/. ] ; then \
+ rm -f $(gcc_tooldir)/bin/gcc$(exeext); \
+ $(INSTALL_PROGRAM) gcc-cross$(exeext) $(gcc_tooldir)/bin/gcc$(exeext); \
+ else true; fi; \
+ else \
+- rm -f $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
+- $(INSTALL_PROGRAM) xgcc$(exeext) $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
+- rm -f $(bindir)/$(target_alias)-gcc-1$(exeext); \
+- $(LN) $(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-gcc-1$(exeext); \
+- mv $(bindir)/$(target_alias)-gcc-1$(exeext) $(bindir)/$(target_alias)-gcc$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
++ $(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(target_alias)-gcc-1$(exeext); \
++ $(LN) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(target_alias)-gcc-1$(exeext); \
++ mv $(DESTDIR)$(bindir)/$(target_alias)-gcc-1$(exeext) $(DESTDIR)$(bindir)/$(target_alias)-gcc$(exeext); \
+ fi
+
+ # Install the info files.
+ # $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
+ # to do the install.
+ install-info: doc installdirs lang.install-info
+- -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
++ -rm -f $(DESTDIR)$(infodir)/cpp.info* $(DESTDIR)$(infodir)/gcc.info*
+ for f in cpp.info* gcc.info*; do \
+- $(INSTALL_DATA) $$f $(infodir)/$$f; \
++ $(INSTALL_DATA) $$f $(DESTDIR)$(infodir)/$$f; \
+ done
+ -if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
+- if [ -f $(infodir)/dir ] ; then \
++ if [ -f $(DESTDIR)$(infodir)/dir ] ; then \
+ for f in cpp.info gcc.info; do \
+- install-info --dir-file=$(infodir)/dir $(infodir)/$$f; \
++ install-info --dir-file=$(infodir)/dir $(DESTDIR)$(infodir)/$$f; \
+ done; \
+ else true; fi; \
+ else true; fi;
+- -chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
++ -chmod a-x $(DESTDIR)$(infodir)/cpp.info* $(DESTDIR)$(infodir)/gcc.info*
+
+ # Install the man pages.
+ install-man: installdirs $(srcdir)/gcc.1 $(srcdir)/cccp.1 lang.install-man
+ -if [ -f gcc-cross$(exeext) ] ; then \
+- rm -f $(man1dir)/$(GCC_CROSS_NAME)$(manext); \
+- $(INSTALL_DATA) $(srcdir)/gcc.1 $(man1dir)/$(GCC_CROSS_NAME)$(manext); \
+- chmod a-x $(man1dir)/$(GCC_CROSS_NAME)$(manext); \
++ rm -f $(DESTDIR)$(man1dir)/$(GCC_CROSS_NAME)$(manext); \
++ $(INSTALL_DATA) $(srcdir)/gcc.1 $(DESTDIR)$(man1dir)/$(GCC_CROSS_NAME)$(manext); \
++ chmod a-x $(DESTDIR)$(man1dir)/$(GCC_CROSS_NAME)$(manext); \
+ else \
+- rm -f $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \
+- $(INSTALL_DATA) $(srcdir)/gcc.1 $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \
+- chmod a-x $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \
+- fi
+- -rm -f $(man1dir)/cccp$(manext)
+- -$(INSTALL_DATA) $(srcdir)/cccp.1 $(man1dir)/cccp$(manext)
+- -chmod a-x $(man1dir)/cccp$(manext)
++ rm -f $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(manext); \
++ $(INSTALL_DATA) $(srcdir)/gcc.1 $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(manext); \
++ chmod a-x $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(manext); \
++ fi
++ -rm -f $(DESTDIR)$(man1dir)/cccp$(manext)
++ -$(INSTALL_DATA) $(srcdir)/cccp.1 $(DESTDIR)$(man1dir)/cccp$(manext)
++ -chmod a-x $(DESTDIR)$(man1dir)/cccp$(manext)
+
+ # Install the library.
+ install-libgcc: libgcc.a installdirs
+ -if [ -f libgcc.a ] ; then \
+- rm -f $(libsubdir)/libgcc.a; \
+- $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \
++ rm -f $(DESTDIR)$(libsubdir)/libgcc.a; \
++ $(INSTALL_DATA) libgcc.a $(DESTDIR)$(libsubdir)/libgcc.a; \
+ if $(RANLIB_TEST_FOR_TARGET) ; then \
+- (cd $(libsubdir); $(RANLIB_FOR_TARGET) libgcc.a); else true; fi; \
+- chmod a-x $(libsubdir)/libgcc.a; \
++ (cd $(DESTDIR)$(libsubdir); $(RANLIB_FOR_TARGET) libgcc.a); else true; fi; \
++ chmod a-x $(DESTDIR)$(libsubdir)/libgcc.a; \
+ else true; fi
+
+ # Install multiple versions of libgcc.a.
+ install-multilib: stmp-multilib installdirs
+ for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
+ dir=`echo $$i | sed -e 's/;.*$$//'`; \
+- if [ -d $(libsubdir)/$${dir} ]; then true; else mkdir $(libsubdir)/$${dir}; fi; \
++ if [ -d $(DESTDIR)$(libsubdir)/$${dir} ]; then true; else mkdir $(DESTDIR)$(libsubdir)/$${dir}; fi; \
+ for f in libgcc.a $(EXTRA_MULTILIB_PARTS); do \
+- rm -f $(libsubdir)/$${dir}/$${f}; \
+- $(INSTALL_DATA) $${dir}/$${f} $(libsubdir)/$${dir}/$${f}; \
++ rm -f $(DESTDIR)$(libsubdir)/$${dir}/$${f}; \
++ $(INSTALL_DATA) $${dir}/$${f} $(DESTDIR)$(libsubdir)/$${dir}/$${f}; \
+ done; \
+ if $(RANLIB_TEST_FOR_TARGET); then \
+- (cd $(libsubdir)/$${dir}; $(RANLIB_FOR_TARGET) libgcc.a); \
++ (cd $(DESTDIR)$(libsubdir)/$${dir}; $(RANLIB_FOR_TARGET) libgcc.a); \
+ else true; fi; \
+- chmod a-x $(libsubdir)/$${dir}/libgcc.a; \
++ chmod a-x $(DESTDIR)$(libsubdir)/$${dir}/libgcc.a; \
+ done
+
+ # Install all the header files built in the include subdirectory.
+@@ -2613,23 +2613,23 @@ install-headers: install-include-dir $(I
+ # Fix symlinks to absolute paths in the installed include directory to
+ # point to the installed directory, not the build directory.
+ # Don't need to use LN_S here since we really do need ln -s and no substitutes.
+- -files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \
++ -files=`cd $(DESTDIR)$(libsubdir)/include; find . -type l -print 2>/dev/null`; \
+ if [ $$? -eq 0 ]; then \
+ dir=`cd include; pwd`; \
+ for i in $$files; do \
+- dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
++ dest=`ls -ld $(DESTDIR)$(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
+ if expr "$$dest" : "$$dir.*" > /dev/null; then \
+- rm -f $(libsubdir)/include/$$i; \
+- ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \
++ rm -f $(DESTDIR)$(libsubdir)/include/$$i; \
++ ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(DESTDIR)$(libsubdir)/include/$$i; \
+ fi; \
+ done; \
+ fi
+
+ # Create or recreate the gcc private include file directory.
+ install-include-dir: installdirs
+- -rm -rf $(libsubdir)/include
+- mkdir $(libsubdir)/include
+- -chmod a+rx $(libsubdir)/include
++ -rm -rf $(DESTDIR)$(libsubdir)/include
++ mkdir $(DESTDIR)$(libsubdir)/include
++ -chmod a+rx $(DESTDIR)$(libsubdir)/include
+
+ # Install the include directory using tar.
+ install-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir
+@@ -2638,7 +2638,7 @@ install-headers-tar: stmp-headers $(STMP
+ # found in CDPATH, corrupting the output. We could just redirect the
+ # output of `cd', but some shells lose on redirection within `()'s
+ (cd `pwd`/include ; \
+- tar -cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
++ tar -cf - .; exit 0) | (cd $(DESTDIR)$(libsubdir)/include; tar $(TAROUTOPTS) - )
+ # /bin/sh on some systems returns the status of the first tar,
+ # and that can lose with GNU tar which always writes a full block.
+ # So use `exit 0' to ignore its exit status.
+@@ -2647,7 +2647,7 @@ install-headers-tar: stmp-headers $(STMP
+ install-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir
+ # See discussion about the use of `pwd` above
+ cd `pwd`/include ; \
+- find . -print | cpio -pdum $(libsubdir)/include
++ find . -print | cpio -pdum $(DESTDIR)$(libsubdir)/include
+
+ # Put assert.h where it won't override GNU libc's assert.h.
+ # It goes in a dir that is searched after GNU libc's headers;
+@@ -2657,26 +2657,26 @@ install-headers-cpio: stmp-headers $(STM
+ ## This code would be simpler if it tested for -f ... && ! grep ...
+ ## but supposedly the ! operator is missing in sh on some systems.
+ install-assert-h: assert.h installdirs
+- if [ -f $(assertdir)/assert.h ]; \
++ if [ -f $(DESTDIR)$(assertdir)/assert.h ]; \
+ then \
+- if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \
++ if grep "__eprintf" $(DESTDIR)$(assertdir)/assert.h >/dev/null; \
+ then \
+- rm -f $(assertdir)/assert.h; \
+- $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
+- chmod a-x $(assertdir)/assert.h; \
++ rm -f $(DESTDIR)$(assertdir)/assert.h; \
++ $(INSTALL_DATA) $(srcdir)/assert.h $(DESTDIR)$(assertdir)/assert.h; \
++ chmod a-x $(DESTDIR)$(assertdir)/assert.h; \
+ else true; \
+ fi; \
+ else \
+- rm -f $(assertdir)/assert.h; \
+- $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
+- chmod a-x $(assertdir)/assert.h; \
++ rm -f $(DESTDIR)$(assertdir)/assert.h; \
++ $(INSTALL_DATA) $(srcdir)/assert.h $(DESTDIR)$(assertdir)/assert.h; \
++ chmod a-x $(DESTDIR)$(assertdir)/assert.h; \
+ fi
+
+ # Use this target to install the program `collect2' under the name `collect2'.
+ install-collect2: collect2 installdirs
+- $(INSTALL_PROGRAM) collect2$(exeext) $(libsubdir)/collect2$(exeext)
++ $(INSTALL_PROGRAM) collect2$(exeext) $(DESTDIR)$(libsubdir)/collect2$(exeext)
+ # Install the driver program as $(libsubdir)/gcc for collect2.
+- $(INSTALL_PROGRAM) xgcc$(exeext) $(libsubdir)/gcc$(exeext)
++ $(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(libsubdir)/gcc$(exeext)
+
+ # Cancel installation by deleting the installed files.
+ uninstall: intl.uninstall lang.uninstall $(UNINSTALL_CPP)
diff --git a/lang/gcc2/patches/patch-gcc_ch_Make-lang.in b/lang/gcc2/patches/patch-gcc_ch_Make-lang.in
new file mode 100644
index 00000000000..e63ffcb9060
--- /dev/null
+++ b/lang/gcc2/patches/patch-gcc_ch_Make-lang.in
@@ -0,0 +1,36 @@
+$NetBSD: patch-gcc_ch_Make-lang.in,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- gcc/ch/Make-lang.in.orig 1999-06-25 08:26:19.000000000 +0000
++++ gcc/ch/Make-lang.in
+@@ -130,13 +130,13 @@ CHILL.install-common:
+ -if [ -f cc1chill$(exeext) ] ; then \
+ if [ -f chill.install ] ; then \
+ if [ -f gcc-cross$(exeext) ]; then \
+- rm -f $(bindir)/$(CHILL_CROSS_NAME); \
+- $(INSTALL_PROGRAM) chill.install $(bindir)/$(CHILL_CROSS_NAME); \
+- chmod a+x $(bindir)/$(CHILL_CROSS_NAME); \
++ rm -f $(DESTDIR)$(bindir)/$(CHILL_CROSS_NAME); \
++ $(INSTALL_PROGRAM) chill.install $(DESTDIR)$(bindir)/$(CHILL_CROSS_NAME); \
++ chmod a+x $(DESTDIR)$(bindir)/$(CHILL_CROSS_NAME); \
+ else \
+- rm -f $(bindir)/$(CHILL_INSTALL_NAME); \
+- $(INSTALL_PROGRAM) chill.install $(bindir)/$(CHILL_INSTALL_NAME); \
+- chmod a+x $(bindir)/$(CHILL_INSTALL_NAME); \
++ rm -f $(DESTDIR)$(bindir)/$(CHILL_INSTALL_NAME); \
++ $(INSTALL_PROGRAM) chill.install $(DESTDIR)$(bindir)/$(CHILL_INSTALL_NAME); \
++ chmod a+x $(DESTDIR)$(bindir)/$(CHILL_INSTALL_NAME); \
+ fi ; \
+ fi ; \
+ fi
+@@ -145,9 +145,9 @@ CHILL.install-common:
+ # docs to install (in case LANGUAGES didn't contain chill earlier).
+ CHILL.install-info:
+ -for i in ch/chill.info*; do \
+- rm -f $(infodir)/chill.info*; \
++ rm -f $(DESTDIR)$(infodir)/chill.info*; \
+ realfile=`echo $$i | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
+- $(INSTALL_DATA) $$i $(infodir)/$$realfile; \
++ $(INSTALL_DATA) $$i $(DESTDIR)$(infodir)/$$realfile; \
+ done
+
+ CHILL.install-man:
diff --git a/lang/gcc2/patches/patch-gcc_cp_Make-lang.in b/lang/gcc2/patches/patch-gcc_cp_Make-lang.in
new file mode 100644
index 00000000000..b9b0e9f45d6
--- /dev/null
+++ b/lang/gcc2/patches/patch-gcc_cp_Make-lang.in
@@ -0,0 +1,68 @@
+$NetBSD: patch-gcc_cp_Make-lang.in,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- gcc/cp/Make-lang.in.orig 1999-04-26 23:50:36.000000000 +0000
++++ gcc/cp/Make-lang.in
+@@ -214,27 +214,27 @@ c++.install-normal:
+ c++.install-common:
+ -if [ -f cc1plus$(exeext) ] ; then \
+ if [ -f g++-cross$(exeext) ] ; then \
+- rm -f $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
+- $(INSTALL_PROGRAM) g++-cross$(exeext) $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
+- chmod a+x $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
+- rm -f $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
+- $(LN) $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext); \
++ $(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext); \
++ chmod a+x $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(CXX_CROSS_NAME)$(exeext); \
++ $(LN) $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext) $(DESTDIR)$(bindir)/$(CXX_CROSS_NAME)$(exeext); \
+ else \
+- rm -f $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
+- $(INSTALL_PROGRAM) g++$(exeext) $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
+- chmod a+x $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
+- rm -f $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
+- $(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
++ $(INSTALL_PROGRAM) g++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
++ chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
++ $(LN) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
+ fi ; \
+ if [ x$(DEMANGLER_PROG) != x ] && [ -x "$(DEMANGLER_PROG)" ]; then \
+ if [ -f g++-cross$(exeext) ] ; then \
+- rm -f $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
+- $(INSTALL_PROGRAM) $(DEMANGLER_PROG) $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
+- chmod a+x $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
++ $(INSTALL_PROGRAM) $(DEMANGLER_PROG) $(DESTDIR)$(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
++ chmod a+x $(DESTDIR)$(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
+ else \
+- rm -f $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
+- $(INSTALL_PROGRAM) $(DEMANGLER_PROG) $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
+- chmod a+x $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
++ $(INSTALL_PROGRAM) $(DEMANGLER_PROG) $(DESTDIR)$(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
++ chmod a+x $(DESTDIR)$(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
+ fi ; \
+ fi ; \
+ fi
+@@ -244,13 +244,13 @@ c++.install-info:
+ c++.install-man: $(srcdir)/cp/g++.1
+ -if [ -f cc1plus$(exeext) ] ; then \
+ if [ -f g++-cross$(exeext) ] ; then \
+- rm -f $(man1dir)/$(GXX_CROSS_NAME)$(manext); \
+- $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(man1dir)/$(GXX_CROSS_NAME)$(manext); \
+- chmod a-x $(man1dir)/$(GXX_CROSS_NAME)$(manext); \
++ rm -f $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(manext); \
++ $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(manext); \
++ chmod a-x $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(manext); \
+ else \
+- rm -f $(man1dir)/$(GXX_INSTALL_NAME)$(manext); \
+- $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(man1dir)/$(GXX_INSTALL_NAME)$(manext); \
+- chmod a-x $(man1dir)/$(GXX_INSTALL_NAME)$(manext); \
++ rm -f $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(manext); \
++ $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(manext); \
++ chmod a-x $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(manext); \
+ fi; \
+ else true; fi
+
diff --git a/lang/gcc2/patches/patch-gcc_f_Make-lang.in b/lang/gcc2/patches/patch-gcc_f_Make-lang.in
new file mode 100644
index 00000000000..1a5a3ad79ad
--- /dev/null
+++ b/lang/gcc2/patches/patch-gcc_f_Make-lang.in
@@ -0,0 +1,105 @@
+$NetBSD: patch-gcc_f_Make-lang.in,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- gcc/f/Make-lang.in.orig 1999-06-07 06:44:57.000000000 +0000
++++ gcc/f/Make-lang.in
+@@ -312,18 +312,18 @@ f77.install-normal:
+ # run, since we use libsubdir to store our `flag' file, lang-f77.
+ f77.install-common: installdirs
+ case "$(LANGUAGES)" in \
+- *[fF]77*) touch $(libsubdir)/lang-f77;; \
+- *) rm -f $(libsubdir)/lang-f77;; \
++ *[fF]77*) touch $(DESTDIR)$(libsubdir)/lang-f77;; \
++ *) rm -f $(DESTDIR)$(libsubdir)/lang-f77;; \
+ esac
+- -if [ -f $(libsubdir)/lang-f77 -a -f f771$(exeext) ] ; then \
++ -if [ -f $(DESTDIR)$(libsubdir)/lang-f77 -a -f f771$(exeext) ] ; then \
+ if [ -f g77-cross$(exeext) ] ; then \
+- rm -f $(bindir)/$(G77_CROSS_NAME)$(exeext); \
+- $(INSTALL_PROGRAM) g77-cross$(exeext) $(bindir)/$(G77_CROSS_NAME)$(exeext); \
+- chmod a+x $(bindir)/$(G77_CROSS_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(G77_CROSS_NAME)$(exeext); \
++ $(INSTALL_PROGRAM) g77-cross$(exeext) $(DESTDIR)$(bindir)/$(G77_CROSS_NAME)$(exeext); \
++ chmod a+x $(DESTDIR)$(bindir)/$(G77_CROSS_NAME)$(exeext); \
+ else \
+- rm -f $(bindir)/$(G77_INSTALL_NAME)$(exeext); \
+- $(INSTALL_PROGRAM) g77$(exeext) $(bindir)/$(G77_INSTALL_NAME)$(exeext); \
+- chmod a+x $(bindir)/$(G77_INSTALL_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(G77_INSTALL_NAME)$(exeext); \
++ $(INSTALL_PROGRAM) g77$(exeext) $(DESTDIR)$(bindir)/$(G77_INSTALL_NAME)$(exeext); \
++ chmod a+x $(DESTDIR)$(bindir)/$(G77_INSTALL_NAME)$(exeext); \
+ fi ; \
+ else true; fi
+ @if [ -f f77-install-ok -o -f $(srcdir)/f77-install-ok ]; then \
+@@ -335,7 +335,7 @@ f77.install-common: installdirs
+ echo ' f77-install-ok in the source or build directory.)'; \
+ echo ''; \
+ else true; fi
+- rm -f $(libsubdir)/lang-f77
++ rm -f $(DESTDIR)$(libsubdir)/lang-f77
+
+ # $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
+ # to do the install. The sed rule was copied from stmp-int-hdrs.
+@@ -343,44 +343,44 @@ f77.install-common: installdirs
+ # run, since we use libsubdir to store our `flag' file, lang-f77.
+ f77.install-info: f77.info installdirs
+ case "$(LANGUAGES)" in \
+- *[fF]77*) touch $(libsubdir)/lang-f77;; \
+- *) rm -f $(libsubdir)/lang-f77;; \
++ *[fF]77*) touch $(DESTDIR)$(libsubdir)/lang-f77;; \
++ *) rm -f $(DESTDIR)$(libsubdir)/lang-f77;; \
+ esac
+- if [ -f $(libsubdir)/lang-f77 -a -f f/g77.info ] ; then \
+- rm -f $(infodir)/g77.info*; \
++ if [ -f $(DESTDIR)$(libsubdir)/lang-f77 -a -f f/g77.info ] ; then \
++ rm -f $(DESTDIR)$(infodir)/g77.info*; \
+ for f in f/g77.info*; do \
+ realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
+- $(INSTALL_DATA) $$f $(infodir)/$$realfile; \
++ $(INSTALL_DATA) $$f $(DESTDIR)$(infodir)/$$realfile; \
+ done; \
+- chmod a-x $(infodir)/g77.info*; \
++ chmod a-x $(DESTDIR)$(infodir)/g77.info*; \
+ else true; fi
+- @if [ -f $(libsubdir)/lang-f77 -a -f $(srcdir)/f/g77.info ] ; then \
++ @if [ -f $(DESTDIR)$(libsubdir)/lang-f77 -a -f $(srcdir)/f/g77.info ] ; then \
+ if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
+ echo " install-info --info-dir=$(infodir) $(infodir)/g77.info"; \
+- install-info --info-dir=$(infodir) $(infodir)/g77.info || : ; \
++ install-info --info-dir=$(infodir) $(DESTDIR)$(infodir)/g77.info || : ; \
+ else : ; fi; \
+ else : ; fi
+- rm -f $(libsubdir)/lang-f77
++ rm -f $(DESTDIR)$(libsubdir)/lang-f77
+
+ # Make sure `installdirs' target (from gcc Makefile) has been
+ # run, since we use libsubdir to store our `flag' file, lang-f77.
+ f77.install-man: $(srcdir)/f/g77.1 installdirs
+ case "$(LANGUAGES)" in \
+- *[fF]77*) touch $(libsubdir)/lang-f77;; \
+- *) rm -f $(libsubdir)/lang-f77;; \
++ *[fF]77*) touch $(DESTDIR)$(libsubdir)/lang-f77;; \
++ *) rm -f $(DESTDIR)$(libsubdir)/lang-f77;; \
+ esac
+- -if [ -f $(libsubdir)/lang-f77 -a -f f771$(exeext) ] ; then \
++ -if [ -f $(DESTDIR)$(libsubdir)/lang-f77 -a -f f771$(exeext) ] ; then \
+ if [ -f g77-cross$(exeext) ] ; then \
+- rm -f $(man1dir)/$(G77_CROSS_NAME)$(manext); \
+- $(INSTALL_DATA) $(srcdir)/f/g77.1 $(man1dir)/$(G77_CROSS_NAME)$(manext); \
+- chmod a-x $(man1dir)/$(G77_CROSS_NAME)$(manext); \
++ rm -f $(DESTDIR)$(man1dir)/$(G77_CROSS_NAME)$(manext); \
++ $(INSTALL_DATA) $(srcdir)/f/g77.1 $(DESTDIR)$(man1dir)/$(G77_CROSS_NAME)$(manext); \
++ chmod a-x $(DESTDIR)$(man1dir)/$(G77_CROSS_NAME)$(manext); \
+ else \
+- rm -f $(man1dir)/$(G77_INSTALL_NAME)$(manext); \
+- $(INSTALL_DATA) $(srcdir)/f/g77.1 $(man1dir)/$(G77_INSTALL_NAME)$(manext); \
+- chmod a-x $(man1dir)/$(G77_INSTALL_NAME)$(manext); \
++ rm -f $(DESTDIR)$(man1dir)/$(G77_INSTALL_NAME)$(manext); \
++ $(INSTALL_DATA) $(srcdir)/f/g77.1 $(DESTDIR)$(man1dir)/$(G77_INSTALL_NAME)$(manext); \
++ chmod a-x $(DESTDIR)$(man1dir)/$(G77_INSTALL_NAME)$(manext); \
+ fi; \
+ else true; fi
+- rm -f $(libsubdir)/lang-f77
++ rm -f $(DESTDIR)$(libsubdir)/lang-f77
+
+ # Make sure `installdirs' target (from gcc Makefile) has been
+ # run, since we use libsubdir to store our `flag' file, lang-f77.
diff --git a/lang/gcc2/patches/patch-gcc_intl_Makefile.in b/lang/gcc2/patches/patch-gcc_intl_Makefile.in
new file mode 100644
index 00000000000..c9f770bbee3
--- /dev/null
+++ b/lang/gcc2/patches/patch-gcc_intl_Makefile.in
@@ -0,0 +1,39 @@
+$NetBSD: patch-gcc_intl_Makefile.in,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- gcc/intl/Makefile.in.orig 1999-02-02 18:49:16.000000000 +0000
++++ gcc/intl/Makefile.in
+@@ -114,26 +114,26 @@ install-exec: all
+ if test "$(PACKAGE)" = "gettext" \
+ && test '@INTLOBJS@' = '$(GETTOBJS)'; then \
+ if test -r $(MKINSTALLDIRS); then \
+- $(MKINSTALLDIRS) $(libdir) $(includedir); \
++ $(MKINSTALLDIRS) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
+ else \
+- $(top_srcdir)/mkinstalldirs $(libdir) $(includedir); \
++ $(top_srcdir)/mkinstalldirs $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
+ fi; \
+- $(INSTALL_DATA) intlh.inst $(includedir)/libintl.h; \
+- $(INSTALL_DATA) libintl.a $(libdir)/libintl.a; \
++ $(INSTALL_DATA) intlh.inst $(DESTDIR)$(includedir)/libintl.h; \
++ $(INSTALL_DATA) libintl.a $(DESTDIR)$(libdir)/libintl.a; \
+ else \
+ : ; \
+ fi
+ install-data: all
+ if test "$(PACKAGE)" = "gettext"; then \
+ if test -r $(MKINSTALLDIRS); then \
+- $(MKINSTALLDIRS) $(gettextsrcdir); \
++ $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
+ else \
+- $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
++ $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
+ fi; \
+- $(INSTALL_DATA) VERSION $(gettextsrcdir)/VERSION; \
++ $(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \
+ dists="$(DISTFILES.common)"; \
+ for file in $$dists; do \
+- $(INSTALL_DATA) $(srcdir)/$$file $(gettextsrcdir)/$$file; \
++ $(INSTALL_DATA) $(srcdir)/$$file $(DESTDIR)$(gettextsrcdir)/$$file; \
+ done; \
+ else \
+ : ; \
diff --git a/lang/gcc2/patches/patch-gcc_java_Make-lang.in b/lang/gcc2/patches/patch-gcc_java_Make-lang.in
new file mode 100644
index 00000000000..3e76f1ebc5b
--- /dev/null
+++ b/lang/gcc2/patches/patch-gcc_java_Make-lang.in
@@ -0,0 +1,34 @@
+$NetBSD: patch-gcc_java_Make-lang.in,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- gcc/java/Make-lang.in.orig 1999-06-25 08:26:23.000000000 +0000
++++ gcc/java/Make-lang.in
+@@ -144,20 +144,20 @@ java.install-normal:
+ java.install-common:
+ -if [ -f $(GCJ)$(exeext) ]; then \
+ if [ -f $(GCJ)-cross$(exeext) ]; then \
+- rm -f $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
+- $(INSTALL_PROGRAM) $(GCJ)-cross$(exeext) $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
+- chmod a+x $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
++ $(INSTALL_PROGRAM) $(GCJ)-cross$(exeext) $(DESTDIR)$(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
++ chmod a+x $(DESTDIR)$(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
+ else \
+- rm -f $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
+- $(INSTALL_PROGRAM) $(GCJ)$(exeext) $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
+- chmod a+x $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
++ $(INSTALL_PROGRAM) $(GCJ)$(exeext) $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
++ chmod a+x $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
+ fi ; \
+ fi ; \
+ for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS); do \
+ if [ -f $$tool$(exeext) ]; then \
+- rm -f $(bindir)/$$tool$(exeext); \
+- $(INSTALL_PROGRAM) $$tool$(exeext) $(bindir)/$$tool$(exeext); \
+- chmod a+x $(bindir)/$$tool$(exeext); \
++ rm -f $(DESTDIR)$(bindir)/$$tool$(exeext); \
++ $(INSTALL_PROGRAM) $$tool$(exeext) $(DESTDIR)$(bindir)/$$tool$(exeext); \
++ chmod a+x $(DESTDIR)$(bindir)/$$tool$(exeext); \
+ fi ; \
+ done
+
diff --git a/lang/gcc2/patches/patch-libchill_Makefile.in b/lang/gcc2/patches/patch-libchill_Makefile.in
new file mode 100644
index 00000000000..b13db1433b0
--- /dev/null
+++ b/lang/gcc2/patches/patch-libchill_Makefile.in
@@ -0,0 +1,19 @@
+$NetBSD: patch-libchill_Makefile.in,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- libchill/Makefile.in.orig 1999-08-07 05:36:10.000000000 +0000
++++ libchill/Makefile.in
+@@ -217,10 +217,10 @@ ${srcdir}/configure: configure.in
+ cd ${srcdir} && autoconf
+
+ install: all
+- $(INSTALL_DATA) libchill.a $(libsubdir)$(MULTISUBDIR)/libchill.a.n
+- $(RANLIB) $(libsubdir)$(MULTISUBDIR)/libchill.a.n
+- mv $(libsubdir)$(MULTISUBDIR)/libchill.a.n $(libsubdir)$(MULTISUBDIR)/libchill.a
+- $(INSTALL_DATA) chillrt0.o $(libsubdir)$(MULTISUBDIR)/chillrt0.o
++ $(INSTALL_DATA) libchill.a $(DESTDIR)$(libsubdir)$(MULTISUBDIR)/libchill.a.n
++ $(RANLIB) $(DESTDIR)$(libsubdir)$(MULTISUBDIR)/libchill.a.n
++ mv $(DESTDIR)$(libsubdir)$(MULTISUBDIR)/libchill.a.n $(DESTDIR)$(libsubdir)$(MULTISUBDIR)/libchill.a
++ $(INSTALL_DATA) chillrt0.o $(DESTDIR)$(libsubdir)$(MULTISUBDIR)/chillrt0.o
+ @rootme=`pwd`/ ; export rootme ; \
+ $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
+
diff --git a/lang/gcc2/patches/patch-libf2c_Makefile.in b/lang/gcc2/patches/patch-libf2c_Makefile.in
new file mode 100644
index 00000000000..1471c1a75c5
--- /dev/null
+++ b/lang/gcc2/patches/patch-libf2c_Makefile.in
@@ -0,0 +1,19 @@
+$NetBSD: patch-libf2c_Makefile.in,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- libf2c/Makefile.in.orig 1999-08-07 05:36:10.000000000 +0000
++++ libf2c/Makefile.in
+@@ -197,10 +197,10 @@ check:
+ cd libU77; $(MAKE) G77DIR=../../../gcc/ check
+
+ install: all
+- $(INSTALL_DATA) $(LIBG2C) $(libsubdir)/$(MULTISUBDIR)/$(LIBG2C).n
+- ( cd $(libsubdir)/$(MULTISUBDIR) ; $(RANLIB) $(LIBG2C).n )
+- mv -f $(libsubdir)/$(MULTISUBDIR)/$(LIBG2C).n $(libsubdir)/$(MULTISUBDIR)/$(LIBG2C)
+- $(INSTALL_DATA) g2c.h $(libsubdir)/include/g2c.h
++ $(INSTALL_DATA) $(LIBG2C) $(DESTDIR)$(libsubdir)/$(MULTISUBDIR)/$(LIBG2C).n
++ ( cd $(DESTDIR)$(libsubdir)/$(MULTISUBDIR) ; $(RANLIB) $(LIBG2C).n )
++ mv -f $(DESTDIR)$(libsubdir)/$(MULTISUBDIR)/$(LIBG2C).n $(DESTDIR)$(libsubdir)/$(MULTISUBDIR)/$(LIBG2C)
++ $(INSTALL_DATA) g2c.h $(DESTDIR)$(libsubdir)/include/g2c.h
+ @if [ -f f2c-install-ok -o -f $(srcdir)/f2c-install-ok ]; then \
+ echo ''; \
+ echo 'Warning: g77 no longer installs libf2c.a or f2c.h.'; \
diff --git a/lang/gcc2/patches/patch-libio_Makefile.in b/lang/gcc2/patches/patch-libio_Makefile.in
new file mode 100644
index 00000000000..6764925a661
--- /dev/null
+++ b/lang/gcc2/patches/patch-libio_Makefile.in
@@ -0,0 +1,31 @@
+$NetBSD: patch-libio_Makefile.in,v 1.1 2015/04/25 10:32:07 wiz Exp $
+
+--- libio/Makefile.in.orig 2011-07-15 08:16:38.000000000 +0000
++++ libio/Makefile.in
+@@ -113,19 +113,19 @@ install:
+ if [ -z "$(MULTISUBDIR)" ]; then \
+ if [ "$(_G_CONFIG_H)" != "" ]; then \
+ if [ x$(enable_version_specific_runtime_libs) = xyes ]; then \
+- rm -f $(gxx_include_dir)/_G_config.h ; \
+- $(INSTALL_DATA) _G_config.h $(gxx_include_dir)/_G_config.h || exit 1; \
++ rm -f $(DESTDIR)$(gxx_include_dir)/_G_config.h ; \
++ $(INSTALL_DATA) _G_config.h $(DESTDIR)$(gxx_include_dir)/_G_config.h || exit 1; \
+ else \
+- rm -f $(tooldir)/include/_G_config.h ; \
+- $(INSTALL_DATA) _G_config.h $(tooldir)/include/_G_config.h || exit 1; \
++ rm -f $(DESTDIR)$(tooldir)/include/_G_config.h ; \
++ $(INSTALL_DATA) _G_config.h $(DESTDIR)$(tooldir)/include/_G_config.h || exit 1; \
+ fi; \
+ else true; \
+ fi ; \
+ cd $(srcdir); \
+ for FILE in $(USER_INCLUDES); do if [ $$FILE != _G_config.h ]; then \
+- rm -f $(gxx_include_dir)/$$FILE ; \
+- $(INSTALL_DATA) $$FILE $(gxx_include_dir)/$$FILE ; \
+- chmod a-x $(gxx_include_dir)/$$FILE ; \
++ rm -f $(DESTDIR)$(gxx_include_dir)/$$FILE ; \
++ $(INSTALL_DATA) $$FILE $(DESTDIR)$(gxx_include_dir)/$$FILE ; \
++ chmod a-x $(DESTDIR)$(gxx_include_dir)/$$FILE ; \
+ else true; fi; done ; \
+ else true; \
+ fi