[PATCH] GNU/k*BSD support (with ChangeLog) for gcc

Robert Millan zeratul2@wanadoo.es
Mon Mar 15 02:25:00 GMT 2004


Hi!

The attached patch rewrites GNU/kFreeBSD support so that it shares common
definitions with GNU/Linux and only adds minimal changes, resulting in
much better integration (both externaly and wrt gcc internals). It does
also add GNU/kNetBSD.

Patch (and test log) attached. ChangeLog entries follow.

ChangeLog:

2004-03-15  Robert Millan  <robertmh@gnu.org>

	* libtool.m4: Add kfreebsd*-gnu and knetbsd*-gnu.
	* ltconfig: Likewise.
	* ltcf-c.sh: Likewise.
	* ltcf-cxx.sh: Likewise.
	* ltcf-gcj.sh: Likewise.

gcc/ChangeLog:

2004-03-15  Robert Millan  <robertmh@gnu.org>

	* config.gcc: Merge kfreebsd*-gnu with linux* and add knetbsd*-gnu.
	* config/i386/linux.h: Unify sys/ucontext.h declarations across
	platforms (Needed for GNU/k*BSD).
	* config/kfreebsd-gnu.h: New. GNU/kFreeBSD followup for linux.h.
	* config/knetbsd-gnu.h: New. Ditto for GNU/kNetBSD.
	* config/freebsd-spec.h: Define __FreeBSD_kernel__.
	* config/netbsd.h: Define __NetBSD_kernel__.

	* config/kfreebsdgnu.h: Remove.
	* config/t-kfreebsd-gnu: Likewise.
	* config/i386/kfreebsdgnu.h: Likewise.

-- 
Robert Millan

"[..] but the delight and pride of Aule is in the deed of making, and in the
thing made, and neither in possession nor in his own mastery; wherefore he
gives and hoards not, and is free from care, passing ever on to some new work."

 -- J.R.R.T., Ainulindale (Silmarillion)
-------------- next part --------------

ChangeLog:

2004-03-15  Robert Millan  <robertmh@gnu.org>

	* libtool.m4: Add kfreebsd*-gnu and knetbsd*-gnu.
	* ltconfig: Likewise.
	* ltcf-c.sh: Likewise.
	* ltcf-cxx.sh: Likewise.
	* ltcf-gcj.sh: Likewise.

gcc/ChangeLog:

2004-03-15  Robert Millan  <robertmh@gnu.org>

	* config.gcc: Merge kfreebsd*-gnu with linux* and add knetbsd*-gnu.
	* config/i386/linux.h: Unify sys/ucontext.h declarations across
          platforms (Needed for GNU/k*BSD).
	* config/kfreebsd-gnu.h: New. GNU/kFreeBSD followup for linux.h.
	* config/knetbsd-gnu.h: New. Ditto for GNU/kNetBSD.
	* config/freebsd-spec.h: Define __FreeBSD_kernel__.
	* config/netbsd.h: Define __NetBSD_kernel__.

	* config/kfreebsdgnu.h: Remove.
	* config/t-kfreebsd-gnu: Likewise.
	* config/i386/kfreebsdgnu.h: Likewise.

diff -Nur gcc.old/gcc/config/freebsd-spec.h gcc/gcc/config/freebsd-spec.h
--- gcc.old/gcc/config/freebsd-spec.h	2004-02-04 21:00:52.000000000 +0100
+++ gcc/gcc/config/freebsd-spec.h	2004-03-13 23:03:41.000000000 +0100
@@ -61,6 +61,7 @@
 	  builtin_define ("__FreeBSD__=3");			       	\
 	else								\
 	  builtin_define ("__FreeBSD__");			       	\
+	builtin_define ("__FreeBSD_kernel__");			       	\
 	builtin_define_std ("unix");					\
 	builtin_define ("__KPRINTF_ATTRIBUTE__");		       	\
 	builtin_assert ("system=unix");					\
