$NetBSD: patch-sh,v 1.1 2001/01/04 01:19:32 itojun Exp $ --- config.sub- Wed Jan 3 21:37:56 2001 +++ config.sub Wed Jan 3 21:38:16 2001 @@ -165,3 +165,3 @@ | alpha | alphaev5 | alphaev56 | alphapca56 | alphaev6 \ - | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ + | we32k | ns16k | clipper | i370 | sh | shel | powerpc | powerpcle \ | 1750a | dsp16xx | pdp11 \ @@ -213,3 +213,3 @@ | xps100-* | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparclite-* | pdp11-* | sh-* | shel-* | powerpc-* | powerpcle-* \ | sparc64-* | mips64-* | mipsel-* | mipseb-* \ @@ -679,2 +679,5 @@ os=-hms + ;; + shel) + basic_machine=sh-hitachi ;; --- libio/floatconv.c- Wed Jan 3 21:40:32 2001 +++ libio/floatconv.c Wed Jan 3 21:40:42 2001 @@ -151,7 +151,7 @@ #if defined(MIPSEL) || defined(__alpha__) #define IEEE_8087 #endif -#if defined(__sparc__) || defined(sparc) || defined(MIPSEB) +#if defined(__sparc__) || defined(sparc) || defined(MIPSEB) || defined(__sh__) #define IEEE_MC68k #endif --- gcc/configure.in- Wed Jan 3 21:41:07 2001 +++ gcc/configure.in Wed Jan 3 21:42:27 2001 @@ -318,6 +318,9 @@ pyramid-*-*) cpu_type=pyr ;; + sh*-*-*) + cpu_type=sh + ;; sparc*-*-*) cpu_type=sparc ;; @@ -2570,6 +2573,30 @@ sh-*-rtems*) tmake_file="sh/t-sh t-rtems" tm_file=sh/rtems.h + float_format=sh + ;; + sh-*-netbsdcoff) + tm_file=sh/netbsdcoff.h + use_collect2= + fixincludes=fixinc.wrap + float_format=sh + ;; + shel-*-netbsdcoff) + tm_file=sh/netbsdelcoff.h + use_collect2= + fixincludes=fixinc.wrap + float_format=sh + ;; + sh-*-netbsdelf) + tm_file=sh/netbsdelf.h + use_collect2= + fixincludes=fixinc.wrap + float_format=sh + ;; + shel-*-netbsdelf) + tm_file=sh/netbsdelelf.h + use_collect2= + fixincludes=fixinc.wrap float_format=sh ;; sh-*-*) --- gcc/configure- Wed Jan 3 21:41:09 2001 +++ gcc/configure Wed Jan 3 21:42:37 2001 @@ -2220,6 +2220,9 @@ pyramid-*-*) cpu_type=pyr ;; + sh*-*-*) + cpu_type=sh + ;; sparc*-*-*) cpu_type=sparc ;; @@ -4482,6 +4485,30 @@ sh-*-rtems*) tmake_file="sh/t-sh t-rtems" tm_file=sh/rtems.h + float_format=sh + ;; + sh-*-netbsdcoff) + tm_file=sh/netbsdcoff.h + use_collect2= + fixincludes=fixinc.wrap + float_format=sh + ;; + shel-*-netbsdcoff) + tm_file=sh/netbsdelcoff.h + use_collect2= + fixincludes=fixinc.wrap + float_format=sh + ;; + sh-*-netbsdelf) + tm_file=sh/netbsdelf.h + use_collect2= + fixincludes=fixinc.wrap + float_format=sh + ;; + shel-*-netbsdelf) + tm_file=sh/netbsdelelf.h + use_collect2= + fixincludes=fixinc.wrap float_format=sh ;; sh-*-*) diff -uN gcc/config/sh/lib1funcs.asm gcc/config/sh/lib1funcs.asm --- gcc/config/sh/lib1funcs.asm Wed Jan 3 21:39:06 2001 +++ gcc/config/sh/lib1funcs.asm Wed Jan 3 21:40:10 2001 @@ -707,7 +707,7 @@ mov.l r0,@(0,r4) ___movstrSI0: rts - or r0,r0,r0 + nop .align 4 diff -uN gcc/config/sh/netbsdcoff.h gcc/config/sh/netbsdcoff.h --- gcc/config/sh/netbsdcoff.h Thu Jan 1 09:00:00 1970 +++ gcc/config/sh/netbsdcoff.h Wed Jan 3 21:43:23 2001 @@ -0,0 +1,59 @@ +#include + +#undef CPP_SPEC +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} \ +%{ml:-D__LITTLE_ENDIAN__} \ +%{m1:-D__sh1__} \ +%{m2:-D__sh2__} \ +%{m3:-D__sh3__} \ +%{m3e:-D__SH3E__} \ +%{!m1:%{!m2:%{!m3:%{!m3e:-D__sh1__}}}}" + +#undef CPP_PREDEFINES +#define CPP_PREDEFINES "-D__sh__ -Dunix -Dsh3 -D__NetBSD__ -Asystem(unix) -Asystem(NetBSD) -Acpu(sh) -Amachine(sh)" + +/* XXX -fpic -fPIC? (msaitoh) */ +#undef ASM_SPEC +#define ASM_SPEC "%{ml:-little} %{mrelax:-relax}" + +#undef LIB_SPEC +#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" + +#undef LINK_SPEC +#define LINK_SPEC \ + "%{ml:-m shlunx} %{mrelax:-relax} %{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}" + +/* We have atexit(3). */ + +#define HAVE_ATEXIT + +/* Implicit library calls should use memcpy, not bcopy, etc. */ + +#define TARGET_MEM_FUNCTIONS + +/* Handle #pragma weak and #pragma pack. */ + +#define HANDLE_SYSV_PRAGMA + + +/* Make gcc agree with */ + +#undef SIZE_TYPE +#define SIZE_TYPE "unsigned int" + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE "int" + +#undef WCHAR_TYPE +#define WCHAR_TYPE "int" + +#undef WCHAR_UNSIGNED +#define WCHAR_UNSIGNED 0 + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE 32 + +/* Until they use ELF or something that handles dwarf2 unwinds + and initialization stuff better. */ +#undef DWARF2_UNWIND_INFO + diff -uN gcc/config/sh/netbsdelcoff.h gcc/config/sh/netbsdelcoff.h --- gcc/config/sh/netbsdelcoff.h Thu Jan 1 09:00:00 1970 +++ gcc/config/sh/netbsdelcoff.h Wed Jan 3 21:43:23 2001 @@ -0,0 +1,64 @@ +#include + +#undef CPP_SPEC +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} \ +%{!mb:-D__LITTLE_ENDIAN__} \ +%{m1:-D__sh1__} \ +%{m2:-D__sh2__} \ +%{m3:-D__sh3__} \ +%{m3e:-D__SH3E__} \ +%{!m1:%{!m2:%{!m3:%{!m3e:-D__sh1__}}}}" + +#undef CPP_PREDEFINES +#define CPP_PREDEFINES "-D__sh__ -Dunix -Dsh3 -D__NetBSD__ -Asystem(unix) -Asystem(NetBSD) -Acpu(sh) -Amachine(sh)" + +/* XXX -fpic -fPIC? (msaitoh) */ +#undef ASM_SPEC +#define ASM_SPEC "%{!mb:-little} %{mrelax:-relax}" + +#undef LIB_SPEC +#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" + +#undef LINK_SPEC +#define LINK_SPEC \ + "%{!mb:-m shlunx} %{mrelax:-relax} %{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}" + +/* set default to little endian */ + +#undef TARGET_DEFAULT +#define TARGET_DEFAULT LITTLE_ENDIAN_BIT + +/* We have atexit(3). */ + +#define HAVE_ATEXIT + +/* Implicit library calls should use memcpy, not bcopy, etc. */ + +#define TARGET_MEM_FUNCTIONS + +/* Handle #pragma weak and #pragma pack. */ + +#define HANDLE_SYSV_PRAGMA + + +/* Make gcc agree with */ + +#undef SIZE_TYPE +#define SIZE_TYPE "unsigned int" + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE "int" + +#undef WCHAR_TYPE +#define WCHAR_TYPE "int" + +#undef WCHAR_UNSIGNED +#define WCHAR_UNSIGNED 0 + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE 32 + +/* Until they use ELF or something that handles dwarf2 unwinds + and initialization stuff better. */ +#undef DWARF2_UNWIND_INFO + diff -uN gcc/config/sh/netbsdelelf.h gcc/config/sh/netbsdelelf.h --- gcc/config/sh/netbsdelelf.h Thu Jan 1 09:00:00 1970 +++ gcc/config/sh/netbsdelelf.h Wed Jan 3 21:43:23 2001 @@ -0,0 +1,142 @@ +/* Definitions of target machine for gcc for Hitachi Super-H using ELF. + Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Ian Lance Taylor . + +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. */ + +/* Get generic SH definitions. */ +#include + +/* No SDB debugging info. */ +#undef SDB_DEBUGGING_INFO + +/* Undefine some macros defined in both sh.h and svr4.h. */ +#undef IDENT_ASM_OP +#undef ASM_FILE_END +#undef ASM_OUTPUT_SOURCE_LINE +#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END +#undef CTORS_SECTION_ASM_OP +#undef DTORS_SECTION_ASM_OP +#undef ASM_OUTPUT_SECTION_NAME +#undef ASM_OUTPUT_CONSTRUCTOR +#undef ASM_OUTPUT_DESTRUCTOR +#undef ASM_DECLARE_FUNCTION_NAME +#undef PREFERRED_DEBUGGING_TYPE +#undef MAX_OFILE_ALIGNMENT + +/* Be ELF-like. */ +#include + +/* Get generic NetBSD ELF definitions. */ +#define NETBSD_ELF +#include + +/* 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 "_" + +#undef LOCAL_LABEL_PREFIX +#define LOCAL_LABEL_PREFIX "." + +#undef ASM_FILE_START +#define ASM_FILE_START(FILE) do { \ + output_file_directive ((FILE), main_input_filename); \ + if (TARGET_LITTLE_ENDIAN) \ + fprintf ((FILE), "\t.little\n"); \ +} while (0) + +#undef CPP_SPEC +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} \ +%{!mb:-D__LITTLE_ENDIAN__} \ +%{m1:-D__sh1__} \ +%{m2:-D__sh2__} \ +%{m3:-D__sh3__} \ +%{m3e:-D__SH3E__} \ +%{!m1:%{!m2:%{!m3:%{!m3e:-D__sh1__}}}}" + +/* Let code know that this is ELF. */ +#define CPP_PREDEFINES \ +"-D__sh__ -D__sh3__ -D__NetBSD__ -D__ELF__ -D__KPRINTF_ATTRIBUTE__ \ +-Asystem(unix) -Asystem(NetBSD) -Acpu(sh3) -Amachine(sh3)" + +/* svr4.h undefined DBX_REGISTER_NUMBER, so we need to define it + again. */ +#define DBX_REGISTER_NUMBER(REGNO) \ + (((REGNO) >= 22 && (REGNO) <= 39) ? ((REGNO) + 1) : (REGNO)) + +/* SH ELF, unlike most ELF implementations, uses underscores before + symbol names. */ +#undef ASM_OUTPUT_LABELREF +#define ASM_OUTPUT_LABELREF(STREAM,NAME) \ + asm_fprintf (STREAM, "%U%s", NAME) + +#undef ASM_GENERATE_INTERNAL_LABEL +#define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \ + sprintf ((STRING), "*%s%s%d", LOCAL_LABEL_PREFIX, (PREFIX), (NUM)) + +#undef ASM_OUTPUT_INTERNAL_LABEL +#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ + asm_fprintf ((FILE), "%L%s%d:\n", (PREFIX), (NUM)) + +#undef ASM_OUTPUT_SOURCE_LINE +#define ASM_OUTPUT_SOURCE_LINE(file, line) \ +do \ + { \ + static int sym_lineno = 1; \ + asm_fprintf ((file), ".stabn 68,0,%d,%LLM%d-", \ + (line), sym_lineno); \ + assemble_name ((file), \ + XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\ + asm_fprintf ((file), "\n%LLM%d:\n", sym_lineno); \ + sym_lineno += 1; \ + } \ +while (0) + +#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END +#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ +do { \ + text_section (); \ + fprintf ((FILE), "\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO); \ +} while (0) + +/* HANDLE_SYSV_PRAGMA (defined by svr4.h) takes precedence over HANDLE_PRAGMA. + We want to use the HANDLE_PRAGMA from sh.h. */ +#undef HANDLE_SYSV_PRAGMA + +#undef ASM_SPEC +#define ASM_SPEC \ + "%{!mb:-little} %{mrelax:-relax} %{fpic:-k} %{fPIC:-k}" + +#undef LINK_SPEC +#define LINK_SPEC \ + "%{!mb:-m elf32shlunx} %{mrelax:-relax} \ + %{assert*} \ + %{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}}" + +#undef TARGET_DEFAULT +#define TARGET_DEFAULT LITTLE_ENDIAN_BIT diff -uN gcc/config/sh/netbsdelf.h gcc/config/sh/netbsdelf.h --- gcc/config/sh/netbsdelf.h Thu Jan 1 09:00:00 1970 +++ gcc/config/sh/netbsdelf.h Wed Jan 3 21:43:23 2001 @@ -0,0 +1,130 @@ +/* Definitions of target machine for gcc for Hitachi Super-H using ELF. + Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Ian Lance Taylor . + +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. */ + +/* Get generic SH definitions. */ +#include + +/* No SDB debugging info. */ +#undef SDB_DEBUGGING_INFO + +/* Undefine some macros defined in both sh.h and svr4.h. */ +#undef IDENT_ASM_OP +#undef ASM_FILE_END +#undef ASM_OUTPUT_SOURCE_LINE +#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END +#undef CTORS_SECTION_ASM_OP +#undef DTORS_SECTION_ASM_OP +#undef ASM_OUTPUT_SECTION_NAME +#undef ASM_OUTPUT_CONSTRUCTOR +#undef ASM_OUTPUT_DESTRUCTOR +#undef ASM_DECLARE_FUNCTION_NAME +#undef PREFERRED_DEBUGGING_TYPE +#undef MAX_OFILE_ALIGNMENT + +/* Be ELF-like. */ +#include + +/* Get generic NetBSD ELF definitions. */ +#define NETBSD_ELF +#include + +/* 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 "_" + +#undef LOCAL_LABEL_PREFIX +#define LOCAL_LABEL_PREFIX "." + +#undef ASM_FILE_START +#define ASM_FILE_START(FILE) do { \ + output_file_directive ((FILE), main_input_filename); \ + if (TARGET_LITTLE_ENDIAN) \ + fprintf ((FILE), "\t.little\n"); \ +} while (0) + +/* Let code know that this is ELF. */ +#define CPP_PREDEFINES \ +"-D__sh__ -D__sh3__ -D__NetBSD__ -D__ELF__ -D__KPRINTF_ATTRIBUTE__ \ +-Asystem(unix) -Asystem(NetBSD) -Acpu(sh3) -Amachine(sh3)" + +/* svr4.h undefined DBX_REGISTER_NUMBER, so we need to define it + again. */ +#define DBX_REGISTER_NUMBER(REGNO) \ + (((REGNO) >= 22 && (REGNO) <= 39) ? ((REGNO) + 1) : (REGNO)) + +/* SH ELF, unlike most ELF implementations, uses underscores before + symbol names. */ +#undef ASM_OUTPUT_LABELREF +#define ASM_OUTPUT_LABELREF(STREAM,NAME) \ + asm_fprintf (STREAM, "%U%s", NAME) + +#undef ASM_GENERATE_INTERNAL_LABEL +#define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \ + sprintf ((STRING), "*%s%s%d", LOCAL_LABEL_PREFIX, (PREFIX), (NUM)) + +#undef ASM_OUTPUT_INTERNAL_LABEL +#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ + asm_fprintf ((FILE), "%L%s%d:\n", (PREFIX), (NUM)) + +#undef ASM_OUTPUT_SOURCE_LINE +#define ASM_OUTPUT_SOURCE_LINE(file, line) \ +do \ + { \ + static int sym_lineno = 1; \ + asm_fprintf ((file), ".stabn 68,0,%d,%LLM%d-", \ + (line), sym_lineno); \ + assemble_name ((file), \ + XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\ + asm_fprintf ((file), "\n%LLM%d:\n", sym_lineno); \ + sym_lineno += 1; \ + } \ +while (0) + +#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END +#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ +do { \ + text_section (); \ + fprintf ((FILE), "\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO); \ +} while (0) + +/* HANDLE_SYSV_PRAGMA (defined by svr4.h) takes precedence over HANDLE_PRAGMA. + We want to use the HANDLE_PRAGMA from sh.h. */ +#undef HANDLE_SYSV_PRAGMA + +#undef ASM_SPEC +#define ASM_SPEC \ + "%{ml:-little} %{mrelax:-relax} %{fpic:-k} %{fPIC:-k}" + +#undef LINK_SPEC +#define LINK_SPEC \ + "%{ml:-m elf32shlunx} %{mrelax:-relax} \ + %{assert*} \ + %{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}}"