* config/sh/little.h: New file.
* config/sh/sh.h (TARGET_ENDIAN_DEFAULT): If not already
defined, define to 0 to select big-endian.
(SUBTARGET_ASM_ENDIAN_SPEC): Define according to TARGET_ENDIAN_DEFAULT.
(TARGET_DEFAULT): Include TARGET_ENDIAN_DEFAULT.
* config/sh/sh64.h (TARGET_DEFAULT): Include TARGET_ENDIAN_DEFAULT.
* config/sh/t-be: New file.
* config/sh/t-le: New file.
* sh.h (SDB_DEBUGGING_INFO, #include "dbxcoff.h"): Moved to sh/coff.h.
(SDB_DELIM, MAX_OFILE_ALIGNMENT, IDENT_ASM_OP): Likewise.
(TARGET_ASM_NAMED_SECTION, ASM_OUTPUT_SKIP): Likewise.
(USER_LABEL_PREFIX, LOCAL_LABEL_PREFIX): Likewise.
(ASM_GENERATE_INTERNAL_LABEL, ASM_OUTPUT_INTERNAL_LABEL): Likewise.
(ASM_OUTPUT_COMMON, ASM_OUTPUT_LOCAL): Likewise.
(ASM_FILE_END, ASM_DECLARE_FUNCTION_NAME): Deleted.
(CPP_SPEC, SUBTARGET_CPP_ENDIAN_SPEC): Likewise.
(SUBTARGET_CPP_SPEC, CPP_DEFAULT_CPU_SPEC, CPP_PREDEFINES): Likewise.
(EXTRA_SPECS): Remove SUBTARGET_CPP_ENDIAN_SPEC and
CPP_DEFAULT_CPU_SPEC. Add LINK_EMUL_PREFIX, LINK_DEFAULT_CPU_EMUL,
SUBTARGET_LINK_EMUL_SUFFIX and SUBTARGET_LINK_SPEC.
(LINK_SPEC): Define to SH_LINK_SPEC.
(TARGET_CPU_CPP_BUILTINS, SH_LINK_SPEC): Define.
(LINK_EMUL_PREFIX, LINK_DEFAULT_CPU_EMUL): Likewise.
(SUBTARGET_LINK_EMUL_SUFFIX, SUBTARGET_LINK_SPEC): Likewise.
(CPP_SPEC): Reduce to %(subtarget_cpp_spec).
(TARGET_ENDIAN_DEFAULT): Define if not already defined.
* config/sh/coff.h: New file.
(TARGET_ASM_NAMED_SECTION): Now default_coff_asm_named_section
(TARGET_OBJFMT_CPP_BUILTINS): Define.
* config/sh/elf.h (IDENT_ASM_OP): No need to #undef at the start.
(ASM_FILE_END, ASM_OUTPUT_SOURCE_LINE): Likewise.
(DBX_OUTPUT_MAIN_SOURCE_FILE_END, TARGET_ASM_NAMED_SECTION): Likewise.
(ASM_DECLARE_FUNCTION_NAME, MAX_OFILE_ALIGNMENT, SIZE_TYPE): Likewise.
(PTRDIFF_TYPE): Likewise.
("dbxelf.h", "elfos.h", "svr4.h"): Don't #include.
(CPP_PREDEFINES): Don't define.
(TARGET_OBJFMT_CPP_BUILTINS): Define.
(LINK_SPEC): Define to SH_LINK_SPEC.
(LINK_EMUL_PREFIX): Redefine.
* config/sh/linux.h: (SUBTARGET_CPP_SPEC): Remove -fpic / -fPIC cases.
(SUBTARGET_CPP_ENDIAN_SPEC, CPP_DEFAULT_CPU_SPEC): Remove redefinition.
(CPP_PREDEFINES, SUBTARGET_ASM_ENDIAN_SPEC): Likewise.
(CC1_SPEC, CC1PLUS_SPEC, LINK_SPEC): Likewise.
(TARGET_OS_CPP_BUILTINS): Define.
(TARGET_DEFAULT): Redefine.
(SUBTARGET_LINK_EMUL_SUFFIX, SUBTARGET_LINK_SPEC): Likewise.
* config/sh/sh64.h (CPP_DEFAULT_CPU_SPEC): Remove.
(LINK_SPEC): Don't redefine.
(LINK_DEFAULT_CPU_EMUL): Redefine.
(TARGET_DEFAULT): Include TARGET_ENDIAN_DEFAULT.
* sh.c (sh_asm_named_section): Don't declare / define.
* t-linux (MULTILIB_OPTIONS): Rely on pre-set endianness option.
* config.gcc (sh-*-elf* tm_file): Add dbxelf.h elfos.h svr4.h.
(sh64-*-elf* tm_file): Likewise.
(sh-*-rtemself* tm_file): Likewise.
(sh-*-linux* tm_file): Likewise. Add sh/little.h.
(sh-*-linux* tmake_file): Add sh/t-le.
(sh-*-rtems* tm_file): Add sh/coff.h
(sh-*-* tm_file): Likewise.
* sh.h (LEGITIMATE_PIC_OPERAND_P): Check for SYMBOL_REF before using
CONSTANT_POOL_ADDRESS_P.
* coff.h (HAS_INIT_SECTION, INVOKE__MAIN): Define.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53974
138bc75d-0d04-0410-961f-
82ee72b054a4
+Tue May 28 21:16:18 2002 J"orn Rennecke <joern.rennecke@superh.com>
+ Jason R. Thorpe <thorpej@wasabisystems.com>
+
+ config/sh reorganization to factor out endianness and coff:
+
+ * config/sh/little.h: New file.
+ * config/sh/sh.h (TARGET_ENDIAN_DEFAULT): If not already
+ defined, define to 0 to select big-endian.
+ (SUBTARGET_ASM_ENDIAN_SPEC): Define according to TARGET_ENDIAN_DEFAULT.
+ (TARGET_DEFAULT): Include TARGET_ENDIAN_DEFAULT.
+ * config/sh/sh64.h (TARGET_DEFAULT): Include TARGET_ENDIAN_DEFAULT.
+ * config/sh/t-be: New file.
+ * config/sh/t-le: New file.
+
+ * sh.h (SDB_DEBUGGING_INFO, #include "dbxcoff.h"): Moved to sh/coff.h.
+ (SDB_DELIM, MAX_OFILE_ALIGNMENT, IDENT_ASM_OP): Likewise.
+ (TARGET_ASM_NAMED_SECTION, ASM_OUTPUT_SKIP): Likewise.
+ (USER_LABEL_PREFIX, LOCAL_LABEL_PREFIX): Likewise.
+ (ASM_GENERATE_INTERNAL_LABEL, ASM_OUTPUT_INTERNAL_LABEL): Likewise.
+ (ASM_OUTPUT_COMMON, ASM_OUTPUT_LOCAL): Likewise.
+ (ASM_FILE_END, ASM_DECLARE_FUNCTION_NAME): Deleted.
+ (CPP_SPEC, SUBTARGET_CPP_ENDIAN_SPEC): Likewise.
+ (SUBTARGET_CPP_SPEC, CPP_DEFAULT_CPU_SPEC, CPP_PREDEFINES): Likewise.
+ (EXTRA_SPECS): Remove SUBTARGET_CPP_ENDIAN_SPEC and
+ CPP_DEFAULT_CPU_SPEC. Add LINK_EMUL_PREFIX, LINK_DEFAULT_CPU_EMUL,
+ SUBTARGET_LINK_EMUL_SUFFIX and SUBTARGET_LINK_SPEC.
+ (LINK_SPEC): Define to SH_LINK_SPEC.
+ (TARGET_CPU_CPP_BUILTINS, SH_LINK_SPEC): Define.
+ (LINK_EMUL_PREFIX, LINK_DEFAULT_CPU_EMUL): Likewise.
+ (SUBTARGET_LINK_EMUL_SUFFIX, SUBTARGET_LINK_SPEC): Likewise.
+ (CPP_SPEC): Reduce to %(subtarget_cpp_spec).
+ (TARGET_ENDIAN_DEFAULT): Define if not already defined.
+ * config/sh/coff.h: New file.
+ (TARGET_ASM_NAMED_SECTION): Now default_coff_asm_named_section
+ (TARGET_OBJFMT_CPP_BUILTINS): Define.
+ * config/sh/elf.h (IDENT_ASM_OP): No need to #undef at the start.
+ (ASM_FILE_END, ASM_OUTPUT_SOURCE_LINE): Likewise.
+ (DBX_OUTPUT_MAIN_SOURCE_FILE_END, TARGET_ASM_NAMED_SECTION): Likewise.
+ (ASM_DECLARE_FUNCTION_NAME, MAX_OFILE_ALIGNMENT, SIZE_TYPE): Likewise.
+ (PTRDIFF_TYPE): Likewise.
+ ("dbxelf.h", "elfos.h", "svr4.h"): Don't #include.
+ (CPP_PREDEFINES): Don't define.
+ (TARGET_OBJFMT_CPP_BUILTINS): Define.
+ (LINK_SPEC): Define to SH_LINK_SPEC.
+ (LINK_EMUL_PREFIX): Redefine.
+ * config/sh/linux.h: (SUBTARGET_CPP_SPEC): Remove -fpic / -fPIC cases.
+ (SUBTARGET_CPP_ENDIAN_SPEC, CPP_DEFAULT_CPU_SPEC): Remove redefinition.
+ (CPP_PREDEFINES, SUBTARGET_ASM_ENDIAN_SPEC): Likewise.
+ (CC1_SPEC, CC1PLUS_SPEC, LINK_SPEC): Likewise.
+ (TARGET_OS_CPP_BUILTINS): Define.
+ (TARGET_DEFAULT): Redefine.
+ (SUBTARGET_LINK_EMUL_SUFFIX, SUBTARGET_LINK_SPEC): Likewise.
+ * config/sh/sh64.h (CPP_DEFAULT_CPU_SPEC): Remove.
+ (LINK_SPEC): Don't redefine.
+ (LINK_DEFAULT_CPU_EMUL): Redefine.
+ (TARGET_DEFAULT): Include TARGET_ENDIAN_DEFAULT.
+ * sh.c (sh_asm_named_section): Don't declare / define.
+ * t-linux (MULTILIB_OPTIONS): Rely on pre-set endianness option.
+ * config.gcc (sh-*-elf* tm_file): Add dbxelf.h elfos.h svr4.h.
+ (sh64-*-elf* tm_file): Likewise.
+ (sh-*-rtemself* tm_file): Likewise.
+ (sh-*-linux* tm_file): Likewise. Add sh/little.h.
+ (sh-*-linux* tmake_file): Add sh/t-le.
+ (sh-*-rtems* tm_file): Add sh/coff.h
+ (sh-*-* tm_file): Likewise.
+
+Tue May 28 21:16:18 2002 J"orn Rennecke <joern.rennecke@superh.com>
+
+ * sh.h (LEGITIMATE_PIC_OPERAND_P): Check for SYMBOL_REF before using
+ CONSTANT_POOL_ADDRESS_P.
+
+ * coff.h (HAS_INIT_SECTION, INVOKE__MAIN): Define.
+
2002-05-22 David Edelsohn <edelsohn@gnu.org>
Jeff Law <law@redhat.com>
;;
sh-*-elf*)
tmake_file="sh/t-sh sh/t-elf"
- tm_file="${tm_file} sh/embed-elf.h"
+ tm_file="${tm_file} dbxelf.h elfos.h svr4.h 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/embed-elf.h sh/sh64.h"
+ tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/embed-elf.h sh/sh64.h"
float_format=sh
extra_headers="shmedia.h ushmedia.h sshmedia.h"
# Not strictly necessary to check this, but a good idea anyway.
sh-*-rtemself*)
xm_defines=POSIX
tmake_file="sh/t-sh sh/t-elf t-rtems"
- tm_file="${tm_file} sh/embed-elf.h sh/rtemself.h rtems.h"
+ tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/embed-elf.h sh/rtemself.h rtems.h"
float_format=sh
if test x$enable_threads = xyes; then
thread_file='rtems'
sh-*-rtems*)
xm_defines=POSIX
tmake_file="sh/t-sh t-rtems"
- tm_file="${tm_file} sh/rtems.h rtems.h"
+ tm_file="${tm_file} sh/coff.h sh/rtems.h rtems.h"
float_format=sh
if test x$enable_threads = xyes; then
thread_file='rtems'
fi
;;
sh-*-linux*)
- tm_file="${tm_file} sh/elf.h sh/linux.h"
- tmake_file="sh/t-sh sh/t-elf sh/t-linux"
+ tm_file="sh/little.h ${tm_file} dbxelf.h elfos.h svr4.h sh/elf.h sh/linux.h"
+ tmake_file="sh/t-sh sh/t-elf sh/t-le sh/t-linux"
gas=yes gnu_ld=yes
if test x$enable_threads = xyes; then
thread_file='posix'
float_format=sh
;;
sh-*-*)
+ tm_file="${tm_file} sh/coff.h"
float_format=sh
;;
sparc-tti-*)
--- /dev/null
+/* Definitions of target machine for gcc for Hitachi / SuperH SH using ELF.
+ Copyright (C) 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
+ Contributed by Jörn 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. */
+
+/* Generate SDB debugging information. */
+
+#define SDB_DEBUGGING_INFO
+
+/* Output DBX (stabs) debugging information if doing -gstabs. */
+
+#include "dbxcoff.h"
+
+#define SDB_DELIM ";"
+
+#ifndef MAX_OFILE_ALIGNMENT
+#define MAX_OFILE_ALIGNMENT 128
+#endif
+
+#define IDENT_ASM_OP "\t.ident\t"
+
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION default_coff_asm_named_section
+
+/* The prefix to add to user-visible assembler symbols. */
+
+#define USER_LABEL_PREFIX "_"
+
+/* The prefix to add to an internally generated label. */
+
+#define LOCAL_LABEL_PREFIX ""
+
+/* Make an internal label into a string. */
+#define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
+ sprintf ((STRING), "*%s%s%ld", LOCAL_LABEL_PREFIX, (PREFIX), (long)(NUM))
+
+/* Output an internal label definition. */
+#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
+ asm_fprintf ((FILE), "%L%s%d:\n", (PREFIX), (NUM))
+
+/* This is how to output an assembler line
+ that says to advance the location counter by SIZE bytes. */
+
+#define ASM_OUTPUT_SKIP(FILE,SIZE) \
+ fprintf ((FILE), "\t.space %d\n", (SIZE))
+
+/* This says how to output an assembler line
+ to define a global common symbol. */
+
+#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
+( fputs ("\t.comm ", (FILE)), \
+ assemble_name ((FILE), (NAME)), \
+ fprintf ((FILE), ",%d\n", (SIZE)))
+
+/* This says how to output an assembler line
+ to define a local common symbol. */
+
+#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
+( fputs ("\t.lcomm ", (FILE)), \
+ assemble_name ((FILE), (NAME)), \
+ fprintf ((FILE), ",%d\n", (SIZE)))
+
+#define TARGET_OBJFMT_CPP_BUILTINS()
+
+/* ??? The so-called ASM_OUTPUT_SECTION_NAME cleanup from August 3rd 2001
+ broke sh-coff, and was still neither reversed not fixed eight month after
+ this has been pointed out. */
+/* Tell the braindead logic in defaults.h / libgcc2.c not to
+ refer to __EH_FRAME_BEGIN__, since we don't use crtstuff.c */
+#define HAS_INIT_SECTION
+/* And tell function.c that we don't actually have an init section. */
+#define INVOKE__MAIN
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* 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 TARGET_ASM_NAMED_SECTION
-#undef ASM_DECLARE_FUNCTION_NAME
-#undef MAX_OFILE_ALIGNMENT
-#undef SIZE_TYPE
-#undef PTRDIFF_TYPE
-
-/* Be ELF-like. */
-/* TODO: convert includes to ${tm_file} list in config.gcc. */
-#include "dbxelf.h"
-#include "elfos.h"
-#include "svr4.h"
-
-/* No SDB debugging info. */
-#undef SDB_DEBUGGING_INFO
-
/* Generate DWARF2 debugging information and make it the default */
#undef DWARF2_DEBUGGING_INFO
#define DWARF2_DEBUGGING_INFO 1
/* Let code know that this is ELF. */
-#define CPP_PREDEFINES "-D__sh__ -D__ELF__ -Acpu=sh -Amachine=sh"
+#define TARGET_OBJFMT_CPP_BUILTINS() builtin_define ("__ELF__")
#undef SIZE_TYPE
#define SIZE_TYPE (TARGET_SH5 ? "long unsigned int" : "unsigned int")
%{m5-64media:--isa=SHmedia --abi=64} %{m5-64media-nofpu:--isa=SHmedia --abi=64}"
#undef LINK_SPEC
-#define LINK_SPEC " \
-%{m5-compact:%{!ml:-m shelf32} %{ml:-m shlelf32}} \
-%{m5-compact-nofpu:%{!ml:-m shelf32} %{ml:-m shlelf32}} \
-%{m5-32media:%{!ml:-m shelf32} %{ml:-m shlelf32}} \
-%{m5-32media-nofpu:%{!ml:-m shelf32} %{ml:-m shlelf32}} \
-%{m5-64media:%{!ml:-m shelf64} %{ml:-m shlelf64}} \
-%{m5-64media-nofpu:%{!ml:-m shelf64} %{ml:-m shlelf64}} \
-%{!m5-64media:%{!m5-64media-nofpu:%{!m5-32media:%{!m5-32media-nofpu:%{!m5-compact:%{!m5-compact-nofpu:%{ml:-m shlelf}}}}}}} \
-%{mrelax:-relax}"
+#define LINK_SPEC SH_LINK_SPEC
+#undef LINK_EMUL_PREFIX
+#if TARGET_ENDIAN_DEFAULT == LITTLE_ENDIAN_BIT
+#define LINK_EMUL_PREFIX "sh%{!mb:l}elf"
+#else
+#define LINK_EMUL_PREFIX "sh%{ml:l}elf"
+#endif
/* svr4.h undefined DBX_REGISTER_NUMBER, so we need to define it
again. */
#undef SUBTARGET_CPP_SPEC
#define SUBTARGET_CPP_SPEC "\
- %{fPIC:-D__PIC__ -D__pic__} \
- %{fpic:-D__PIC__ -D__pic__} \
%{posix:-D_POSIX_SOURCE} \
%{pthread:-D_REENTRANT -D_PTHREADS} \
"
-#undef SUBTARGET_CPP_ENDIAN_SPEC
-#define SUBTARGET_CPP_ENDIAN_SPEC \
- "%{mb:-D__BIG_ENDIAN__} \
- %{!mb:-D__LITTLE_ENDIAN__}"
-
-#undef CPP_DEFAULT_CPU_SPEC
-#define CPP_DEFAULT_CPU_SPEC "-D__SH3__ -D__sh3__"
-
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-D__ELF__ -Dunix -D__sh__ -D__gnu_linux__ -Dlinux -Asystem=posix"
-
-#undef SUBTARGET_ASM_ENDIAN_SPEC
-#define SUBTARGET_ASM_ENDIAN_SPEC "%{!mb:-little}"
-
-#undef CC1_SPEC
-#define CC1_SPEC \
- "-musermode %{!mb:-ml} %{!m3e:%{!m4*:%{!m5*:-m3}}}"
-
-#undef CC1PLUS_SPEC
-#define CC1PLUS_SPEC \
- "-musermode %{!mb:-ml} %{!m3e:%{!m4:-m3}}"
-
-#undef LINK_SPEC
-#define LINK_SPEC \
- "%{!mb:-m shlelf_linux} %{mrelax:-relax} \
- %{shared:-shared} \
+#define TARGET_OS_CPP_BUILTINS() \
+do { \
+ builtin_define_std ("unix"); \
+ builtin_define ("__gnu_linux__"); \
+ builtin_define_std ("linux"); \
+ builtin_assert ("system=posix"); \
+} while (0)
+
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT \
+ (SH3_BIT|SH2_BIT|SH1_BIT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT)
+
+#undef SUBTARGET_LINK_EMUL_SUFFIX
+#define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
+#undef SUBTARGET_LINK_SPEC
+#define SUBTARGET_LINK_SPEC \
+ "%{shared:-shared} \
%{!static: \
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
--- /dev/null
+/* Definition of little endian SH machine for GNU compiler.
+
+ Copyright (C) 2002 Free Software Foundation, 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 GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#define TARGET_ENDIAN_DEFAULT LITTLE_ENDIAN_BIT
static tree sh_handle_trap_exit_attribute PARAMS ((tree *, tree, tree, int, bool *));
static void sh_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
static void sh_insert_attributes PARAMS ((tree, tree *));
-#ifndef OBJECT_FORMAT_ELF
-static void sh_asm_named_section PARAMS ((const char *, unsigned int));
-#endif
static int sh_adjust_cost PARAMS ((rtx, rtx, rtx, int));
static int sh_use_dfa_interface PARAMS ((void));
static int sh_issue_rate PARAMS ((void));
return 0;
}
-#ifndef OBJECT_FORMAT_ELF
-static void
-sh_asm_named_section (name, flags)
- const char *name;
- unsigned int flags ATTRIBUTE_UNUSED;
-{
- /* ??? Perhaps we should be using default_coff_asm_named_section. */
- fprintf (asm_out_file, "\t.section %s\n", name);
-}
-#endif /* ! OBJECT_FORMAT_ELF */
-
/* A C statement (sans semicolon) to update the integer variable COST
based on the relationship between INSN that is dependent on
DEP_INSN through the dependence LINK. The default is to make no
/* ??? No longer true. */
extern int code_for_indirect_jump_scratch;
-/* Generate SDB debugging information. */
-
-#define SDB_DEBUGGING_INFO
-
-/* Output DBX (stabs) debugging information if doing -gstabs. */
-
-#include "dbxcoff.h"
-
-#define SDB_DELIM ";"
-
-#define CPP_SPEC " \
-%{m5-64media|m5-64media-nofpu|m5-32media|m5-32media-nofpu:-D__SHMEDIA__=1} \
-%{m5-compact|m5-compact-nofpu:-D__SHMEDIA__=0} \
-%{m5-64media|m5-64media-nofpu:-D__SH5__=64 -D__LONG_MAX__=9223372036854775807L} \
-%{m5-32media|m5-32media-nofpu|m5-compact|m5-compact-nofpu:-D__SH5__=32} \
-%{m5-64media-nofpu|m5-32media-nofpu|m5-compact-nofpu:-D__SH4_NOFPU__} \
-%{m1:-D__sh1__} \
-%{m2:-D__sh2__} \
-%{m3:-D__sh3__} \
-%{m3e:-D__SH3E__} \
-%{m4-single-only:-D__SH4_SINGLE_ONLY__} \
-%{m4-single:-D__SH4_SINGLE__} \
-%{m4-nofpu:-D__sh3__ -D__SH4_NOFPU__} \
-%{m4:-D__SH4__} \
-%{!m1:%{!m2:%{!m3*:%{!m4*:%{!m5*:%(cpp_default_cpu_spec)}}}}} \
-%{mhitachi:-D__HITACHI__} \
-%(subtarget_cpp_spec) \
-%(subtarget_cpp_endian_spec) "
-
-#ifndef SUBTARGET_CPP_ENDIAN_SPEC
-#define SUBTARGET_CPP_ENDIAN_SPEC "%{ml:-D__LITTLE_ENDIAN__}"
-#endif
-
-#ifndef SUBTARGET_CPP_SPEC
-#define SUBTARGET_CPP_SPEC ""
-#endif
-
-#ifndef CPP_DEFAULT_CPU_SPEC
-#define CPP_DEFAULT_CPU_SPEC "-D__sh1__"
-#endif
-
-
-#define EXTRA_SPECS \
- { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \
- { "subtarget_cpp_endian_spec", SUBTARGET_CPP_ENDIAN_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 "%(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}"
+#define TARGET_CPU_CPP_BUILTINS() \
+do { \
+ builtin_define ("__sh__"); \
+ builtin_assert ("cpu=sh"); \
+ builtin_assert ("machine=sh"); \
+ switch ((int) sh_cpu) \
+ { \
+ case PROCESSOR_SH1: \
+ builtin_define ("__sh1__"); \
+ break; \
+ case PROCESSOR_SH2: \
+ builtin_define ("__sh2__"); \
+ break; \
+ case PROCESSOR_SH3: \
+ builtin_define ("__sh3__"); \
+ builtin_define ("__SH3__"); \
+ if (TARGET_HARD_SH4) \
+ builtin_define ("__SH4_NOFPU__"); \
+ break; \
+ case PROCESSOR_SH3E: \
+ builtin_define (TARGET_HARD_SH4 ? "__SH4_SINGLE_ONLY__" : "__SH3E__"); \
+ break; \
+ case PROCESSOR_SH4: \
+ builtin_define (TARGET_FPU_SINGLE ? "__SH4_SINGLE__" : "__SH4__"); \
+ break; \
+ case PROCESSOR_SH5: \
+ { \
+ builtin_define_with_value ("__SH5__", \
+ TARGET_SHMEDIA64 ? "64" : "32", 0); \
+ builtin_define_with_value ("__SHMEDIA__", \
+ TARGET_SHMEDIA ? "1" : "0", 0); \
+ if (! TARGET_FPU_DOUBLE) \
+ builtin_define ("__SH4_NOFPU__"); \
+ if (TARGET_SHMEDIA64) \
+ builtin_define_with_value ("__LONG_MAX__", \
+ "9223372036854775807L", 0); \
+ } \
+ } \
+ if (TARGET_HITACHI) \
+ builtin_define ("__HITACHI__"); \
+ builtin_define (TARGET_LITTLE_ENDIAN \
+ ? "__LITTLE_ENDIAN__" : "__BIG_ENDIAN__"); \
+ if (flag_pic) \
+ { \
+ builtin_define ("__pic__"); \
+ builtin_define ("__PIC__"); \
+ } \
+ TARGET_OBJFMT_CPP_BUILTINS (); \
+} while (0)
/* We can not debug without a frame pointer. */
/* #define CAN_DEBUG_WITHOUT_FP */
/* This are meant to be redefined in the host dependent files */
#define SUBTARGET_SWITCHES
-#define TARGET_DEFAULT (SH1_BIT)
+/* This defaults us to big-endian. */
+#ifndef TARGET_ENDIAN_DEFAULT
+#define TARGET_ENDIAN_DEFAULT 0
+#endif
+
+#define TARGET_DEFAULT (SH1_BIT|TARGET_ENDIAN_DEFAULT)
+
+#define CPP_SPEC " %(subtarget_cpp_spec) "
+
+#ifndef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC ""
+#endif
+
+#define EXTRA_SPECS \
+ { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \
+ { "link_emul_prefix", LINK_EMUL_PREFIX }, \
+ { "link_default_cpu_emul", LINK_DEFAULT_CPU_EMUL }, \
+ { "subtarget_link_emul_suffix", SUBTARGET_LINK_EMUL_SUFFIX }, \
+ { "subtarget_link_spec", SUBTARGET_LINK_SPEC }, \
+ { "subtarget_asm_endian_spec", SUBTARGET_ASM_ENDIAN_SPEC },
+
+#define ASM_SPEC "%(subtarget_asm_endian_spec) %{mrelax:-relax}"
+
+#ifndef SUBTARGET_ASM_ENDIAN_SPEC
+#if TARGET_ENDIAN_DEFAULT == LITTLE_ENDIAN_BIT
+#define SUBTARGET_ASM_ENDIAN_SPEC "%{mb:-big} %{!mb:-little}"
+#else
+#define SUBTARGET_ASM_ENDIAN_SPEC "%{ml:-little} %{!ml:-big}"
+#endif
+#endif
+
+#define LINK_EMUL_PREFIX "sh%{ml:l}"
+#define LINK_DEFAULT_CPU_EMUL ""
+#define SUBTARGET_LINK_EMUL_SUFFIX ""
+#define SUBTARGET_LINK_SPEC ""
+
+/* svr4.h redefines LINK_SPEC inappropriately, so go via SH_LINK_SPEC,
+ so that we can undo the damage without code replication. */
+#define LINK_SPEC SH_LINK_SPEC
+
+#define SH_LINK_SPEC "\
+-m %(link_emul_prefix)\
+%{m5-compact*|m5-32media*:32}\
+%{m5-64media*:64}\
+%{!m1:%{!m2:%{!m3*:%{!m4*:%{!m5*:%(link_default_cpu_emul)}}}}}\
+%(subtarget_link_emul_suffix) \
+%{mrelax:-relax} %(subtarget_link_spec)"
#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
do { \
&& (ALIGN) < FASTEST_ALIGNMENT) \
? FASTEST_ALIGNMENT : (ALIGN))
-#ifndef MAX_OFILE_ALIGNMENT
-#define MAX_OFILE_ALIGNMENT 128
-#endif
-
/* Make arrays of chars word-aligned for the same reasons. */
#define DATA_ALIGNMENT(TYPE, ALIGN) \
(TREE_CODE (TYPE) == ARRAY_TYPE \
nor can we indirect via the constant pool. */
#define LEGITIMATE_PIC_OPERAND_P(X) \
(! nonpic_symbol_mentioned_p (X) \
- && (! CONSTANT_POOL_ADDRESS_P (X) \
+ && (GET_CODE (X) != SYMBOL_REF \
+ || ! CONSTANT_POOL_ADDRESS_P (X) \
|| ! nonpic_symbol_mentioned_p (get_pool_constant (X))))
#define SYMBOLIC_CONST_P(X) \
#define ASM_FILE_START(STREAM) \
output_file_start (STREAM)
-#define ASM_FILE_END(STREAM)
-
#define ASM_APP_ON ""
#define ASM_APP_OFF ""
#define FILE_ASM_OP "\t.file\n"
-#define IDENT_ASM_OP "\t.ident\t"
#define SET_ASM_OP "\t.set\t"
/* How to change between sections. */
which could be text or it could be a user defined section. */
#define JUMP_TABLES_IN_TEXT_SECTION 1
-/* Switch into a generic section. */
-#define TARGET_ASM_NAMED_SECTION sh_asm_named_section
-
#undef DO_GLOBAL_CTORS_BODY
#define DO_GLOBAL_CTORS_BODY \
{ \
if ((LOG) != 0) \
fprintf ((FILE), "\t.align %d\n", (LOG))
-/* Output a function label definition. */
-#define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
- ASM_OUTPUT_LABEL((STREAM), (NAME))
-
/* Output a globalising directive for a label. */
#define ASM_GLOBALIZE_LABEL(STREAM,NAME) \
(fprintf ((STREAM), "\t.global\t"), \
assemble_name ((STREAM), (NAME)), \
fputc ('\n', (STREAM)))
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* The prefix to add to an internally generated label. */
-
-#define LOCAL_LABEL_PREFIX ""
-
-/* Make an internal label into a string. */
-#define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
- sprintf ((STRING), "*%s%s%ld", LOCAL_LABEL_PREFIX, (PREFIX), (long)(NUM))
-
-/* Output an internal label definition. */
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- asm_fprintf ((FILE), "%L%s%d:\n", (PREFIX), (NUM))
-
/* #define ASM_OUTPUT_CASE_END(STREAM,NUM,TABLE) */
/* Construct a private name. */
#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM,VALUE) \
if (TARGET_BIGTABLE) \
- asm_fprintf ((STREAM), "\t.long\t%LL%d\n", (VALUE)); \
+ asm_fprintf ((STREAM), "\t.long\t%LL%d\n", (VALUE)); \
else \
- asm_fprintf ((STREAM), "\t.word\t%LL%d\n", (VALUE)); \
-
-/* Output various types of constants. */
-
-/* Loop alignment is now done in machine_dependent_reorg, so that
- branch shortening can know about it. */
-
-/* This is how to output an assembler line
- that says to advance the location counter by SIZE bytes. */
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf ((FILE), "\t.space %d\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", (SIZE)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
+ asm_fprintf ((STREAM), "\t.word\t%LL%d\n", (VALUE));
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", (SIZE)))
\f
/* A C statement to be executed just prior to the output of
assembler code for INSN, to modify the extracted operands so
#define TARGET_VERSION \
fputs (" (SuperH SH)", stderr);
-#undef CPP_DEFAULT_CPU_SPEC
-#define CPP_DEFAULT_CPU_SPEC "-D__SH5__=32 -D__SHMEDIA__"
-
#undef ASM_SPEC
#define ASM_SPEC "%(subtarget_asm_endian_spec) %{mrelax:-relax} \
%{m5-compact*:--isa=SHcompact} \
%{!m1:%{!m2:%{!m3*:%{!m4*:%{!m5*:--isa=SHmedia --abi=32}}}}} \
"
-#undef LINK_SPEC
-#define LINK_SPEC " \
-%{m5-compact:%{!ml:-m shelf32} %{ml:-m shlelf32}} \
-%{m5-compact-nofpu:%{!ml:-m shelf32} %{ml:-m shlelf32}} \
-%{m5-32media:%{!ml:-m shelf32} %{ml:-m shlelf32}} \
-%{m5-32media-nofpu:%{!ml:-m shelf32} %{ml:-m shlelf32}} \
-%{m5-64media:%{!ml:-m shelf64} %{ml:-m shlelf64}} \
-%{m5-64media-nofpu:%{!ml:-m shelf64} %{ml:-m shlelf64}} \
-%{!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:%{!ml:-m shelf32} %{ml:-m shlelf32}}}}}}}}}}}}}}} \
-%{mrelax:-relax}"
+#undef LINK_DEFAULT_CPU_EMUL
+#define LINK_DEFAULT_CPU_EMUL "32"
#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (SH5_BIT|SH4_BIT|SH3E_BIT)
+#define TARGET_DEFAULT (SH5_BIT|SH4_BIT|SH3E_BIT|TARGET_ENDIAN_DEFAULT)
#undef SH_ELF_WCHAR_TYPE
#define SH_ELF_WCHAR_TYPE "int"
--- /dev/null
+MULTILIB_OPTIONS= ml
--- /dev/null
+MULTILIB_OPTIONS= mb
LIB2FUNCS_EXTRA=
-MULTILIB_OPTIONS= mb m3e/m4
+MULTILIB_OPTIONS += m3e/m4
MULTILIB_DIRNAMES=
MULTILIB_MATCHES =