config.gcc (sh-*-elf*): Use sh/embed-elf.h instead of sh/elf.h.
authorJ"orn Rennecke <joern.rennecke@superh.com>
Tue, 9 Apr 2002 20:07:15 +0000 (20:07 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Tue, 9 Apr 2002 20:07:15 +0000 (21:07 +0100)
* config.gcc (sh-*-elf*): Use sh/embed-elf.h instead of sh/elf.h.
(sh64-*-elf*, sh-*-rtemself*): Likewise.
* config/sh/embed_bb.c: New file.
* config/sh/embed-elf.h: New file.
* sh.h (CPP_SPEC): Supply __SIZE_TYPE__ and __PTRDIFF_TYPE__
if -m[12345]* option is given.  Don't use subtarget_cpp_ptr_spec.
(CPP_DEFAULT_CPU_SPEC): Add settings for __SIZE_TYPE__ and
__PTRDIFF_TYPE__ .
(SUBTARGET_CPP_PTR_SPEC): Don't define.
(EXTRA_SPECS): Remove subtarget_cpp_ptr_spec.
Add subtarget_asm_endian_spec.
(ASM_SPEC): Use subtarget_asm_endian_spec.
(SUBTARGET_ASM_ENDIAN_SPEC): Define.
(RETURN_ADDR_RTX): Use PR_MEDIA_REG for TARGET_SH5.
(WCHAR_UNSIGNED): Define.
(SH_ELF_WCHAR_TYPE, SH_DBX_REGISTER_NUMBER): Define.
(DBX_REGISTER_NUMBER): Use SH_DBX_REGISTER_NUMBER.
(ALLOCATE_INITIAL_VALUE): Use PR_MEDIA_REG for TARGET_SH5.
Fix value.
* sh.c (calc_live_regs): Use PR_MEDIA_REG for TARGET_SH5.
(sh_adjust_cost): Likewise.
sh64.h (CPP_DEFAULT_CPU_SPEC): Add settings for __SIZE_TYPE__ and
__PTRDIFF_TYPE__ .
(SUBTARGET_CPP_PTR_SPEC, WCHAR_TYPE): Don't #undef/ #define.
(WCHAR_TYPE_SIZE): Likewise.
(ASM_SPEC): Use subtarget_asm_endian_spec.
(SH_ELF_WCHAR_TYPE): #undef/ #define.
(MAX_WCHAR_TYPE_SIZE): Don't #undef.
* config/sh/elf.h (WCHAR_UNSIGNED): #undef .
(MAX_WCHAR_TYPE_SIZE): Don't #define .
(WCHAR_TYPE, WCHAR_TYPE_SIZE): #undef / #define .
(USER_LABEL_PREFIX): Don't #undef /#define .
(DBX_REGISTER_NUMBER): Use SH_DBX_REGISTER_NUMBER.
* config/elf/linux.h (USER_LABEL_PREFIX): Don't #undef /#define .
(SIZE_TYPE, PTRDIFF_TYPE, WCHAR_TYPE, WCHAR_TYPE_SIZE): Likewise.
(ASM_SPEC): Likewise.
(SUBTARGET_ASM_ENDIAN_SPEC): #undef / #define .
(CC1_SPEC): don't supply -m3 for -m4*, -m5*.
* t-sh: (LIB1ASMFUNCS): Use LIB1ASMFUNCS_CACHE.
(LIB2FUNCS_EXTRA): Define.
* t-sh64 (LIB2FUNCS_EXTRA): Define.
* config/sh/t-linux (LIB1ASMFUNCS): Don't redefine.
(LIB1ASMFUNCS_CACHE): Define.
(LIB2FUNCS_EXTRA): Redefine empty.

From-SVN: r52091

13 files changed:
gcc/ChangeLog
gcc/config.gcc
gcc/config/sh/elf.h
gcc/config/sh/embed-elf.h [new file with mode: 0644]
gcc/config/sh/embed_bb.c [new file with mode: 0644]
gcc/config/sh/linux.h
gcc/config/sh/sh-protos.h
gcc/config/sh/sh.c
gcc/config/sh/sh.h
gcc/config/sh/sh64.h
gcc/config/sh/t-linux
gcc/config/sh/t-sh
gcc/config/sh/t-sh64

index 671c84da659d494e796a158195bba21228add21b..eb7cdb86eaaf5872db69d15969b43f5d3407104c 100644 (file)
@@ -1,3 +1,50 @@
+Tue Apr  9 19:15:57 2002  J"orn Rennecke <joern.rennecke@superh.com>
+
+       * config.gcc (sh-*-elf*): Use sh/embed-elf.h instead of sh/elf.h.
+       (sh64-*-elf*, sh-*-rtemself*): Likewise.
+       * config/sh/embed_bb.c: New file.
+       * config/sh/embed-elf.h: New file.
+       * sh.h (CPP_SPEC): Supply __SIZE_TYPE__ and __PTRDIFF_TYPE__
+       if -m[12345]* option is given.  Don't use subtarget_cpp_ptr_spec.
+       (CPP_DEFAULT_CPU_SPEC): Add settings for __SIZE_TYPE__ and
+       __PTRDIFF_TYPE__ .
+       (SUBTARGET_CPP_PTR_SPEC): Don't define.
+       (EXTRA_SPECS): Remove subtarget_cpp_ptr_spec.
+       Add subtarget_asm_endian_spec.
+       (ASM_SPEC): Use subtarget_asm_endian_spec.
+       (SUBTARGET_ASM_ENDIAN_SPEC): Define.
+       (RETURN_ADDR_RTX): Use PR_MEDIA_REG for TARGET_SH5.
+       (WCHAR_UNSIGNED): Define.
+       (SH_ELF_WCHAR_TYPE, SH_DBX_REGISTER_NUMBER): Define.
+       (DBX_REGISTER_NUMBER): Use SH_DBX_REGISTER_NUMBER.
+       (ALLOCATE_INITIAL_VALUE): Use PR_MEDIA_REG for TARGET_SH5.
+       Fix value.
+       * sh.c (calc_live_regs): Use PR_MEDIA_REG for TARGET_SH5.
+       (sh_adjust_cost): Likewise.
+       sh64.h (CPP_DEFAULT_CPU_SPEC): Add settings for __SIZE_TYPE__ and
+       __PTRDIFF_TYPE__ .
+       (SUBTARGET_CPP_PTR_SPEC, WCHAR_TYPE): Don't #undef/ #define.
+       (WCHAR_TYPE_SIZE): Likewise.
+       (ASM_SPEC): Use subtarget_asm_endian_spec.
+       (SH_ELF_WCHAR_TYPE): #undef/ #define.
+       (MAX_WCHAR_TYPE_SIZE): Don't #undef.
+       * config/sh/elf.h (WCHAR_UNSIGNED): #undef .
+       (MAX_WCHAR_TYPE_SIZE): Don't #define .
+       (WCHAR_TYPE, WCHAR_TYPE_SIZE): #undef / #define .
+       (USER_LABEL_PREFIX): Don't #undef /#define .
+       (DBX_REGISTER_NUMBER): Use SH_DBX_REGISTER_NUMBER.
+       * config/elf/linux.h (USER_LABEL_PREFIX): Don't #undef /#define .
+       (SIZE_TYPE, PTRDIFF_TYPE, WCHAR_TYPE, WCHAR_TYPE_SIZE): Likewise.
+       (ASM_SPEC): Likewise.
+       (SUBTARGET_ASM_ENDIAN_SPEC): #undef / #define .
+       (CC1_SPEC): don't supply -m3 for -m4*, -m5*.
+       * t-sh: (LIB1ASMFUNCS): Use LIB1ASMFUNCS_CACHE.
+       (LIB2FUNCS_EXTRA): Define.
+       * t-sh64 (LIB2FUNCS_EXTRA): Define.
+       * config/sh/t-linux (LIB1ASMFUNCS): Don't redefine.
+       (LIB1ASMFUNCS_CACHE): Define.
+       (LIB2FUNCS_EXTRA): Redefine empty.
+
 2002-04-08  Richard Henderson  <rth@redhat.com>
 
        * reorg.c (get_branch_condition): Use reversed_comparison_code.
index 07afdce33a1f4e22fdcc5cae3a94a689ab9b2402..2934558c91d70853c9b117b67254db4768bf656f 100644 (file)
@@ -2925,12 +2925,12 @@ s390x-*-linux*)
        ;;
 sh-*-elf*)
        tmake_file="sh/t-sh sh/t-elf"