diff -Nur gcc.old/gcc/config/i386/kfreebsdgnu.h gcc/gcc/config/i386/kfreebsdgnu.h
--- gcc.old/gcc/config/i386/kfreebsdgnu.h	2003-10-21 11:52:47.000000000 +0200
+++ gcc/gcc/config/i386/kfreebsdgnu.h	1970-01-01 01:00:00.000000000 +0100
@@ -1,35 +0,0 @@
-/* Definitions for Intel 386 running GNU/KFreeBSD systems with ELF format.
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Bruno Haible.
-
-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.  */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (i386 KFreeBSD/ELF)");
-
-/* FIXME: Is a KFreeBSD-specific fallback mechanism necessary?  */
-#undef MD_FALLBACK_FRAME_STATE_FOR
-
-#undef LINK_SPEC
-#define LINK_SPEC "-m elf_i386_fbsd %{shared:-shared} \
-  %{!shared: \
-    %{!ibcs: \
-      %{!static: \
-	%{rdynamic:-export-dynamic} \
-	%{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
-	%{static:-static}}}"
diff -Nur gcc.old/gcc/config/i386/linux.h gcc/gcc/config/i386/linux.h
--- gcc.old/gcc/config/i386/linux.h	2003-11-29 04:08:10.000000000 +0100
+++ gcc/gcc/config/i386/linux.h	2004-03-13 23:03:41.000000000 +0100
@@ -108,24 +108,25 @@
 
 /* If ELF is the default format, we should not use /lib/elf.  */
 
+#ifndef LINK_EMULATION
+# define LINK_EMULATION "elf_i386"
+#endif
+#ifndef LINK_LDPATH
+# ifdef USE_GNULIBC_1
+#  define LINK_LDPATH "/lib/ld-linux.so.1"
+# else
+#  define LINK_LDPATH "/lib/ld-linux.so.2"
+# endif
+#endif
+
 #undef	LINK_SPEC
-#ifdef USE_GNULIBC_1
-#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
-  %{!shared: \
-    %{!ibcs: \
-      %{!static: \
-	%{rdynamic:-export-dynamic} \
-	%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \
-	%{static:-static}}}"
-#else
-#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
+#define LINK_SPEC "-m " LINK_EMULATION " %{shared:-shared} \
   %{!shared: \
     %{!ibcs: \
       %{!static: \
 	%{rdynamic:-export-dynamic} \
-	%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
+	%{!dynamic-linker:-dynamic-linker " LINK_LDPATH "}} \
 	%{static:-static}}}"
-#endif
 
 /* A C statement (sans semicolon) to output to the stdio stream
    FILE the assembler definition of uninitialized global DECL named
@@ -217,6 +218,18 @@
 #include <signal.h>
 #include <sys/ucontext.h>
 
+/* Unify sc_* declarations on all platforms */
+#ifndef sc_eax
+#define sc_eax eax
+#define sc_ebx ebx
+#define sc_ecx ecx
+#define sc_edx edx
+#define sc_esi esi
+#define sc_edi edi
+#define sc_ebp ebp
+#define sc_eip eip
+#endif
+
 #define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS)		\
   do {									\
     unsigned char *pc_ = (CONTEXT)->ra;					\
@@ -245,28 +258,28 @@
     else								\
       break;								\
 									\
-    new_cfa_ = sc_->esp;						\
+    new_cfa_ = sc_->sc_esp;						\
     (FS)->cfa_how = CFA_REG_OFFSET;					\
     (FS)->cfa_reg = 4;							\
     (FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa;		\
 									\
     /* The SVR4 register numbering macros aren't usable in libgcc.  */	\
     (FS)->regs.reg[0].how = REG_SAVED_OFFSET;				\
-    (FS)->regs.reg[0].loc.offset = (long)&sc_->eax - new_cfa_;		\
+    (FS)->regs.reg[0].loc.offset = (long)&sc_->sc_eax - new_cfa_;	\
     (FS)->regs.reg[3].how = REG_SAVED_OFFSET;				\
-    (FS)->regs.reg[3].loc.offset = (long)&sc_->ebx - new_cfa_;		\
+    (FS)->regs.reg[3].loc.offset = (long)&sc_->sc_ebx - new_cfa_;	\
     (FS)->regs.reg[1].how = REG_SAVED_OFFSET;				\
-    (FS)->regs.reg[1].loc.offset = (long)&sc_->ecx - new_cfa_;		\
+    (FS)->regs.reg[1].loc.offset = (long)&sc_->sc_ecx - new_cfa_;	\
     (FS)->regs.reg[2].how = REG_SAVED_OFFSET;				\
-    (FS)->regs.reg[2].loc.offset = (long)&sc_->edx - new_cfa_;		\
+    (FS)->regs.reg[2].loc.offset = (long)&sc_->sc_edx - new_cfa_;	\
     (FS)->regs.reg[6].how = REG_SAVED_OFFSET;				\
-    (FS)->regs.reg[6].loc.offset = (long)&sc_->esi - new_cfa_;		\
+    (FS)->regs.reg[6].loc.offset = (long)&sc_->sc_esi - new_cfa_;	\
     (FS)->regs.reg[7].how = REG_SAVED_OFFSET;				\
-    (FS)->regs.reg[7].loc.offset = (long)&sc_->edi - new_cfa_;		\
+    (FS)->regs.reg[7].loc.offset = (long)&sc_->sc_edi - new_cfa_;	\
     (FS)->regs.reg[5].how = REG_SAVED_OFFSET;				\
-    (FS)->regs.reg[5].loc.offset = (long)&sc_->ebp - new_cfa_;		\
+    (FS)->regs.reg[5].loc.offset = (long)&sc_->sc_ebp - new_cfa_;	\
     (FS)->regs.reg[8].how = REG_SAVED_OFFSET;				\
-    (FS)->regs.reg[8].loc.offset = (long)&sc_->eip - new_cfa_;		\
+    (FS)->regs.reg[8].loc.offset = (long)&sc_->sc_eip - new_cfa_;	\
     (FS)->retaddr_column = 8;						\
     goto SUCCESS;							\
   } while (0)
diff -Nur gcc.old/gcc/config/kfreebsd-gnu.h gcc/gcc/config/kfreebsd-gnu.h
--- gcc.old/gcc/config/kfreebsd-gnu.h	1970-01-01 01:00:00.000000000 +0100
+++ gcc/gcc/config/kfreebsd-gnu.h	2004-03-13 23:03:41.000000000 +0100
@@ -0,0 +1,46 @@
+/* Definitions for kFreeBSD-based GNU systems with ELF format
+   Copyright (C) 2004
+   Free Software Foundation, Inc.
+   Contributed by Robert Millan.
+
+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.  */
+
+#undef LINUX_TARGET_OS_CPP_BUILTINS    
+#define LINUX_TARGET_OS_CPP_BUILTINS()		\
+  do						\
+    {						\
+	builtin_define ("__FreeBSD_kernel__");	\
+	builtin_define ("__GLIBC__");		\
+	builtin_define_std ("unix");		\
+	builtin_assert ("system=unix");		\
+	builtin_assert ("system=posix");	\
+    }						\
+  while (0)
+
+#define LINK_EMULATION "elf_i386_fbsd"
+#define LINK_LDPATH "/lib/ld.so.1"
+
+/* These must be macros so that i386/linux.h can check for them */
+#define sc_eax sc_eax
+#define sc_ebx sc_ebx
+#define sc_ecx sc_ecx
+#define sc_edx sc_edx
+#define sc_esi sc_esi
+#define sc_edi sc_edi
+#define sc_ebp sc_ebp
+#define sc_eip sc_eip
diff -Nur gcc.old/gcc/config/kfreebsdgnu.h gcc/gcc/config/kfreebsdgnu.h
--- gcc.old/gcc/config/kfreebsdgnu.h	2003-12-18 03:32:11.000000000 +0100
+++ gcc/gcc/config/kfreebsdgnu.h	1970-01-01 01:00:00.000000000 +0100
@@ -1,41 +0,0 @@
-/* Definitions for GNU/KFreeBSD systems with ELF format.
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Bruno Haible.
-
-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.  */
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-
-#undef TARGET_OS_CPP_BUILTINS
-#define TARGET_OS_CPP_BUILTINS()				\
-  builtin_define ("__GNU_KFreeBSD__=0");		\
-  builtin_define ("__gnu_kfreebsd__=0");		\
-  builtin_define ("__FreeBSD_kernel__=5");		\
-  builtin_define ("__ELF__");				\
-  builtin_define_std ("unix");				\
-  builtin_assert ("system=posix");
-
-#undef TARGET_CPU_CPP_BUILTINS
-#define TARGET_CPU_CPP_BUILTINS()			\
-  builtin_define ("__i386__");				\
-  builtin_define_std ("i386");				\
-  builtin_assert ("cpu=i386");				\
-  builtin_assert ("machine=i386");
-
-/* do {} while (0) */
diff -Nur gcc.old/gcc/config/knetbsd-gnu.h gcc/gcc/config/knetbsd-gnu.h
--- gcc.old/gcc/config/knetbsd-gnu.h	1970-01-01 01:00:00.000000000 +0100
+++ gcc/gcc/config/knetbsd-gnu.h	2004-03-13 23:03:41.000000000 +0100
@@ -0,0 +1,45 @@
+/* Definitions for kNetBSD-based GNU systems with ELF format
+   Copyright (C) 2004
+   Free Software Foundation, Inc.
+   Contributed by Robert Millan.
+
+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.  */
+
+#undef LINUX_TARGET_OS_CPP_BUILTINS    
+#define LINUX_TARGET_OS_CPP_BUILTINS()		\
+  do						\
+    {						\
+	builtin_define ("__NetBSD_kernel__");	\
+	builtin_define ("__GLIBC__");		\
+	builtin_define_std ("unix");		\
+	builtin_assert ("system=unix");		\
+	builtin_assert ("system=posix");	\
+    }						\
+  while (0)
+
+#define LINK_LDPATH "/lib/ld.so.1"
+
+/* These must be macros so that i386/linux.h can check for them */
+#define sc_eax sc_eax
+#define sc_ebx sc_ebx
+#define sc_ecx sc_ecx
+#define sc_edx sc_edx
+#define sc_esi sc_esi
+#define sc_edi sc_edi
+#define sc_ebp sc_ebp
+#define sc_eip sc_eip
diff -Nur gcc.old/gcc/config/linux.h gcc/gcc/config/linux.h
--- gcc.old/gcc/config/linux.h	2003-11-29 04:08:10.000000000 +0100
+++ gcc/gcc/config/linux.h	2004-03-13 23:03:41.000000000 +0100
@@ -97,6 +97,7 @@
        %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}"
 #endif
 
+#ifndef LINUX_TARGET_OS_CPP_BUILTINS
 #define LINUX_TARGET_OS_CPP_BUILTINS()				\
     do {							\
 	builtin_define ("__gnu_linux__");			\
@@ -106,6 +107,7 @@
 	builtin_assert ("system=unix");				\
 	builtin_assert ("system=posix");			\
     } while (0)
+#endif
 
 #if !defined(USE_GNULIBC_1) && defined(HAVE_LD_EH_FRAME_HDR)
 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
diff -Nur gcc.old/gcc/config/netbsd.h gcc/gcc/config/netbsd.h
--- gcc.old/gcc/config/netbsd.h	2003-09-27 06:48:11.000000000 +0200
+++ gcc/gcc/config/netbsd.h	2004-03-13 23:03:41.000000000 +0100
@@ -24,6 +24,7 @@
   do						\
     {						\
       builtin_define ("__NetBSD__");		\
+      builtin_define ("__NetBSD_kernel__");	\
       builtin_assert ("system=unix");		\
       builtin_assert ("system=NetBSD");		\
     }						\
diff -Nur gcc.old/gcc/config/t-kfreebsd-gnu gcc/gcc/config/t-kfreebsd-gnu
--- gcc.old/gcc/config/t-kfreebsd-gnu	2003-10-21 11:52:47.000000000 +0200
+++ gcc/gcc/config/t-kfreebsd-gnu	1970-01-01 01:00:00.000000000 +0100
@@ -1,16 +0,0 @@
-# glibc provides a limits.h, which must be combined with gcc's limits.h.
-LIMITS_H_TEST = true
-
-# Compile crtbeginS.o and crtendS.o with pic.
-CRTSTUFF_T_CFLAGS_S = -fPIC
-# Compile libgcc2.a with pic.
-TARGET_LIBGCC2_CFLAGS = -fPIC
-
-# Override t-slibgcc-elf-ver to export some libgcc symbols with
-# the symbol versions that glibc used.
-SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver
-
-# Use unwind-dw2-fde-glibc
-LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c \
-  $(srcdir)/unwind-sjlj.c
-LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h unwind-dw2-fde.c
diff -Nur gcc.old/gcc/config.gcc gcc/gcc/config.gcc
--- gcc.old/gcc/config.gcc	2004-03-01 16:12:56.000000000 +0100
+++ gcc/gcc/config.gcc	2004-03-13 23:04:29.000000000 +0100
@@ -409,21 +409,10 @@
   esac
   fbsd_tm_file="${fbsd_tm_file} freebsd-spec.h freebsd.h"
   ;;
-*-*-kfreebsd*-gnu)
-  # Must come before *-*-gnu*
-  xm_defines=POSIX # needed for cross-compiling from FreeBSD?
-  extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
-  # GNU tools are the only tools.
-  gas=yes
-  gnu_ld=yes
-  case ${enable_threads} in
-    "" | yes | posix) thread_file='posix' ;;
-  esac
-  ;;
 *-*-linux*libc1* | *-*-linux*aout*)
   # Avoid the generic linux case.
   ;;
