Subject: Patches for crossbuilding on DragonFlyBSD
To: None <tech-toolchain@netbsd.org>
From: Thomas E. Spanjaard <tgen@netphreax.net>
List: tech-toolchain
Date: 01/11/2006 15:31:08
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigF6F764CD8293D0C9CEEFFC85
Content-Type: multipart/mixed;
 boundary="------------090805020302070201040704"

This is a multi-part message in MIME format.
--------------090805020302070201040704
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi there. Attached are two patches to make crossbuilding on DragonFlyBSD 
work. I've verified that they apply cleanly to and work for both NetBSD 
3.99.9 NetBSD 3.0, but I'd like others to test as well, and/or give 
feedback. The gnu.diff patch applies in gnu/, and dist.diff in dist/.

Looking forward to feedback,
-- 
         Thomas E. Spanjaard
         tgen@netphreax.net

--------------090805020302070201040704
Content-Type: text/plain;
 name="gnu.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="gnu.diff"

diff -ruN /home/tgen/files/netbsd/src/gnu/dist/gcc/config.guess ./dist/gcc/config.guess
--- /home/tgen/files/netbsd/src/gnu/dist/gcc/config.guess	2003-07-25 09:04:14.000000000 +0000
+++ ./dist/gcc/config.guess	2005-10-12 00:18:23.000000000 +0000
@@ -761,6 +761,9 @@
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
 	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
 	exit 0 ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-just-dragonflybsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit 0 ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
 	exit 0 ;;
diff -ruN /home/tgen/files/netbsd/src/gnu/dist/gcc/config.sub ./dist/gcc/config.sub
--- /home/tgen/files/netbsd/src/gnu/dist/gcc/config.sub	2003-12-07 09:58:56.000000000 +0000
+++ ./dist/gcc/config.sub	2005-10-12 00:17:30.000000000 +0000
@@ -1118,7 +1118,7 @@
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
-	      | -powermax* | -dnix* | -microbsd*)
+	      | -powermax* | -dnix* | -microbsd* | -dragonflybsd*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
diff -ruN /home/tgen/files/netbsd/src/gnu/dist/gcc/configure.in ./dist/gcc/configure.in
--- /home/tgen/files/netbsd/src/gnu/dist/gcc/configure.in	2004-02-10 12:56:21.000000000 +0000
+++ ./dist/gcc/configure.in	2005-10-12 01:00:51.000000000 +0000
@@ -424,6 +424,9 @@
   i[34567]86-*-freebsd*)
     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
     ;;
+  i[34567]86-*-dragonflybsd*)
+    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+    ;;
   i[3456]86-*-linux*)
     # The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's
     # not build java stuff by default.