-       tm_file="${tm_file} sh/elf.h"
+       tm_file="${tm_file} sh/embed-elf.h"
        float_format=sh
        ;;
 sh64-*-elf*)
        tmake_file="sh/t-sh sh/t-elf sh/t-sh64"
-       tm_file="${tm_file} sh/sh.h sh/elf.h sh/sh64.h"
+       tm_file="${tm_file} sh/sh.h sh/embed-elf.h sh/sh64.h"
        float_format=sh
        extra_headers="../../config/sh/shmedia.h ../../config/sh/ushmedia.h ../../config/sh/sshmedia.h"
        # Not strictly necessary to check this, but a good idea anyway.
@@ -2941,7 +2941,7 @@ sh64-*-elf*)
 sh-*-rtemself*)
        xm_defines=POSIX
        tmake_file="sh/t-sh sh/t-elf t-rtems"
-       tm_file="${tm_file} sh/elf.h sh/rtemself.h rtems.h"
+       tm_file="${tm_file} sh/embed-elf.h sh/rtemself.h rtems.h"
        float_format=sh
        if test x$enable_threads = xyes; then
          thread_file='rtems'
index d5aa9471057cdc35308a76f1fea321876f02ddcd..247f735d494fb68a43193ba77aa2367ea033fe1e 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions of target machine for gcc for Hitachi / SuperH SH using ELF.
-   Copyright (C) 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc.
    Contributed by Ian Lance Taylor <ian@cygnus.com>.
 
 This file is part of GNU CC.