-*-*-linux* | frv-*-*linux*)
+*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
   # Must come before *-*-gnu* (because of *-*-linux-gnu* systems).
   extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
   gas=yes
@@ -919,10 +908,15 @@
 	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/i386-coff.h"
 	use_fixproto=yes
 	;;
-i[34567]86-*-linux*)	# Intel 80386's running GNU/Linux
+i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu)
+			# Intel 80386's running GNU/*
 			# with ELF format using glibc 2
-			# aka GNU/Linux C library 6
-	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h i386/linux.h"
+	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h"
+	case ${target} in
+	i[34567]86-*-knetbsd*-gnu) tm_file="${tm_file} knetbsd-gnu.h" ;;
+	i[34567]86-*-kfreebsd*-gnu) tm_file="${tm_file} kfreebsd-gnu.h" ;;
+	esac
+	tm_file="${tm_file} linux.h i386/linux.h"
 	tmake_file="${tmake_file} i386/t-crtstuff"
 	;;
 x86_64-*-linux*)
@@ -930,12 +924,6 @@
 		 i386/x86-64.h i386/linux64.h"
 	tmake_file="${tmake_file} i386/t-linux64"
 	;;
-i[34567]86-*-kfreebsd*-gnu) # must be before i[34567]86-*-gnu*
-	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h i386/linux.h kfreebsdgnu.h i386/kfreebsdgnu.h"
-	tmake_file="t-slibgcc-elf-ver t-kfreebsd-gnu i386/t-crtstuff"
-	float_format=i386
-	use_fixproto=no
-	;;
 i[34567]86-*-gnu*)
 	;;
 i[34567]86-pc-msdosdjgpp*)
