From 4ee34c7039b9612f03f786d18e2f1c4cd9980659 Mon Sep 17 00:00:00 2001 From: thorpej Date: Fri, 31 May 2002 01:31:26 +0000 Subject: [PATCH] * config.gcc (sh[123456789l]*-*-*): Set cpu_type to sh. (sh-*-netbsdelf*) (shl*-*-netbsdelf*): New targets. * config/sh/netbsd-elf.h: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54079 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 ++++ gcc/config.gcc | 18 +++++++++- gcc/config/sh/netbsd-elf.h | 88 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 gcc/config/sh/netbsd-elf.h diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b53bcf6..0a59a30 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2002-05-30 Jason Thorpe + + * 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 Eric Botcazou diff --git a/gcc/config.gcc b/gcc/config.gcc index ad4abb6..73e423a 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -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 index 0000000..951f2a6 --- /dev/null +++ b/gcc/config/sh/netbsd-elf.h @@ -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 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) -- 2.7.4