diff -ruN /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config/dragonfly-spec.h ./dist/gcc/gcc/config/dragonfly-spec.h
--- /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config/dragonfly-spec.h	1970-01-01 00:00:00.000000000 +0000
+++ ./dist/gcc/gcc/config/dragonfly-spec.h	2005-10-12 01:36:30.000000000 +0000
@@ -0,0 +1,186 @@
+/* $DragonFly: src/gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h,v 1.10 2005/08/03 03:12:00 joerg Exp $ */
+
+/* Base configuration file for all DragonFly targets.
+   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+/* Common DragonFly configuration. 
+   All DragonFly architectures should include this file, which will specify
+   their commonalities.
+
+   Adapted from gcc/config/freebsd-spec.h by
+   Joerg Sonnenberger <joerg@bec.de>
+
+   Adapted from gcc/config/freebsd.h by 
+   David O'Brien <obrien@FreeBSD.org>
+   Loren J. Rittle <ljrittle@acm.org>.  */
+
+
+/* This defines which switch letters take arguments.  On DragonFly, most of
+   the normal cases (defined in gcc.c) apply, and we also have -h* and
+   -z* options (for the linker) (coming from SVR4).
+   We also have -R (alias --rpath), no -z, --soname (-h), --assert etc.  */
+
+#define DFBSD_SWITCH_TAKES_ARG(CHAR)					\
+  (DEFAULT_SWITCH_TAKES_ARG (CHAR)					\
+    || (CHAR) == 'h'							\
+    || (CHAR) == 'z' /* ignored by ld */				\
+    || (CHAR) == 'R')
+
+/* This defines which multi-letter switches take arguments.  */
+
+#define DFBSD_WORD_SWITCH_TAKES_ARG(STR)					\
+  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)					\
+   || !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link")		\
+   || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym") 		\
+   || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
+
+#define DFBSD_TARGET_OS_CPP_BUILTINS()					\
+  do									\
+    {									\
+	if (DFBSD_MAJOR == 3)	       				\
+	  builtin_define ("__DragonFly__=3");			       	\
+	else if (DFBSD_MAJOR == 2)	       				\
+	  builtin_define ("__DragonFly__=2");			       	\
+	else if (DFBSD_MAJOR == 1)	       				\
+	  builtin_define ("__DragonFly__=1");			       	\
+	else								\
+	  builtin_define ("__DragonFly__");			       	\
+	builtin_define ("__DragonFly_cc_version=100001");		\
+	builtin_define_std ("unix");					\
+	builtin_define ("__KPRINTF_ATTRIBUTE__");		       	\
+	builtin_define ("__GCC_VISIBILITY__=1");			\
+	builtin_assert ("system=unix");					\
+	builtin_assert ("system=bsd");					\
+	builtin_assert ("system=DragonFly");				\
+	DFBSD_TARGET_CPU_CPP_BUILTINS();					\
+    }									\
+  while (0)
+
+/* Define the default DragonFly-specific per-CPU hook code. */
+#define DFBSD_TARGET_CPU_CPP_BUILTINS() do {} while (0)
+
+/* Provide a CPP_SPEC appropriate for DragonFly.  We just deal with the GCC 
+   option `-posix', and PIC issues.  */
+
+#define DFBSD_CPP_SPEC "							\
+  %(cpp_cpu)								\
+  %{fPIC|fpic|fPIE|fpie:-D__PIC__ -D__pic__}				\
+  %{posix:-D_POSIX_SOURCE}"
+
+/* Provide a STARTFILE_SPEC appropriate for DragonFly.  Here we add
+   the magical crtbegin.o file (see crtstuff.c) which provides part 
+	of the support for getting C++ file-scope static object constructed 
+	before entering `main'.  */
+   
+#define DFBSD_STARTFILE_SPEC \
+  "%{!shared: \
+     %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
+		       %{!p:%{profile:gcrt1.o%s} \
+			 %{!profile:crt1.o%s}}}} \
+   crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
+
+/* Provide a ENDFILE_SPEC appropriate for DragonFly.  Here we tack on
+   the magical crtend.o file (see crtstuff.c) which provides part of 
+	the support for getting C++ file-scope static object constructed 
+	before entering `main', followed by a normal "finalizer" file, 
+	`crtn.o'.  */
+
+#define DFBSD_ENDFILE_SPEC \
+  "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
+
+/* Provide a LIB_SPEC appropriate for DragonFly as configured and as
+   required by the user-land thread model.  Select the appropriate libc,
+   depending on whether we're doing profiling or need threads support.
+   Make it a hard error if -pthread is provided on the command line and gcc
+   was configured with --disable-threads (this will help avoid bug
+   reports from users complaining about threading when they
+   misconfigured the gcc bootstrap but are later consulting DragonFly
+   manual pages that refer to the mythical -pthread option).  */
+
+/* Provide a LIB_SPEC appropriate for DragonFly.  Just select the appropriate
+   libc, depending on whether we're doing profiling or need threads support.
+   (simular to the default, except no -lg, and no -p).  */
+
+#ifdef DFBSD_NO_THREADS
+#define DFBSD_LIB_SPEC "						\
+  %{pthread: %eThe -pthread option is only supported on DragonFly when gcc \
+is built with the --enable-threads configure-time option.}		\
+  %{!nostdlib{!nostartfiles{!nolibc: -lc}}}				\
+  }"
+#else
+#define DFBSD_LIB_SPEC "						\
+  %{!shared: %{pthread:-lc_r}} 						\
+  %{!nostdlib: %{!nostartfiles: %{!nolibc: -lc}}}			\
+  "
+#endif
+
+#define LINK_LIBGCC_SPEC ""
+
+#define PRE_LIB_SPEC "							\
+  %{pg: -L"PREFIX2"/lib/gcc34/profiling 				\
+    %{!static: -rpath /usr/lib/gcc34/profiling 				\
+      -rpath-link "PREFIX2"/lib/gcc34/profiling}}			\
+  %{g: -L"PREFIX2"/lib/gcc34/debug 					\
+    %{!static: -rpath /usr/lib/gcc34/debug				\
+      -rpath-link "PREFIX2"/lib/gcc34/debug}}				\
+  -L"PREFIX2"/lib/gcc34							\
+  %{!static: -rpath /usr/lib/gcc34  -rpath-link "PREFIX2"/lib/gcc34} 	\
+  %{pg: -L"PREFIX2"/lib/profiling 					\
+    %{!static: -rpath /usr/lib/profiling				\
+      -rpath-link "PREFIX2"/lib/profiling}} 				\
+  %{g: -L"PREFIX2"/lib/debug 						\
+    %{!static: -rpath /usr/lib/debug -rpath-link "PREFIX2"/lib/debug}} 	\
+  %{!static: -rpath /usr/lib -rpath-link "PREFIX2"/lib} 		\
+  "
+
+#define DFBSD_LINK_COMMAND_SPEC "\
+%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
+    %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
+    %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
+    %{static:} %{L*} %(link_libgcc) %o \
+    %{fprofile-arcs|fprofile-generate: -lgcov}\
+    %{!nostdlib:%{!nodefaultlibs:%(pre_lib)}}\
+    %{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}}\
+    %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
+
+#define	DFBSD_DYNAMIC_LINKER		"/usr/libexec/ld-elf.so.2"
+#define	STANDARD_STARTFILE_PREFIX_1	PREFIX2"/lib/gcc34/"
+#define	STANDARD_EXEC_PREFIX		PREFIX2"/libexec/gcc34/"
+#define	STANDARD_STARTFILE_PREFIX	PREFIX2"/lib/"
+#define TOOLDIR_BASE_PREFIX		PREFIX2"/libexec/gcc34"
+#define STANDARD_BINDIR_PREFIX		PREFIX2"/libexec/gcc34"
+#define STANDARD_LIBEXEC_PREFIX		PREFIX2"/libexec/gcc34"
+
+#define GPLUSPLUS_INCLUDE_DIR		PREFIX2"/include/c++"
+#define GPLUSPLUS_TOOL_INCLUDE_DIR	PREFIX2"/include/c++/3.4"
+#define	GPLUSPLUS_BACKWARD_INCLUDE_DIR	PREFIX2"/include/c++/3.4/backward"
+#define	GCC_LOCAL_INCLUDE_DIR		PREFIX2"/libdata/gcc34"
+#define	GCC_INCLUDE_DIR			PREFIX2"/include"
+
+#undef INCLUDE_DEFAULTS
+#define INCLUDE_DEFAULTS				\
+  {							\
+    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },		\
+    { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 0 },	\
+    { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 0 },	\
+    { GCC_INCLUDE_DIR, "GCC", 0, 0 },			\
+    { GCC_LOCAL_INCLUDE_DIR, "GCC", 0, 0 },		\
+    { NULL, NULL, 0, 0 }				\
+  }
diff -ruN /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config/dragonfly.h ./dist/gcc/gcc/config/dragonfly.h
--- /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config/dragonfly.h	1970-01-01 00:00:00.000000000 +0000
+++ ./dist/gcc/gcc/config/dragonfly.h	2005-10-12 01:36:46.000000000 +0000
@@ -0,0 +1,94 @@
+/* $DragonFly: src/gnu/usr.bin/cc34/cc_prep/config/dragonfly.h,v 1.1 2004/06/14 22:27:53 joerg Exp $ */
+
+/* Base configuration file for all DragonFly targets.
+   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+/* Common DragonFly configuration. 
+   All DragonFly architectures should include this file, which will specify
+   their commonalities.
+
+   Adapted from gcc/config/freebsd.h by
+   Joerg Sonnenberger <joerg@bec.de>
+
+   Adapted from gcc/config/i386/freebsd-elf.h by 
+   David O'Brien <obrien@FreeBSD.org>.  
+   Further work by David O'Brien <obrien@FreeBSD.org> and
+   Loren J. Rittle <ljrittle@acm.org>.  */
+
+
+/* This defines which switch letters take arguments.  On DragonFly, most of
+   the normal cases (defined in gcc.c) apply, and we also have -h* and
+   -z* options (for the linker) (coming from SVR4).
+   We also have -R (alias --rpath), no -z, --soname (-h), --assert etc.  */
+
+#undef  SWITCH_TAKES_ARG
+#define SWITCH_TAKES_ARG(CHAR) (DFBSD_SWITCH_TAKES_ARG(CHAR))
+
+#undef  WORD_SWITCH_TAKES_ARG
+#define WORD_SWITCH_TAKES_ARG(STR) (DFBSD_WORD_SWITCH_TAKES_ARG(STR))
+
+#undef  TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS() DFBSD_TARGET_OS_CPP_BUILTINS()
+
+#undef  CPP_SPEC
+#define CPP_SPEC DFBSD_CPP_SPEC
+
+#undef  STARTFILE_SPEC
+#define STARTFILE_SPEC DFBSD_STARTFILE_SPEC
+
+#undef  ENDFILE_SPEC
+#define ENDFILE_SPEC DFBSD_ENDFILE_SPEC
+
+#undef  LIB_SPEC
+#define LIB_SPEC DFBSD_LIB_SPEC
+
+#undef	LINK_COMMAND_SPEC
+#define LINK_COMMAND_SPEC DFBSD_LINK_COMMAND_SPEC 
+
+/************************[  Target stuff  ]***********************************/
+
+/* All DragonFly Architectures support the ELF object file format.  */
+#undef  OBJECT_FORMAT_ELF
+#define OBJECT_FORMAT_ELF
+
+/* Don't assume anything about the header files.  */
+#undef  NO_IMPLICIT_EXTERN_C
+#define NO_IMPLICIT_EXTERN_C	1
+
+/* Make gcc agree with DragonFly's standard headers (<machine/stdint.h>, etc...)  */
+
+#undef  WCHAR_TYPE
+#define WCHAR_TYPE "int"
+
+#define MATH_LIBRARY_PROFILE    "-lm_p"
+
+/* Code generation parameters.  */
+
+/* Use periods rather than dollar signs in special g++ assembler names.
+   This ensures the configuration knows our system correctly so we can link
+   with libraries compiled with the native cc.  */
+#undef NO_DOLLAR_IN_LABEL
+
+/* Used by libgcc2.c.  We support file locking with fcntl / F_SETLKW.
+   This enables the test coverage code to use file locking when exiting a
+   program, which avoids race conditions if the program has forked.  */
+#define TARGET_HAS_F_SETLKW
+
+#define	DFBSD_MAJOR	1
diff -ruN /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config/dragonflybsd-nthr.h ./dist/gcc/gcc/config/dragonflybsd-nthr.h
--- /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config/dragonflybsd-nthr.h	1970-01-01 00:00:00.000000000 +0000
+++ ./dist/gcc/gcc/config/dragonflybsd-nthr.h	2005-10-12 01:28:41.000000000 +0000
@@ -0,0 +1,22 @@
+/* FreeBSD configuration setting for FreeBSD systems.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+   Contributed by Loren J. Rittle <ljrittle@acm.org>
+
+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.  */
+
+#define FBSD_NO_THREADS
diff -ruN /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config/dragonflybsd-spec.h ./dist/gcc/gcc/config/dragonflybsd-spec.h
--- /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config/dragonflybsd-spec.h	1970-01-01 00:00:00.000000000 +0000
+++ ./dist/gcc/gcc/config/dragonflybsd-spec.h	2005-10-12 01:29:44.000000000 +0000
@@ -0,0 +1,150 @@
+/* Base configuration file for all FreeBSD targets.
+   Copyright (C) 1999, 2000, 2001 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.  */
+
+/* Common FreeBSD configuration. 
+   All FreeBSD architectures should include this file, which will specify
+   their commonalities.
+   Adapted from gcc/config/freebsd.h by 
+   David O'Brien <obrien@FreeBSD.org>
+   Loren J. Rittle <ljrittle@acm.org>.  */
+
+
+/* In case we need to know.  */
+#define USING_CONFIG_FREEBSD_SPEC 1
+
+/* This defines which switch letters take arguments.  On FreeBSD, most of
+   the normal cases (defined in gcc.c) apply, and we also have -h* and
+   -z* options (for the linker) (coming from SVR4).
+   We also have -R (alias --rpath), no -z, --soname (-h), --assert etc.  */
+
+#define FBSD_SWITCH_TAKES_ARG(CHAR)					\
+  (DEFAULT_SWITCH_TAKES_ARG (CHAR)					\
+    || (CHAR) == 'h'							\
+    || (CHAR) == 'z' /* ignored by ld */				\
+    || (CHAR) == 'R')
+
+/* This defines which multi-letter switches take arguments.  */
+
+#define FBSD_WORD_SWITCH_TAKES_ARG(STR)					\
+  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)					\
+   || !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link")		\
+   || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym") 		\
+   || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
+
+#define FBSD_TARGET_OS_CPP_BUILTINS()					\
+  do									\
+    {									\
+	if (FBSD_MAJOR == 6)						\
+	  builtin_define ("__FreeBSD__=6");			       	\
+	else if (FBSD_MAJOR == 5)	       				\
+	  builtin_define ("__FreeBSD__=5");			       	\
+	else if (FBSD_MAJOR == 4)			       		\
+	  builtin_define ("__FreeBSD__=4");			       	\
+	else if (FBSD_MAJOR == 3)	       				\
+	  builtin_define ("__FreeBSD__=3");			       	\
+	else								\
+	  builtin_define ("__FreeBSD__");			       	\
+	builtin_define_std ("unix");					\
+	builtin_define ("__ELF__");					\
+	builtin_define ("__KPRINTF_ATTRIBUTE__");		       	\
+	builtin_assert ("system=unix");					\
+	builtin_assert ("system=bsd");					\
+	builtin_assert ("system=FreeBSD");				\
+	FBSD_TARGET_CPU_CPP_BUILTINS();					\
+    }									\
+  while (0)
+
+/* Define the default FreeBSD-specific per-CPU hook code. */
+#define FBSD_TARGET_CPU_CPP_BUILTINS() do {} while (0)
+
+/* Provide a CPP_SPEC appropriate for FreeBSD.  We just deal with the GCC 
+   option `-posix', and PIC issues.  */
+
+#define FBSD_CPP_SPEC "							\
+  %(cpp_cpu)								\
+  %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__}		\
+  %{posix:-D_POSIX_SOURCE}"
+
+/* Provide a STARTFILE_SPEC appropriate for FreeBSD.  Here we add
+   the magical crtbegin.o file (see crtstuff.c) which provides part 
+	of the support for getting C++ file-scope static object constructed 
+	before entering `main'.  */
+   
+#define FBSD_STARTFILE_SPEC \
+  "%{!shared: \
+     %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
+		       %{!p:%{profile:gcrt1.o%s} \
+			 %{!profile:crt1.o%s}}}} \
+   crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
+
+/* Provide a ENDFILE_SPEC appropriate for FreeBSD.  Here we tack on
+   the magical crtend.o file (see crtstuff.c) which provides part of 
+	the support for getting C++ file-scope static object constructed 
+	before entering `main', followed by a normal "finalizer" file, 
+	`crtn.o'.  */
+
+#define FBSD_ENDFILE_SPEC \
+  "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
+
+/* Provide a LIB_SPEC appropriate for FreeBSD as configured and as
+   required by the user-land thread model.  Before __FreeBSD_version
+   500016, select the appropriate libc, depending on whether we're
+   doing profiling or need threads support.  At __FreeBSD_version
+   500016 and later, when threads support is requested include both
+   -lc and -lc_r instead of only -lc_r.  To make matters interesting,
+   we can't actually use __FreeBSD_version provided by <osreldate.h>
+   directly since it breaks cross-compiling.  As a final twist, make
+   it a hard error if -pthread is provided on the command line and gcc
+   was configured with --disable-threads (this will help avoid bug
+   reports from users complaining about threading when they
+   misconfigured the gcc bootstrap but are later consulting FreeBSD
+   manual pages that refer to the mythical -pthread option).  */
+
+/* Provide a LIB_SPEC appropriate for FreeBSD.  Just select the appropriate
+   libc, depending on whether we're doing profiling or need threads support.
+   (simular to the default, except no -lg, and no -p).  */
+
+#ifdef FBSD_NO_THREADS
+#define FBSD_LIB_SPEC "							\
+  %{pthread: %eThe -pthread option is only supported on FreeBSD when gcc \
+is built with the --enable-threads configure-time option.}		\
+  %{!shared:								\
+    %{!pg: -lc}								\
+    %{pg:  -lc_p}							\
+  }"
+#else
+#if FBSD_MAJOR >= 5
+#define FBSD_LIB_SPEC "							\
+  %{!shared:								\
+    %{!pg: %{pthread:-lc_r} -lc}					\
+    %{pg:  %{pthread:-lc_r_p} -lc_p}					\
+  }"
+#else
+#define FBSD_LIB_SPEC "							\
+  %{!shared:								\
+    %{!pg:								\
+      %{!pthread:-lc}							\
+      %{pthread:-lc_r}}							\
+    %{pg:								\
+      %{!pthread:-lc_p}							\
+      %{pthread:-lc_r_p}}						\
+  }"
+#endif
+#endif
diff -ruN /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config/i386/dragonfly.h ./dist/gcc/gcc/config/i386/dragonfly.h
--- /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config/i386/dragonfly.h	1970-01-01 00:00:00.000000000 +0000
+++ ./dist/gcc/gcc/config/i386/dragonfly.h	2005-10-12 01:38:15.000000000 +0000
@@ -0,0 +1,152 @@
+/* $DragonFly: src/gnu/usr.bin/cc34/cc_prep/config/i386/dragonfly.h,v 1.2 2005/05/11 19:46:50 dillon Exp $ */
+
+/* Definitions for Intel 386 running DragonFly with ELF format
+   
+   Copyright (C) 1996, 2000, 2002 Free Software Foundation, Inc.
+   Contributed by Eric Youngdale.
+   Modified for stabs-in-ELF by H.J. Lu.
+   Adapted from GNU/Linux version by John Polstra.
+   Continued development by David O'Brien <obrien@freebsd.org>
+   Adapted from the FreeBSD version.
+
+   Changes:
+   - remove support for changing the dynamic linker
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+
+#define TARGET_VERSION fprintf (stderr, " (i386 DragonFly/ELF)");
+
+/* Override the default comment-starter of "/".  */
+#undef  ASM_COMMENT_START
+#define ASM_COMMENT_START "#"
+
+#undef  ASM_APP_ON
+#define ASM_APP_ON "#APP\n"
+
+#undef  ASM_APP_OFF
+#define ASM_APP_OFF "#NO_APP\n"
+
+#undef  DBX_REGISTER_NUMBER
+#define DBX_REGISTER_NUMBER(n) \
+  (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
+
+#undef  NO_PROFILE_COUNTERS
+#define NO_PROFILE_COUNTERS	1
+
+/* Tell final.c that we don't need a label passed to mcount.  */
+
+#undef  MCOUNT_NAME
+#define MCOUNT_NAME ".mcount"
+
+/* Make gcc agree with <machine/ansi.h>.  */
+
+#undef  SIZE_TYPE
+#define SIZE_TYPE	(TARGET_64BIT ? "long unsigned int" : "unsigned int")
+ 
+#undef  PTRDIFF_TYPE
+#define PTRDIFF_TYPE	(TARGET_64BIT ? "long int" : "int")
+  
+#undef  WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE	(TARGET_64BIT ? 32 : BITS_PER_WORD)
+
+/* Provide a STARTFILE_SPEC appropriate for DragonFly.  Here we add
+   the magical crtbegin.o file (see crtstuff.c) which provides part 
+	of the support for getting C++ file-scope static object constructed 
+	before entering `main'.  */
+   
+#undef	STARTFILE_SPEC
+#define STARTFILE_SPEC \
+  "%{!shared: \
+     %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
+		       %{!p:%{profile:gcrt1.o%s} \
+			 %{!profile:crt1.o%s}}}} \
+   crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
+
+/* Provide a ENDFILE_SPEC appropriate for DragonFly.  Here we tack on
+   the magical crtend.o file (see crtstuff.c) which provides part of 
+	the support for getting C++ file-scope static object constructed 
+	before entering `main', followed by a normal "finalizer" file, 
+	`crtn.o'.  */
+
+#undef	ENDFILE_SPEC
+#define ENDFILE_SPEC \
+  "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
+
+/* Provide a LINK_SPEC appropriate for DragonFly.  Here we provide support
+   for the special GCC options -static and -shared, which allow us to
+   link things in one of these three modes by applying the appropriate
+   combinations of options at link-time. We like to support here for
+   as many of the other GNU linker options as possible. But I don't
+   have the time to search for those flags. I am sure how to add
+   support for -soname shared_object_name. H.J.
+
+   I took out %{v:%{!V:-V}}. It is too much :-(. They can use
+   -Wl,-V.
+
+   When the -shared link option is used a final link is not being
+   done.  */
+
+#undef	LINK_SPEC
+#define LINK_SPEC "\
+  %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
+  %{Wl,*:%*} \
+  %{v:-V} \
+  %{assert*} %{R*} %{rpath*} %{defsym*} \
+  %{shared:-Bshareable %{h*} %{soname*}} \
+    %{!shared: \
+      %{!static: \
+        %{rdynamic:-export-dynamic} \
+        %{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.2}} \
+    %{static:-Bstatic}} \
+  %{symbolic:-Bsymbolic}"
+
+/* A C statement to output to the stdio stream FILE an assembler
+   command to advance the location counter to a multiple of 1<<LOG
+   bytes if it is within MAX_SKIP bytes.
+
+   This is used to align code labels according to Intel recommendations.  */
+
+#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
+#undef  ASM_OUTPUT_MAX_SKIP_ALIGN
+#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP)					\
+  if ((LOG) != 0) {														\
+    if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG));	\
+    else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));	\
+  }
+#endif
+
+/* Don't default to pcc-struct-return, we want to retain compatibility with
+   older gcc versions AND pcc-struct-return is nonreentrant.
+   (even though the SVR4 ABI for the i386 says that records and unions are
+   returned in memory).  */
+
+#undef  DEFAULT_PCC_STRUCT_RETURN
+#define DEFAULT_PCC_STRUCT_RETURN 0
+
+/* DragonFly sets the rounding precision of the FPU to 53 bits.  Let the
+   compiler get the contents of <float.h> and std::numeric_limits correct.  */
+#define SUBTARGET_OVERRIDE_OPTIONS			\
+  do {							\
+    if (!TARGET_64BIT) {				\
+      REAL_MODE_FORMAT (XFmode)				\
+	= &ieee_extended_intel_96_round_53_format;	\
+      REAL_MODE_FORMAT (TFmode)				\
+	= &ieee_extended_intel_96_round_53_format;	\
+    }							\
+  } while (0)
diff -ruN /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config/t-dragonflybsd ./dist/gcc/gcc/config/t-dragonflybsd
--- /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config/t-dragonflybsd	1970-01-01 00:00:00.000000000 +0000
+++ ./dist/gcc/gcc/config/t-dragonflybsd	2005-10-12 01:27:30.000000000 +0000
@@ -0,0 +1,8 @@
+# Don't run fixproto
+STMP_FIXPROTO =
+
+# Compile crtbeginS.o and crtendS.o with pic.
+CRTSTUFF_T_CFLAGS_S = -fPIC
+
+# Compile libgcc.a with pic.
+TARGET_LIBGCC2_CFLAGS += -fPIC
diff -ruN /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config/t-dragonflybsd-thread ./dist/gcc/gcc/config/t-dragonflybsd-thread
--- /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config/t-dragonflybsd-thread	1970-01-01 00:00:00.000000000 +0000
+++ ./dist/gcc/gcc/config/t-dragonflybsd-thread	2005-10-12 01:28:05.000000000 +0000
@@ -0,0 +1,2 @@
+# This is currently needed to compile libgcc2 for threads support
+TARGET_LIBGCC2_CFLAGS += -pthread
diff -ruN /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config.gcc ./dist/gcc/gcc/config.gcc
--- /home/tgen/files/netbsd/src/gnu/dist/gcc/gcc/config.gcc	2005-08-17 07:13:32.000000000 +0000
+++ ./dist/gcc/gcc/config.gcc	2005-10-12 01:50:01.000000000 +0000
@@ -496,6 +496,24 @@
 	esac
 	fbsd_tm_file="${fbsd_tm_file} freebsd-spec.h freebsd.h"
 	;;