diff -Nur gcc.old/libtool.m4 gcc/libtool.m4
--- gcc.old/libtool.m4	2003-11-19 06:29:32.000000000 +0100
+++ gcc/libtool.m4	2004-03-13 23:03:41.000000000 +0100
@@ -621,7 +621,7 @@
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-freebsd* )
+freebsd* | kfreebsd*-gnu)
   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
     case $host_cpu in
     i*86 )
@@ -689,7 +689,7 @@
   lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
   ;;
 
-netbsd*)
+netbsd* | knetbsd*-gnu)
   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
     [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
   else
diff -Nur gcc.old/ltcf-c.sh gcc/ltcf-c.sh
--- gcc.old/ltcf-c.sh	2003-11-19 06:29:32.000000000 +0100
+++ gcc/ltcf-c.sh	2004-03-13 23:03:41.000000000 +0100
@@ -175,7 +175,7 @@
       $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
     ;;
 
-  netbsd*)
+  netbsd* | knetbsd*-gnu)
     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
       archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
       wlarc=
@@ -442,7 +442,7 @@
     ;;
 
   # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-  freebsd*)
+  freebsd* | kfreebsd*-gnu)
     archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
     hardcode_libdir_flag_spec='-R$libdir'
     hardcode_direct=yes
@@ -489,7 +489,7 @@
     link_all_deplibs=yes
     ;;
 