@@ -30,6 +30,9 @@ Boston, MA 02111-1307, USA.  */
 #undef SIZE_TYPE
 #undef PTRDIFF_TYPE
 
+/* And one that is defined in sh.h and should be undefined in svr4.h...  */
+#undef WCHAR_UNSIGNED
+
 /* Be ELF-like.  */
 /* TODO: convert includes to ${tm_file} list in config.gcc.  */
 #include "dbxelf.h"
@@ -49,17 +52,17 @@ Boston, MA 02111-1307, USA.  */
 /* use a more compact format for line information */
 #define DWARF2_ASM_LINE_DEBUG_INFO 1
 
-/* WCHAR_TYPE_SIZE is defined to BITS_PER_WORD in svr4.h, but
-   BITS_PER_WORD isn't constant any more.  Fortunately, on no SH
-   platform is it wider than 32-bits.  */
-#define MAX_WCHAR_TYPE_SIZE 32
+/* WCHAR_TYPE / WCHAR_TYPE_SIZE are defined to long int / BITS_PER_WORD in
+   svr4.h, but these work out as 64 bit for shmedia64.  */
+#undef WCHAR_TYPE
+/* #define WCHAR_TYPE (TARGET_SH5 ? "int" : "long int") */
+#define WCHAR_TYPE SH_ELF_WCHAR_TYPE
+   
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
 
-/* The prefix to add to user-visible assembler symbols.
-   Note that svr4.h redefined it from the original value (that we want)
-   in sh.h */
 
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX "_"
+/* The prefix to add to user-visible assembler symbols.  */
 
 #undef LOCAL_LABEL_PREFIX
 #define LOCAL_LABEL_PREFIX "."
@@ -109,29 +112,7 @@ Boston, MA 02111-1307, USA.  */
 
 /* svr4.h undefined DBX_REGISTER_NUMBER, so we need to define it
    again.  */