+*-*-dragonflybsd*)
+	# This is the generic ELF configuration of DragonFlyBSD. Shamelessly
+	# ripped from the FreeBSD counterpart.
+	gas=yes
+	gnu_ld=yes
+	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
+	tmake_file="t-slibgcc-elf-ver t-dragonflybsd"
+	xmake_file=none
+	xm_defines=POSIX
+	case x${enable_threads} in
+	xno) dfbsd_tm_file="${dfbsd_tm_file} dragonflybsd-nthr.h";;
+	x | xyes | xpthreads | xposix)
+		thread_file='posix'
+		tmake_file="${tmake_file} t-dragonflybsd-thread";;
+	*) echo 'Unknown thread configuration for DragonFlyBSD'; exit 1;;
+	esac
+	dfbsd_tm_file="${dfbsd_tm_file} dragonflybsd-spec.h dragonflybsd.h"
+	;;
 esac
 
 case $machine in
@@ -1139,6 +1157,9 @@
 i[34567]86-*-freebsd*)
 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
 	;;
+i[34567]86-*-dragonflybsd*)
+	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${dfbsd_tm_file} i386/dragonflybsd.h"
+	;;
 x86_64-*-freebsd*)
 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h"
 	;;

--------------090805020302070201040704
Content-Type: text/plain;
 name="dist.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="dist.diff"