-  netbsd*)
+  netbsd* | knetbsd*-gnu)
     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
     else
diff -Nur gcc.old/ltcf-cxx.sh gcc/ltcf-cxx.sh
--- gcc.old/ltcf-cxx.sh	2003-11-19 06:29:32.000000000 +0100
+++ gcc/ltcf-cxx.sh	2004-03-13 23:03:41.000000000 +0100
@@ -289,7 +289,7 @@
     # C++ shared libraries reported to be fairly broken before switch to ELF
     ld_shlibs=no
     ;;
-  freebsd*)
+  freebsd* | kfreebsd*-gnu)
     # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
     # conventions
     ld_shlibs=yes
@@ -449,7 +449,7 @@
         ;;
     esac
     ;;
-  netbsd*)
+  netbsd* | knetbsd*-gnu)
     # NetBSD uses g++ - do we need to do anything?
     ;;
   osf3*)
@@ -804,7 +804,7 @@
           ;;
       esac
       ;;
-    freebsd*)
+    freebsd* | kfreebsd*-gnu)
       # FreeBSD uses GNU C++
       ;;
     gnu*)
diff -Nur gcc.old/ltcf-gcj.sh gcc/ltcf-gcj.sh
--- gcc.old/ltcf-gcj.sh	2003-11-19 06:29:32.000000000 +0100
+++ gcc/ltcf-gcj.sh	2004-03-13 23:03:41.000000000 +0100
@@ -178,7 +178,7 @@
       $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
     ;;
 