-#define DBX_REGISTER_NUMBER(REGNO)                                     \
-  (GENERAL_REGISTER_P (REGNO)                                          \
-   ? ((REGNO) - FIRST_GENERAL_REG)                                     \
-   : FP_REGISTER_P (REGNO)                                             \
-   ? ((REGNO) - FIRST_FP_REG + (TARGET_SH5 ? (TARGET_SHCOMPACT ? 245   \
-                                             : 77) : 25))              \
-   : XD_REGISTER_P (REGNO)                                             \
-   ? ((REGNO) - FIRST_XD_REG + (TARGET_SH5 ? 289 : 87))                        \
-   : TARGET_REGISTER_P (REGNO)                                         \
-   ? ((REGNO) - FIRST_TARGET_REG + 68)                                 \
-   : (REGNO) == PR_REG                                                 \
-   ? (TARGET_SH5 ? 241 : 17)                                           \
-   : (REGNO) == T_REG                                                  \
-   ? (TARGET_SH5 ? 242 : 18)                                           \
-   : (REGNO) == GBR_REG                                                        \
-   ? (TARGET_SH5 ? 238 : 19)                                           \
-   : (REGNO) == MACH_REG                                               \
-   ? (TARGET_SH5 ? 239 : 20)                                           \
-   : (REGNO) == MACL_REG                                               \
-   ? (TARGET_SH5 ? 240 : 21)                                           \
-   : (REGNO) == FPUL_REG                                               \
-   ? (TARGET_SH5 ? 244 : 23)                                           \
-   : (abort(), -1))
+#define DBX_REGISTER_NUMBER(REGNO) SH_DBX_REGISTER_NUMBER (REGNO)
 
 #undef ASM_GENERATE_INTERNAL_LABEL
 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
diff --git a/gcc/config/sh/embed-elf.h b/gcc/config/sh/embed-elf.h
new file mode 100644 (file)
index 0000000..4afc783
--- /dev/null
@@ -0,0 +1,28 @@
+/* Definitions of target machine for GNU compiler for Hitachi / SuperH SH 
+   non-Linux embedded targets.
+   Copyright (C) 2002 Free Software Foundation, Inc.
+   Contributed by J"orn Rennecke <joern.rennecke@superh.com>
+
+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.  */
+
+#include "sh/elf.h"
+
+#undef USER_LABEL_PREFIX
+#define USER_LABEL_PREFIX "_"
+
+#undef TARGET_HAS_F_SETLKW
diff --git a/gcc/config/sh/embed_bb.c b/gcc/config/sh/embed_bb.c
new file mode 100644 (file)
index 0000000..722b101
--- /dev/null
@@ -0,0 +1,3 @@
+#define L_bb
+#undef inhibit_libc
+#include "../../libgcc2.c"
index a9a3f22e3fd8ceee16fc90a151a8fcef59f4d96f..be5bcb581489b4b26ab97b05fa9af02abb686238 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions for SH running Linux-based GNU systems using ELF
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
    Contributed by Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
 
 This file is part of GNU CC.
@@ -23,22 +23,6 @@ Boston, MA 02111-1307, USA.  */
 #undef TARGET_VERSION
 #define TARGET_VERSION  fputs (" (SH GNU/Linux with ELF)", stderr);
 
-/* Return to the original ELF way.  */
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-  
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
-   
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
 #undef SUBTARGET_CPP_SPEC
 #define SUBTARGET_CPP_SPEC "\
    %{fPIC:-D__PIC__ -D__pic__} \
@@ -59,12 +43,12 @@ Boston, MA 02111-1307, USA.  */
 #undef CPP_PREDEFINES
 #define CPP_PREDEFINES "-D__ELF__ -Dunix -D__sh__ -Dlinux -Asystem=posix"
 
-#undef ASM_SPEC
-#define ASM_SPEC  "%{!mb:-little} %{mrelax:-relax}"
+#undef SUBTARGET_ASM_ENDIAN_SPEC
+#define SUBTARGET_ASM_ENDIAN_SPEC "%{!mb:-little}"
 
 #undef CC1_SPEC
 #define CC1_SPEC \
-  "-musermode %{!mb:-ml} %{!m3e:%{!m4:-m3}}"
+  "-musermode %{!mb:-ml} %{!m3e:%{!m4*:%{!m5*:-m3}}}"
 
 #undef CC1PLUS_SPEC
 #define CC1PLUS_SPEC \