diff -ruN /home/tgen/files/netbsd/src/dist/file/config.guess ./file/config.guess
--- /home/tgen/files/netbsd/src/dist/file/config.guess	2005-02-21 15:25:57.000000000 +0000
+++ ./file/config.guess	2005-10-12 02:09:00.000000000 +0000
@@ -756,6 +756,9 @@
 	rm -f $dummy.c && rmdir $tmpdir
 	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
 	exit 0 ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-just-dragonflybsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit 0 ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
 	exit 0 ;;
diff -ruN /home/tgen/files/netbsd/src/dist/file/config.sub ./file/config.sub
--- /home/tgen/files/netbsd/src/dist/file/config.sub	2005-02-21 15:25:57.000000000 +0000
+++ ./file/config.sub	2005-10-12 02:10:28.000000000 +0000
@@ -1107,7 +1107,8 @@
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
-	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dragonflybsd*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)

--------------090805020302070201040704--

--------------enigF6F764CD8293D0C9CEEFFC85
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (NetBSD)

iD8DBQFDxSS/6xCMwBJ+1+sRA2RdAJ96307FGTnhyAFgZX0kieANda0H5QCgize2
hlFEn1r5KQeViPdiicVyc6M=
=qqjS
-----END PGP SIGNATURE-----

--------------enigF6F764CD8293D0C9CEEFFC85--