-  netbsd*)
+  netbsd* | knetbsd*-gnu)
     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
       archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
       wlarc=
@@ -445,7 +445,7 @@
     ;;
 
   # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-  freebsd*)
+  freebsd* | kfreebsd*-gnu)
     archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
     hardcode_libdir_flag_spec='-R$libdir'
     hardcode_direct=yes
@@ -476,7 +476,7 @@
     link_all_deplibs=yes
     ;;
 
-  netbsd*)
+  netbsd* | knetbsd*-gnu)
     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
     else
diff -Nur gcc.old/ltconfig gcc/ltconfig
--- gcc.old/ltconfig	2003-11-19 06:29:32.000000000 +0100
+++ gcc/ltconfig	2004-03-13 23:03:41.000000000 +0100
@@ -1168,6 +1168,17 @@
   hardcode_into_libs=yes
   ;;
 
+kfreebsd*-gnu | knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
 hpux9* | hpux10* | hpux11*)
   # Give a soname corresponding to the major version so that dld.sl refuses to
   # link against other versions.
-------------- next part --------------
make[1]: Entering directory `/home/rmh/porting/tmp/pending/gcc-3.4/build/gcc'
Making a new config file...
echo "set tmpdir /home/rmh/porting/tmp/pending/gcc-3.4/build/gcc/testsuite" >> ./tmp0
test -d testsuite || mkdir testsuite
rm -f testsuite/site.exp
sed '/set tmpdir/ s|testsuite|testsuite|' < site.exp > testsuite/site.exp
(rootme=`${PWDCMD-pwd}`; export rootme; \
srcdir=`cd ../../gcc/gcc; ${PWDCMD-pwd}` ; export srcdir ; \
cd testsuite; \
EXPECT=expect ; export EXPECT ; \
if [ -f ${rootme}/../expect/expect ] ; then  \
   TCL_LIBRARY=`cd .. ; cd ../../gcc/gcc/../tcl/library ; ${PWDCMD-pwd}` ; \
    export TCL_LIBRARY ; fi ; \
runtest --tool gcc )
Test Run By rmh on Sun Mar 14 18:10:51 2004
Native configuration is i386-unknown-kfreebsd5.1-gnu

		=== gcc tests ===

Schedule of variations:
    unix

Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.c-torture/compile/compile.exp ...
FAIL: gcc.c-torture/compile/930621-1.c  -O3 -fomit-frame-pointer  (test for excess errors)
FAIL: gcc.c-torture/compile/930621-1.c  -O3 -fomit-frame-pointer -funroll-loops  (test for excess errors)
FAIL: gcc.c-torture/compile/930621-1.c  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  (test for excess errors)
FAIL: gcc.c-torture/compile/930621-1.c  -O3 -g  (test for excess errors)
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.c-torture/execute/execute.exp ...
FAIL: gcc.c-torture/execute/va-arg-25.c execution,  -Os 
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.dg/charset/charset.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.dg/compat/compat.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.dg/cpp/cpp.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.dg/cpp/trad/trad.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.dg/debug/debug.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.dg/dg.exp ...
FAIL: gcc.dg/20020523-1.c (test for excess errors)
WARNING: gcc.dg/20020523-1.c compilation failed to produce executable
FAIL: gcc.dg/20020523-2.c (test for excess errors)
WARNING: gcc.dg/20020523-2.c compilation failed to produce executable
FAIL: gcc.dg/const-elim-1.c scan-assembler-not L\\$?C[^A-Z]
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.dg/format/format.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.dg/noncompile/noncompile.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.dg/pch/pch.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.dg/special/mips-abi.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.dg/special/special.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.dg/tls/tls.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.dg/torture/dg-torture.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.dg/weak/weak.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.misc-tests/acker1.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.misc-tests/arm-isr.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.misc-tests/bprob.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.misc-tests/dg-test.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.misc-tests/dhry.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.misc-tests/gcov.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.misc-tests/i386-prefetch.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.misc-tests/linkage.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.misc-tests/matrix1.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.misc-tests/mg.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.misc-tests/sieve.exp ...
Running /home/rmh/porting/tmp/pending/gcc-3.4/gcc/gcc/testsuite/gcc.misc-tests/sort2.exp ...

		=== gcc Summary ===

# of expected passes		24721
# of unexpected failures	8
# of expected failures		63
# of untested testcases		7
# of unsupported tests		199
/home/rmh/porting/tmp/pending/gcc-3.4/build/gcc/xgcc version 3.5.0 20040301 (experimental)

make[1]: [check-gcc] Error 1 (ignored)
make[1]: Leaving directory `/home/rmh/porting/tmp/pending/gcc-3.4/build/gcc'
make[1]: Entering directory `/home/rmh/porting/tmp/pending/gcc-3.4/build/intl'
make[1]: Nothing to be done for `check'.
make[1]: Leaving directory `/home/rmh/porting/tmp/pending/gcc-3.4/build/intl'
make[1]: Entering directory `/home/rmh/porting/tmp/pending/gcc-3.4/build/libiberty'
make[2]: Entering directory `/home/rmh/porting/tmp/pending/gcc-3.4/build/libiberty/testsuite'
gcc -DHAVE_CONFIG_H -g -O2 -I.. -I../../../gcc/libiberty/testsuite/../../include  -o test-demangle \
	../../../gcc/libiberty/testsuite/test-demangle.c ../libiberty.a
./test-demangle < ../../../gcc/libiberty/testsuite/demangle-expected
./test-demangle: 745 tests, 0 failures
make[2]: Leaving directory `/home/rmh/porting/tmp/pending/gcc-3.4/build/libiberty/testsuite'
make[1]: Leaving directory `/home/rmh/porting/tmp/pending/gcc-3.4/build/libiberty'


More information about the Gcc-patches mailing list