Commit f1a58d92 by J"orn Rennecke Committed by Joern Rennecke

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.


	* sh.h (LEGITIMATE_PIC_OPERAND_P): Check for SYMBOL_REF before using
	CONSTANT_POOL_ADDRESS_P.

	* coff.h (HAS_INIT_SECTION, INVOKE__MAIN): Define.

Co-Authored-By: Jason R. Thorpe <thorpej@wasabisystems.com>

From-SVN: r53974
parent 33a3dfc4
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> 2002-05-22 David Edelsohn <edelsohn@gnu.org>
Jeff Law <law@redhat.com> Jeff Law <law@redhat.com>
......
...@@ -2207,12 +2207,12 @@ s390x-*-linux*) ...@@ -2207,12 +2207,12 @@ s390x-*-linux*)
;; ;;
sh-*-elf*) sh-*-elf*)
tmake_file="sh/t-sh sh/t-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 float_format=sh
;; ;;
sh64-*-elf*) sh64-*-elf*)
tmake_file="sh/t-sh sh/t-elf sh/t-sh64" 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 float_format=sh
extra_headers="shmedia.h ushmedia.h sshmedia.h" extra_headers="shmedia.h ushmedia.h sshmedia.h"
# Not strictly necessary to check this, but a good idea anyway. # Not strictly necessary to check this, but a good idea anyway.
...@@ -2223,7 +2223,7 @@ sh64-*-elf*) ...@@ -2223,7 +2223,7 @@ sh64-*-elf*)
sh-*-rtemself*) sh-*-rtemself*)
xm_defines=POSIX xm_defines=POSIX
tmake_file="sh/t-sh sh/t-elf t-rtems" 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 float_format=sh
if test x$enable_threads = xyes; then if test x$enable_threads = xyes; then
thread_file='rtems' thread_file='rtems'
...@@ -2232,15 +2232,15 @@ sh-*-rtemself*) ...@@ -2232,15 +2232,15 @@ sh-*-rtemself*)
sh-*-rtems*) sh-*-rtems*)
xm_defines=POSIX xm_defines=POSIX
tmake_file="sh/t-sh t-rtems" 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 float_format=sh
if test x$enable_threads = xyes; then if test x$enable_threads = xyes; then
thread_file='rtems' thread_file='rtems'
fi fi
;; ;;
sh-*-linux*) sh-*-linux*)
tm_file="${tm_file} sh/elf.h sh/linux.h" 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-linux" tmake_file="sh/t-sh sh/t-elf sh/t-le sh/t-linux"
gas=yes gnu_ld=yes gas=yes gnu_ld=yes
if test x$enable_threads = xyes; then if test x$enable_threads = xyes; then
thread_file='posix' thread_file='posix'
...@@ -2248,6 +2248,7 @@ sh-*-linux*) ...@@ -2248,6 +2248,7 @@ sh-*-linux*)
float_format=sh float_format=sh
;; ;;
sh-*-*) sh-*-*)
tm_file="${tm_file} sh/coff.h"
float_format=sh float_format=sh
;; ;;
sparc-tti-*) sparc-tti-*)
......
/* 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
...@@ -19,26 +19,6 @@ along with GNU CC; see the file COPYING. If not, write to ...@@ -19,26 +19,6 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ 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 */ /* Generate DWARF2 debugging information and make it the default */
#undef DWARF2_DEBUGGING_INFO #undef DWARF2_DEBUGGING_INFO
#define DWARF2_DEBUGGING_INFO 1 #define DWARF2_DEBUGGING_INFO 1
...@@ -82,7 +62,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -82,7 +62,7 @@ Boston, MA 02111-1307, USA. */
/* Let code know that this is ELF. */ /* 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 #undef SIZE_TYPE
#define SIZE_TYPE (TARGET_SH5 ? "long unsigned int" : "unsigned int") #define SIZE_TYPE (TARGET_SH5 ? "long unsigned int" : "unsigned int")
...@@ -97,15 +77,13 @@ Boston, MA 02111-1307, USA. */ ...@@ -97,15 +77,13 @@ Boston, MA 02111-1307, USA. */
%{m5-64media:--isa=SHmedia --abi=64} %{m5-64media-nofpu:--isa=SHmedia --abi=64}" %{m5-64media:--isa=SHmedia --abi=64} %{m5-64media-nofpu:--isa=SHmedia --abi=64}"
#undef LINK_SPEC #undef LINK_SPEC
#define LINK_SPEC " \ #define LINK_SPEC SH_LINK_SPEC
%{m5-compact:%{!ml:-m shelf32} %{ml:-m shlelf32}} \ #undef LINK_EMUL_PREFIX
%{m5-compact-nofpu:%{!ml:-m shelf32} %{ml:-m shlelf32}} \ #if TARGET_ENDIAN_DEFAULT == LITTLE_ENDIAN_BIT
%{m5-32media:%{!ml:-m shelf32} %{ml:-m shlelf32}} \ #define LINK_EMUL_PREFIX "sh%{!mb:l}elf"
%{m5-32media-nofpu:%{!ml:-m shelf32} %{ml:-m shlelf32}} \ #else
%{m5-64media:%{!ml:-m shelf64} %{ml:-m shlelf64}} \ #define LINK_EMUL_PREFIX "sh%{ml:l}elf"
%{m5-64media-nofpu:%{!ml:-m shelf64} %{ml:-m shlelf64}} \ #endif
%{!m5-64media:%{!m5-64media-nofpu:%{!m5-32media:%{!m5-32media-nofpu:%{!m5-compact:%{!m5-compact-nofpu:%{ml:-m shlelf}}}}}}} \
%{mrelax:-relax}"
/* svr4.h undefined DBX_REGISTER_NUMBER, so we need to define it /* svr4.h undefined DBX_REGISTER_NUMBER, so we need to define it
again. */ again. */
......
...@@ -25,39 +25,27 @@ Boston, MA 02111-1307, USA. */ ...@@ -25,39 +25,27 @@ Boston, MA 02111-1307, USA. */
#undef SUBTARGET_CPP_SPEC #undef SUBTARGET_CPP_SPEC
#define SUBTARGET_CPP_SPEC "\ #define SUBTARGET_CPP_SPEC "\
%{fPIC:-D__PIC__ -D__pic__} \
%{fpic:-D__PIC__ -D__pic__} \
%{posix:-D_POSIX_SOURCE} \ %{posix:-D_POSIX_SOURCE} \
%{pthread:-D_REENTRANT -D_PTHREADS} \ %{pthread:-D_REENTRANT -D_PTHREADS} \
" "
#undef SUBTARGET_CPP_ENDIAN_SPEC #define TARGET_OS_CPP_BUILTINS() \
#define SUBTARGET_CPP_ENDIAN_SPEC \ do { \
"%{mb:-D__BIG_ENDIAN__} \ builtin_define_std ("unix"); \
%{!mb:-D__LITTLE_ENDIAN__}" builtin_define ("__gnu_linux__"); \
builtin_define_std ("linux"); \
#undef CPP_DEFAULT_CPU_SPEC builtin_assert ("system=posix"); \
#define CPP_DEFAULT_CPU_SPEC "-D__SH3__ -D__sh3__" } while (0)
#undef TARGET_DEFAULT
#undef CPP_PREDEFINES #define TARGET_DEFAULT \
#define CPP_PREDEFINES "-D__ELF__ -Dunix -D__sh__ -D__gnu_linux__ -Dlinux -Asystem=posix" (SH3_BIT|SH2_BIT|SH1_BIT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT)
#undef SUBTARGET_ASM_ENDIAN_SPEC #undef SUBTARGET_LINK_EMUL_SUFFIX
#define SUBTARGET_ASM_ENDIAN_SPEC "%{!mb:-little}" #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
#undef SUBTARGET_LINK_SPEC
#undef CC1_SPEC #define SUBTARGET_LINK_SPEC \
#define CC1_SPEC \ "%{shared:-shared} \
"-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} \
%{!static: \ %{!static: \
%{rdynamic:-export-dynamic} \ %{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
......
/* 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
...@@ -193,9 +193,6 @@ static tree sh_handle_sp_switch_attribute PARAMS ((tree *, tree, tree, int, bool ...@@ -193,9 +193,6 @@ static tree sh_handle_sp_switch_attribute PARAMS ((tree *, tree, tree, int, bool
static tree sh_handle_trap_exit_attribute PARAMS ((tree *, tree, tree, int, bool *)); 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_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
static void sh_insert_attributes PARAMS ((tree, tree *)); 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_adjust_cost PARAMS ((rtx, rtx, rtx, int));
static int sh_use_dfa_interface PARAMS ((void)); static int sh_use_dfa_interface PARAMS ((void));
static int sh_issue_rate PARAMS ((void)); static int sh_issue_rate PARAMS ((void));
...@@ -6678,17 +6675,6 @@ sh_can_redirect_branch (branch1, branch2) ...@@ -6678,17 +6675,6 @@ sh_can_redirect_branch (branch1, branch2)
return 0; 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 /* A C statement (sans semicolon) to update the integer variable COST
based on the relationship between INSN that is dependent on based on the relationship between INSN that is dependent on
DEP_INSN through the dependence LINK. The default is to make no DEP_INSN through the dependence LINK. The default is to make no
......
...@@ -32,63 +32,55 @@ Boston, MA 02111-1307, USA. */ ...@@ -32,63 +32,55 @@ Boston, MA 02111-1307, USA. */
/* ??? No longer true. */ /* ??? No longer true. */
extern int code_for_indirect_jump_scratch; extern int code_for_indirect_jump_scratch;
/* Generate SDB debugging information. */ #define TARGET_CPU_CPP_BUILTINS() \
do { \
#define SDB_DEBUGGING_INFO builtin_define ("__sh__"); \
builtin_assert ("cpu=sh"); \
/* Output DBX (stabs) debugging information if doing -gstabs. */ builtin_assert ("machine=sh"); \
switch ((int) sh_cpu) \
#include "dbxcoff.h" { \
case PROCESSOR_SH1: \
#define SDB_DELIM ";" builtin_define ("__sh1__"); \
break; \
#define CPP_SPEC " \ case PROCESSOR_SH2: \
%{m5-64media|m5-64media-nofpu|m5-32media|m5-32media-nofpu:-D__SHMEDIA__=1} \ builtin_define ("__sh2__"); \
%{m5-compact|m5-compact-nofpu:-D__SHMEDIA__=0} \ break; \
%{m5-64media|m5-64media-nofpu:-D__SH5__=64 -D__LONG_MAX__=9223372036854775807L} \ case PROCESSOR_SH3: \
%{m5-32media|m5-32media-nofpu|m5-compact|m5-compact-nofpu:-D__SH5__=32} \ builtin_define ("__sh3__"); \
%{m5-64media-nofpu|m5-32media-nofpu|m5-compact-nofpu:-D__SH4_NOFPU__} \ builtin_define ("__SH3__"); \
%{m1:-D__sh1__} \ if (TARGET_HARD_SH4) \
%{m2:-D__sh2__} \ builtin_define ("__SH4_NOFPU__"); \
%{m3:-D__sh3__} \ break; \
%{m3e:-D__SH3E__} \ case PROCESSOR_SH3E: \
%{m4-single-only:-D__SH4_SINGLE_ONLY__} \ builtin_define (TARGET_HARD_SH4 ? "__SH4_SINGLE_ONLY__" : "__SH3E__"); \
%{m4-single:-D__SH4_SINGLE__} \ break; \
%{m4-nofpu:-D__sh3__ -D__SH4_NOFPU__} \ case PROCESSOR_SH4: \
%{m4:-D__SH4__} \ builtin_define (TARGET_FPU_SINGLE ? "__SH4_SINGLE__" : "__SH4__"); \
%{!m1:%{!m2:%{!m3*:%{!m4*:%{!m5*:%(cpp_default_cpu_spec)}}}}} \ break; \
%{mhitachi:-D__HITACHI__} \ case PROCESSOR_SH5: \
%(subtarget_cpp_spec) \ { \
%(subtarget_cpp_endian_spec) " builtin_define_with_value ("__SH5__", \
TARGET_SHMEDIA64 ? "64" : "32", 0); \
#ifndef SUBTARGET_CPP_ENDIAN_SPEC builtin_define_with_value ("__SHMEDIA__", \
#define SUBTARGET_CPP_ENDIAN_SPEC "%{ml:-D__LITTLE_ENDIAN__}" TARGET_SHMEDIA ? "1" : "0", 0); \
#endif if (! TARGET_FPU_DOUBLE) \
builtin_define ("__SH4_NOFPU__"); \
#ifndef SUBTARGET_CPP_SPEC if (TARGET_SHMEDIA64) \
#define SUBTARGET_CPP_SPEC "" builtin_define_with_value ("__LONG_MAX__", \
#endif "9223372036854775807L", 0); \
} \
#ifndef CPP_DEFAULT_CPU_SPEC } \
#define CPP_DEFAULT_CPU_SPEC "-D__sh1__" if (TARGET_HITACHI) \
#endif builtin_define ("__HITACHI__"); \
builtin_define (TARGET_LITTLE_ENDIAN \
? "__LITTLE_ENDIAN__" : "__BIG_ENDIAN__"); \
#define EXTRA_SPECS \ if (flag_pic) \
{ "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \ { \
{ "subtarget_cpp_endian_spec", SUBTARGET_CPP_ENDIAN_SPEC }, \ builtin_define ("__pic__"); \
{ "cpp_default_cpu_spec", CPP_DEFAULT_CPU_SPEC }, \ builtin_define ("__PIC__"); \
{ "subtarget_asm_endian_spec", SUBTARGET_ASM_ENDIAN_SPEC }, } \
TARGET_OBJFMT_CPP_BUILTINS (); \
#define CPP_PREDEFINES "-D__sh__ -Acpu=sh -Amachine=sh" } while (0)
#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}"
/* We can not debug without a frame pointer. */ /* We can not debug without a frame pointer. */
/* #define CAN_DEBUG_WITHOUT_FP */ /* #define CAN_DEBUG_WITHOUT_FP */
...@@ -315,7 +307,53 @@ extern int target_flags; ...@@ -315,7 +307,53 @@ extern int target_flags;
/* This are meant to be redefined in the host dependent files */ /* This are meant to be redefined in the host dependent files */
#define SUBTARGET_SWITCHES #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) \ #define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
do { \ do { \
...@@ -486,10 +524,6 @@ do { \ ...@@ -486,10 +524,6 @@ do { \
&& (ALIGN) < FASTEST_ALIGNMENT) \ && (ALIGN) < FASTEST_ALIGNMENT) \
? FASTEST_ALIGNMENT : (ALIGN)) ? FASTEST_ALIGNMENT : (ALIGN))
#ifndef MAX_OFILE_ALIGNMENT
#define MAX_OFILE_ALIGNMENT 128
#endif
/* Make arrays of chars word-aligned for the same reasons. */ /* Make arrays of chars word-aligned for the same reasons. */
#define DATA_ALIGNMENT(TYPE, ALIGN) \ #define DATA_ALIGNMENT(TYPE, ALIGN) \
(TREE_CODE (TYPE) == ARRAY_TYPE \ (TREE_CODE (TYPE) == ARRAY_TYPE \
...@@ -2686,7 +2720,8 @@ while (0) ...@@ -2686,7 +2720,8 @@ while (0)
nor can we indirect via the constant pool. */ nor can we indirect via the constant pool. */
#define LEGITIMATE_PIC_OPERAND_P(X) \ #define LEGITIMATE_PIC_OPERAND_P(X) \
(! nonpic_symbol_mentioned_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)))) || ! nonpic_symbol_mentioned_p (get_pool_constant (X))))
#define SYMBOLIC_CONST_P(X) \ #define SYMBOLIC_CONST_P(X) \
...@@ -2758,12 +2793,9 @@ while (0) ...@@ -2758,12 +2793,9 @@ while (0)
#define ASM_FILE_START(STREAM) \ #define ASM_FILE_START(STREAM) \
output_file_start (STREAM) output_file_start (STREAM)
#define ASM_FILE_END(STREAM)
#define ASM_APP_ON "" #define ASM_APP_ON ""
#define ASM_APP_OFF "" #define ASM_APP_OFF ""
#define FILE_ASM_OP "\t.file\n" #define FILE_ASM_OP "\t.file\n"
#define IDENT_ASM_OP "\t.ident\t"
#define SET_ASM_OP "\t.set\t" #define SET_ASM_OP "\t.set\t"
/* How to change between sections. */ /* How to change between sections. */
...@@ -2810,9 +2842,6 @@ while (0) ...@@ -2810,9 +2842,6 @@ while (0)
which could be text or it could be a user defined section. */ which could be text or it could be a user defined section. */
#define JUMP_TABLES_IN_TEXT_SECTION 1 #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 #undef DO_GLOBAL_CTORS_BODY
#define DO_GLOBAL_CTORS_BODY \ #define DO_GLOBAL_CTORS_BODY \
{ \ { \
...@@ -2915,32 +2944,12 @@ while (0) ...@@ -2915,32 +2944,12 @@ while (0)
if ((LOG) != 0) \ if ((LOG) != 0) \
fprintf ((FILE), "\t.align %d\n", (LOG)) 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. */ /* Output a globalising directive for a label. */
#define ASM_GLOBALIZE_LABEL(STREAM,NAME) \ #define ASM_GLOBALIZE_LABEL(STREAM,NAME) \
(fprintf ((STREAM), "\t.global\t"), \ (fprintf ((STREAM), "\t.global\t"), \
assemble_name ((STREAM), (NAME)), \ assemble_name ((STREAM), (NAME)), \
fputc ('\n', (STREAM))) 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) */ /* #define ASM_OUTPUT_CASE_END(STREAM,NUM,TABLE) */
/* Construct a private name. */ /* Construct a private name. */
...@@ -2990,34 +2999,8 @@ while (0) ...@@ -2990,34 +2999,8 @@ while (0)
if (TARGET_BIGTABLE) \ if (TARGET_BIGTABLE) \
asm_fprintf ((STREAM), "\t.long\t%LL%d\n", (VALUE)); \ asm_fprintf ((STREAM), "\t.long\t%LL%d\n", (VALUE)); \
else \ else \
asm_fprintf ((STREAM), "\t.word\t%LL%d\n", (VALUE)); \ 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. */
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
( fputs ("\t.lcomm ", (FILE)), \
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ",%d\n", (SIZE)))
/* A C statement to be executed just prior to the output of /* A C statement to be executed just prior to the output of
assembler code for INSN, to modify the extracted operands so assembler code for INSN, to modify the extracted operands so
......
...@@ -23,9 +23,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -23,9 +23,6 @@ Boston, MA 02111-1307, USA. */
#define TARGET_VERSION \ #define TARGET_VERSION \
fputs (" (SuperH SH)", stderr); fputs (" (SuperH SH)", stderr);
#undef CPP_DEFAULT_CPU_SPEC
#define CPP_DEFAULT_CPU_SPEC "-D__SH5__=32 -D__SHMEDIA__"
#undef ASM_SPEC #undef ASM_SPEC
#define ASM_SPEC "%(subtarget_asm_endian_spec) %{mrelax:-relax} \ #define ASM_SPEC "%(subtarget_asm_endian_spec) %{mrelax:-relax} \
%{m5-compact*:--isa=SHcompact} \ %{m5-compact*:--isa=SHcompact} \
...@@ -34,19 +31,11 @@ Boston, MA 02111-1307, USA. */ ...@@ -34,19 +31,11 @@ Boston, MA 02111-1307, USA. */
%{!m1:%{!m2:%{!m3*:%{!m4*:%{!m5*:--isa=SHmedia --abi=32}}}}} \ %{!m1:%{!m2:%{!m3*:%{!m4*:%{!m5*:--isa=SHmedia --abi=32}}}}} \
" "
#undef LINK_SPEC #undef LINK_DEFAULT_CPU_EMUL
#define LINK_SPEC " \ #define LINK_DEFAULT_CPU_EMUL "32"
%{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 TARGET_DEFAULT #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 #undef SH_ELF_WCHAR_TYPE
#define SH_ELF_WCHAR_TYPE "int" #define SH_ELF_WCHAR_TYPE "int"
MULTILIB_OPTIONS= ml
MULTILIB_OPTIONS= mb
...@@ -3,7 +3,7 @@ LIB1ASMFUNCS_CACHE = _ic_invalidate ...@@ -3,7 +3,7 @@ LIB1ASMFUNCS_CACHE = _ic_invalidate
LIB2FUNCS_EXTRA= LIB2FUNCS_EXTRA=
MULTILIB_OPTIONS= mb m3e/m4 MULTILIB_OPTIONS += m3e/m4
MULTILIB_DIRNAMES= MULTILIB_DIRNAMES=
MULTILIB_MATCHES = MULTILIB_MATCHES =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment