Patch from Robert Millan.
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Jun 2004 02:56:23 +0000 (02:56 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Jun 2004 02:56:23 +0000 (02:56 +0000)
* config.gcc: Merge kfreebsd*-gnu with linux* and add knetbsd*-gnu.
* config/i386/linux.h: Allow overriding of LINK_EMULATION,
  DYNAMIC_LINKER and register names in sc_ structure.
* config/kfreebsd-gnu.h: New. kfreebsd-gnu followup for linux.h.
* config/i386/kfreebsd-gnu.h: New. Ditto for i386-kfreebsd-gnu.
* config/knetbsd-gnu.h: New. Ditto for knetbsd-gnu.
* config/i386/knetbsd-gnu.h: New. Ditto for i386-knetbsd-gnu.
* config/kfreebsdgnu.h: Remove.
* config/t-kfreebsd-gnu: Likewise.
* config/i386/kfreebsdgnu.h: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83577 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config.gcc
gcc/config/i386/kfreebsd-gnu.h [new file with mode: 0644]
gcc/config/i386/knetbsd-gnu.h [new file with mode: 0644]
gcc/config/i386/linux.h
gcc/config/kfreebsd-gnu.h [moved from gcc/config/i386/kfreebsdgnu.h with 54% similarity]
gcc/config/kfreebsdgnu.h [deleted file]
gcc/config/knetbsd-gnu.h [new file with mode: 0644]
gcc/config/t-kfreebsd-gnu [deleted file]

index 37889f0..9739978 100644 (file)
@@ -1,3 +1,17 @@
+2004-06-23  Robert Millan  <robertmh@gnu.org>
+
+       * config.gcc: Merge kfreebsd*-gnu with linux* and add knetbsd*-gnu.
+       * config/i386/linux.h: Allow overriding of LINK_EMULATION,
+         DYNAMIC_LINKER and register names in sc_ structure.
+       * config/kfreebsd-gnu.h: New. kfreebsd-gnu followup for linux.h.
+       * config/i386/kfreebsd-gnu.h: New. Ditto for i386-kfreebsd-gnu.
+       * config/knetbsd-gnu.h: New. Ditto for knetbsd-gnu.
+       * config/i386/knetbsd-gnu.h: New. Ditto for i386-knetbsd-gnu.
+
+       * config/kfreebsdgnu.h: Remove.
+       * config/t-kfreebsd-gnu: Likewise.
+       * config/i386/kfreebsdgnu.h: Likewise.
+
 2004-06-23  Eric Christopher  <echristo@redhat.com>
 
        * fold-const.c (make_range): Cleanup type checking through function.
index fd226dc..aa03996 100644 (file)
@@ -412,21 +412,10 @@ case ${target} in
   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
@@ -926,10 +915,14 @@ i[34567]86-*-coff*)
        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"
+       case ${target} in
+       i[34567]86-*-knetbsd*-gnu) tm_file="${tm_file} knetbsd-gnu.h i386/knetbsd-gnu.h" ;;
+       i[34567]86-*-kfreebsd*-gnu) tm_file="${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu.h" ;;
+       esac
        tmake_file="${tmake_file} i386/t-crtstuff"
        ;;
 x86_64-*-linux*)
@@ -937,12 +930,6 @@ x86_64-*-linux*)
                 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 --git a/gcc/config/i386/kfreebsd-gnu.h b/gcc/config/i386/kfreebsd-gnu.h
new file mode 100644 (file)
index 0000000..884777d
--- /dev/null
@@ -0,0 +1,26 @@
+/* Definitions for Intel 386 running 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 LINK_EMULATION
+#define LINK_EMULATION "elf_i386_fbsd"
+#undef REG_NAME
+#define REG_NAME(reg) sc_ ## reg
diff --git a/gcc/config/i386/knetbsd-gnu.h b/gcc/config/i386/knetbsd-gnu.h
new file mode 100644 (file)
index 0000000..a1cda7b
--- /dev/null
@@ -0,0 +1,24 @@
+/* Definitions for Intel 386 running 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 REG_NAME
+#define REG_NAME(reg) sc_ ## reg
index e7d19ec..85e6cf2 100644 (file)
@@ -108,24 +108,26 @@ Boston, MA 02111-1307, USA.  */
 
 /* If ELF is the default format, we should not use /lib/elf.  */
 
-#undef LINK_SPEC
+#define LINK_EMULATION "elf_i386"
 #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}}}"
+# define DYNAMIC_LINKER "/lib/ld-linux.so.1"
 #else
-#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
+# define DYNAMIC_LINKER "/lib/ld-linux.so.2"
+#endif
+
+#undef  SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS \
+  { "link_emulation", LINK_EMULATION },\
+  { "dynamic_linker", DYNAMIC_LINKER }
+
+#undef LINK_SPEC
+#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 %(dynamic_linker)}} \
        %{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 +219,8 @@ Boston, MA 02111-1307, USA.  */
 #include <signal.h>
 #include <sys/ucontext.h>
 
+#define REG_NAME(reg) reg
+
 #define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS)              \
   do {                                                                 \
     unsigned char *pc_ = (CONTEXT)->ra;                                        \
@@ -245,28 +249,28 @@ Boston, MA 02111-1307, USA.  */
     else                                                               \
       break;                                                           \
                                                                        \
-    new_cfa_ = sc_->esp;                                               \
+    new_cfa_ = sc_->REG_NAME(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_->REG_NAME(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_->REG_NAME(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_->REG_NAME(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_->REG_NAME(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_->REG_NAME(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_->REG_NAME(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_->REG_NAME(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_->REG_NAME(eip) - new_cfa_;       \
     (FS)->retaddr_column = 8;                                          \
     goto SUCCESS;                                                      \
   } while (0)
similarity index 54%
rename from gcc/config/i386/kfreebsdgnu.h
rename to gcc/config/kfreebsd-gnu.h
index 66b231d..953c69c 100644 (file)
@@ -1,6 +1,7 @@
-/* Definitions for Intel 386 running GNU/KFreeBSD systems with ELF format.
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Bruno Haible.
+/* 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.
 
@@ -19,17 +20,17 @@ 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)");
+#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)
 
-/* 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}}}"
+#undef DYNAMIC_LINKER
+#define DYNAMIC_LINKER "/lib/ld.so.1"
diff --git a/gcc/config/kfreebsdgnu.h b/gcc/config/kfreebsdgnu.h
deleted file mode 100644 (file)
index ad8d68c..0000000
+++ /dev/null
@@ -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 --git a/gcc/config/knetbsd-gnu.h b/gcc/config/knetbsd-gnu.h
new file mode 100644 (file)
index 0000000..744cfc2
--- /dev/null
@@ -0,0 +1,36 @@
+/* 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)
+
+#undef DYNAMIC_LINKER
+#define DYNAMIC_LINKER "/lib/ld.so.1"
diff --git a/gcc/config/t-kfreebsd-gnu b/gcc/config/t-kfreebsd-gnu
deleted file mode 100644 (file)
index a40dc7a..0000000
+++ /dev/null
@@ -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