index d7a1162e46c879d6bcae0b8c389b51e13636d8fc..6abdfe6258d94725759b6b8c041881897c2b68ee 100644 (file)
@@ -1,4 +1,4 @@
-/* Definitions of target machine for GNU compiler for Hitachi / SuperH SH
+/* Definitions of target machine for GNU compiler for Hitachi / SuperH SH.
    Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
    Free Software Foundation, Inc.
    Contributed by Steve Chamberlain (sac@cygnus.com).
index 882a778e901861b70678bf1c2a4319050c995ba7..ff3c08930ea4d8d6384d5b3645b9828179f1e4dc 100644 (file)
@@ -4343,10 +4343,11 @@ calc_live_regs (count_ptr, live_regs_mask)
          target_flags &= ~FPU_SINGLE_BIT;
          break;
        }
-  pr_initial = has_hard_reg_initial_val (Pmode, PR_REG);
+  pr_initial = has_hard_reg_initial_val (Pmode,
+                                        TARGET_SH5 ? PR_MEDIA_REG : PR_REG);
   pr_live = (pr_initial
-            ? REGNO (pr_initial) != PR_REG
-            : regs_ever_live[PR_REG]);
+            ? REGNO (pr_initial) != (TARGET_SH5 ? PR_MEDIA_REG : PR_REG)
+            : regs_ever_live[TARGET_SH5 ? PR_MEDIA_REG : PR_REG]);
   /* Force PR to be live if the prologue has to call the SHmedia
      argument decoder or register saver.  */
   if (TARGET_SHCOMPACT
@@ -4356,7 +4357,7 @@ calc_live_regs (count_ptr, live_regs_mask)
     pr_live = 1;
   for (count = 0, reg = FIRST_PSEUDO_REGISTER - 1; reg >= 0; reg--)
     {
-      if (reg == PR_REG
+      if (reg == (TARGET_SH5 ? PR_MEDIA_REG : PR_REG)
          ? pr_live
          : (interrupt_handler && ! pragma_trapa)
          ? (/* Need to save all the regs ever live.  */
@@ -6697,7 +6698,7 @@ sh_adjust_cost (insn, link, dep_insn, cost)
 int
 sh_pr_n_sets ()
 {
-  return REG_N_SETS (PR_REG);
+  return REG_N_SETS (TARGET_SH5 ? PR_MEDIA_REG : PR_REG);
 }
 
 /* SHmedia requires registers for branches, so we can't generate new
index 75e7d5eae3f2bdf9271dbd0dca61b634ca2a0b25..0f9345cd302f23c8588f9a15dcbab83404afa995 100644 (file)
@@ -56,10 +56,11 @@ extern int code_for_indirect_jump_scratch;
 %{m4-single:-D__SH4_SINGLE__} \
 %{m4-nofpu:-D__sh3__ -D__SH4_NOFPU__} \
 %{m4:-D__SH4__} \
+%{m1|m2|m3*|m4*:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
+%{m5*:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
 %{!m1:%{!m2:%{!m3*:%{!m4*:%{!m5*:%(cpp_default_cpu_spec)}}}}} \
 %{mhitachi:-D__HITACHI__} \
 %(subtarget_cpp_spec) \
-%(subtarget_cpp_ptr_spec) \
 %(subtarget_cpp_endian_spec) "
 
 #ifndef SUBTARGET_CPP_ENDIAN_SPEC
@@ -71,25 +72,24 @@ extern int code_for_indirect_jump_scratch;
 #endif
 
 #ifndef CPP_DEFAULT_CPU_SPEC
-#define CPP_DEFAULT_CPU_SPEC "-D__sh1__"
+#define CPP_DEFAULT_CPU_SPEC \
+  "-D__sh1__ -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int"
 #endif
 
-#ifndef SUBTARGET_CPP_PTR_SPEC
-#define SUBTARGET_CPP_PTR_SPEC "\
-%{m5-64media|m5-64media-nofpu|m5-32media|m5-32media-nofpu|m5-compact|m5-compact-nofpu:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
-%{!m5-64media:%{!m5-64media-nofpu:%{!m5-32media:%{!m5-32media-nofpu:%{!m5-compact:%{!m5-compact-nofpu:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}}}}}} \
-"
-#endif
 
 #define EXTRA_SPECS                                            \
   { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC },                        \
   { "subtarget_cpp_endian_spec", SUBTARGET_CPP_ENDIAN_SPEC },  \
-  { "subtarget_cpp_ptr_spec", SUBTARGET_CPP_PTR_SPEC },                \
-  { "cpp_default_cpu_spec", CPP_DEFAULT_CPU_SPEC },
+  { "cpp_default_cpu_spec", CPP_DEFAULT_CPU_SPEC },            \
+  { "subtarget_asm_endian_spec", SUBTARGET_ASM_ENDIAN_SPEC },
 
 #define CPP_PREDEFINES "-D__sh__ -Acpu=sh -Amachine=sh"
 
-#define ASM_SPEC  "%{ml:-little} %{mrelax:-relax}"
+#define ASM_SPEC  "%(subtarget_asm_endian_spec) %{mrelax:-relax}"
+
+#ifndef SUBTARGET_ASM_ENDIAN_SPEC
+#define SUBTARGET_ASM_ENDIAN_SPEC "%{ml:-little}"
+#endif
 
 #define LINK_SPEC "%{ml:-m shl} %{mrelax:-relax}"
 
@@ -2057,7 +2057,7 @@ while (0)
 
 #define RETURN_ADDR_RTX(COUNT, FRAME)  \
   (((COUNT) == 0)                              \
-   ? get_hard_reg_initial_val (Pmode, PR_REG) \
+   ? get_hard_reg_initial_val (Pmode, TARGET_SHMEDIA ? PR_MEDIA_REG : PR_REG) \
    : (rtx) 0)
 \f
 /* Generate necessary RTL for __builtin_saveregs().  */
@@ -2522,6 +2522,9 @@ while (0)
 
 #define WCHAR_TYPE "short unsigned int"
 #define WCHAR_TYPE_SIZE 16
+#define WCHAR_UNSIGNED 1
+
+#define SH_ELF_WCHAR_TYPE "long int"
 
 /* Don't cse the address of the function being compiled.  */
 /*#define NO_RECURSIVE_FUNCTION_CSE 1*/
@@ -2892,8 +2895,11 @@ while (0)
 /* DBX register number for a given compiler register number.  */
 /* GDB has FPUL at 23 and FP0 at 25, so we must add one to all FP registers
    to match gdb.  */
-/* If you change this macro, make sure you update it in elf.h too.  */
-#define DBX_REGISTER_NUMBER(REGNO) \
+/* svr4.h undefines this macro, yet we really want to use the same numbers
+   for coff as for elf, so we go via another macro: SH_DBX_REGISTER_NUMBER.  */
+#define DBX_REGISTER_NUMBER(REGNO) SH_DBX_REGISTER_NUMBER (REGNO)
+
+#define SH_DBX_REGISTER_NUMBER(REGNO) \
   (GENERAL_REGISTER_P (REGNO) \
    ? ((REGNO) - FIRST_GENERAL_REG) \
    : FP_REGISTER_P (REGNO) \
@@ -3298,10 +3304,13 @@ extern struct rtx_def *fpscr_rtx;
 #endif /* (defined CRT_BEGIN || defined CRT_END) && ! __SHMEDIA__ */
 
 #define ALLOCATE_INITIAL_VALUE(hard_reg) \
-  (REGNO (hard_reg) == PR_REG \
+  (REGNO (hard_reg) == (TARGET_SH5 ? PR_MEDIA_REG : PR_REG) \
    ? (current_function_is_leaf && ! sh_pr_n_sets () \
       ? (hard_reg) \
-      : gen_rtx_MEM (Pmode, arg_pointer_rtx)) \
+      : gen_rtx_MEM (Pmode, TARGET_SH5 \
+                           ? (plus_constant (arg_pointer_rtx, \
+                                             TARGET_SHMEDIA64 ? -8 : -4)) \
+                           : frame_pointer_rtx)) \
    : NULL_RTX)
 
 #endif /* ! GCC_SH_H */
index c23c354565f33901c8a04b7f25c556797a82c9de..a2e225d841ba737c6efa1e9ee8f5a833f82acc8c 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions of target machine for GNU compiler for SuperH SH 5.
-   Copyright 2000, 2001 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
    Contributed by Alexandre Oliva <aoliva@redhat.com>
 
 This file is part of GNU CC.
@@ -24,20 +24,15 @@ Boston, MA 02111-1307, USA.  */
   fputs (" (SuperH SH)", stderr);
 
 #undef CPP_DEFAULT_CPU_SPEC
-#define CPP_DEFAULT_CPU_SPEC "-D__SH5__=32 -D__SHMEDIA__"
-
-#undef SUBTARGET_CPP_PTR_SPEC
-#define SUBTARGET_CPP_PTR_SPEC "\
-%{!m1:%{!m2:%{!m3:%{!m3e:%{!m4:%{!m4-single:%{!m4-single-only:%{!m4-nofpu:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int}}}}}}}} \
-%{m1|m2|m3|m3e|m4|m4-single|m4-single-only|m4-nofpu:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-"
+#define CPP_DEFAULT_CPU_SPEC "-D__SH5__=32 -D__SHMEDIA__ \
+-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int"
 
 #undef ASM_SPEC
-#define ASM_SPEC  "%{ml:-little} %{mrelax:-relax} \
-%{m5-compact:--isa=SHcompact} %{m5-compact-nofpu:--isa=shcompact} \
-%{m5-32media:--isa=SHmedia --abi=32} %{m5-32media-nofpu:--isa=SHmedia --abi=32} \
-%{m5-64media:--isa=SHmedia --abi=64} %{m5-64media-nofpu:--isa=SHmedia --abi=64} \
-%{!m1:%{!m2:%{!m3:%{!m3e:%{!m4:%{!m4-single:%{!m4-single-only:%{!m4-nofpu:%{!m5-64media:%{!m5-64media-nofpu:%{!m5-32media:%{!m5-32media-nofpu:%{!m5-compact:%{!m5-compact-nofpu:--isa=SHmedia --abi=32}}}}}}}}}}}}}} \
+#define ASM_SPEC  "%(subtarget_asm_endian_spec) %{mrelax:-relax} \
+%{m5-compact*:--isa=SHcompact} \
+%{m5-32media*:--isa=SHmedia --abi=32} \
+%{m5-64media*:--isa=SHmedia --abi=64} \
+%{!m1:%{!m2:%{!m3*:%{!m4*:%{!m5*:--isa=SHmedia --abi=32}}}}} \
 "
 
 #undef LINK_SPEC
@@ -54,12 +49,5 @@ Boston, MA 02111-1307, USA.  */
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT  (SH5_BIT|SH4_BIT|SH3E_BIT)
 
-/* These have been overridden in svr4.h, included in elf.h.  Restore
-   them.  */
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "short unsigned int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 16
-
-#undef MAX_WCHAR_TYPE_SIZE
+#undef SH_ELF_WCHAR_TYPE
+#define SH_ELF_WCHAR_TYPE "int"
index 5e4ed91a3c1a1a73aa62afb33c36b0e6da5a6bdc..a0343b47d80a9b90490870cdcab05240528d6930 100644 (file)
@@ -1,7 +1,7 @@
 TARGET_LIBGCC2_CFLAGS = -fpic
-LIB1ASMFUNCS = _ashiftrt _ashiftrt_n _ashiftlt _lshiftrt _movstr \
-  _movstr_i4 _mulsi3 _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \
-  _ic_invalidate
+LIB1ASMFUNCS_CACHE = _ic_invalidate
+
+LIB2FUNCS_EXTRA=
 
 MULTILIB_OPTIONS= mb m3e/m4
 MULTILIB_DIRNAMES= 
index 9788c49c7d92ab9b544ee40dad5b28518b7a9698..15433f93b9d79ac143227c7cfa060be56f3a5d15 100644 (file)
@@ -1,6 +1,9 @@
 LIB1ASMSRC = sh/lib1funcs.asm
 LIB1ASMFUNCS = _ashiftrt _ashiftrt_n _ashiftlt _lshiftrt _movstr \
-  _movstr_i4 _mulsi3 _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr
+  _movstr_i4 _mulsi3 _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \
+  $(LIB1ASMFUNCS_CACHE)
+
+LIB2FUNCS_EXTRA=$(srcdir)/config/sh/embed_bb.c
 
 # We want fine grained libraries, so use the new code to build the
 # floating point emulation libraries.
index c3329893019f097f215df26d965f765f594f2e1e..91c1db80c16be8860cd77c263abd581416ee6bc2 100644 (file)
@@ -6,6 +6,8 @@ LIB1ASMFUNCS = \
   _shcompact_incoming_args _ic_invalidate _nested_trampoline \
   _push_pop_shmedia_regs
 
+LIB2FUNCS_EXTRA=$(srcdir)/config/sh/embed_bb.c
+
 MULTILIB_OPTIONS= ml m5-32media-nofpu/m5-compact/m5-compact-nofpu/m5-64media/m5-64media-nofpu
 MULTILIB_DIRNAMES= ml nofpu compact nofpu/compact media64 nofpu/media64
 MULTILIB_MATCHES=