config.gcc (sh[123456789l]*-*-*): Set cpu_type to sh.
authorJason Thorpe <thorpej@wasabisystems.com>
Fri, 31 May 2002 01:31:26 +0000 (01:31 +0000)
committerJason Thorpe <thorpej@gcc.gnu.org>
Fri, 31 May 2002 01:31:26 +0000 (01:31 +0000)
* config.gcc (sh[123456789l]*-*-*): Set cpu_type to sh.
(sh-*-netbsdelf*)
(shl*-*-netbsdelf*): New targets.
* config/sh/netbsd-elf.h: New file.

From-SVN: r54079

gcc/ChangeLog
gcc/config.gcc
gcc/config/sh/netbsd-elf.h [new file with mode: 0644]

index b53bcf60fcc5ac5613efdfa455c51a0efff36c1e..0a59a301caa570be0dbb1691f9401bb284e1db38 100644 (file)
@@ -1,3 +1,10 @@
+2002-05-30  Jason Thorpe  <thorpej@wasabisystems.com>
+
+       * config.gcc (sh[123456789l]*-*-*): Set cpu_type to sh.
+       (sh-*-netbsdelf*)
+       (shl*-*-netbsdelf*): New targets.
+       * config/sh/netbsd-elf.h: New file.
+
 2002-05-30  Richard Henderson  <rth@redhat.com>
            Eric Botcazou  <ebotcazou@multimania.com>
 
index ad4abb67682988ab694eaa79674233c3f5fb6890..73e423a0552a3e118e2b93ef8d6e57c393e3f5c6 100644 (file)
@@ -276,7 +276,8 @@ powerpc*-*-*)
 sparc*-*-*)
        cpu_type=sparc
        ;;
-sh64-*-*)
+# Note the 'l'; we need to be able to match e.g. "shle" or "shl".
+sh[123456789l]*-*-*)
        cpu_type=sh
        ;;
 esac
@@ -2247,6 +2248,21 @@ sh-*-linux*)
        fi
        float_format=sh
        ;;
+sh-*-netbsdelf* | shl*-*-netbsdelf*)
+       tm_file="${tm_file} dbxelf.h elfos.h sh/elf.h netbsd.h netbsd-elf.h sh/netbsd-elf.h"
+       tmake_file="${tmake_file} sh/t-sh sh/t-elf"
+       case $machine in
+       sh*l*-*)
+               tm_file="sh/little.h ${tm_file}"
+               tmake_file="${tmake_file} sh/t-le"
+               ;;
+       *)
+               tmake_file="${tmake_file} sh/t-be"
+               ;;
+       esac
+       tmake_file="${tmake_file} sh/t-netbsd"
+       float_format=sh
+       ;;
 sh-*-*)
        tm_file="${tm_file} sh/coff.h"
        float_format=sh
diff --git a/gcc/config/sh/netbsd-elf.h b/gcc/config/sh/netbsd-elf.h
new file mode 100644 (file)
index 0000000..951f2a6
--- /dev/null
@@ -0,0 +1,88 @@
+/* Definitions for SH running NetBSD using ELF
+   Copyright (C) 2002 Free Software Foundation, Inc.
+   Contributed by Wasabi Systems, 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 this program; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+/* Run-time Target Specification.  */
+#undef TARGET_VERSION
+#if TARGET_ENDIAN_DEFAULT == LITTLE_ENDIAN_BIT
+#define TARGET_VERSION  fputs (" (NetBSD/shle ELF)", stderr);
+#else
+#define TARGET_VERSION fputs (" (NetBSD/sh ELF)", stderr);
+#endif
+
+#define TARGET_OS_CPP_BUILTINS()                                       \
+  do                                                                   \
+    {                                                                  \
+      NETBSD_OS_CPP_BUILTINS_ELF();                                    \
+      builtin_define ("__NO_LEADING_UNDERSCORES__");                   \
+    }                                                                  \
+  while (0)
+
+/* Provide a LINK_SPEC appropriate for a NetBSD/sh ELF target.
+   This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for
+   the SH target.  */
+
+#undef LINK_SPEC
+#define LINK_SPEC                                                      \
+  "%{assert*} %{R*}                                                    \
+   %{mb:-m shelf_nbsd}                                                 \
+   %{ml:-m shlelf_nbsd}                                                        \
+   %{mrelax:-relax}                                                    \
+   %{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}}"
+
+
+/* Provide a CPP_SPEC appropriate for NetBSD.  */
+#undef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
+
+/* Restore the ASM_SPEC from sh/sh.h; sh/elf.h clobbers it.  */
+#undef ASM_SPEC
+#define ASM_SPEC  "%(subtarget_asm_endian_spec) %{mrelax:-relax}"
+
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT \
+  (SH1_BIT|SH2_BIT|SH3_BIT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT)
+
+#undef FUNCTION_PROFILER
+#define FUNCTION_PROFILER(STREAM,LABELNO)                              \
+do                                                                     \
+  {                                                                    \
+    fprintf((STREAM), "\tmov.l\t%cLP%d,r1\n",                          \
+            LOCAL_LABEL_PREFIX, (LABELNO));                            \
+    fprintf((STREAM), "\tmova\t%cLP%dr,r0\n",                          \
+            LOCAL_LABEL_PREFIX, (LABELNO));                            \
+    fprintf((STREAM), "\tjmp\t@r1\n");                                 \
+    fprintf((STREAM), "\tnop\n");                                      \
+    fprintf((STREAM), "\t.align\t2\n");                                        \
+    fprintf((STREAM), "%cLP%d:\t.long\t__mcount\n",                    \
+            LOCAL_LABEL_PREFIX, (LABELNO));                            \
+    fprintf((STREAM), "%cLP%dr:\n", LOCAL_LABEL_PREFIX, (LABELNO));    \
+  }                                                                    \
+while (0)