2006-01-30 Marcin Dalecki <martin@dalecki.de>
[official-gcc.git] / gcc / config / sh / superh.h
blobf4807d809ff88355b1d121772b63befc5092862e
1 /* Definitions of target machine for gcc for Super-H using sh-superh-elf.
2 Copyright (C) 2001 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
22 /* This header file is used when the vendor name is set to 'superh'.
23 It configures the compiler for SH4 only and switches the default
24 endianess to little (although big endian is still available).
25 It also configures the spec file to the default board configuration
26 but in such a way that it can be overridden by a boardspecs file
27 (using the -specs= option). This file is expected to disable the
28 defaults and provide options --defsym _start and --defsym _stack
29 which are required by the SuperH configuration of GNU ld.
31 This file is intended to overide sh.h */
34 #ifndef _SUPERH_H
35 #define _SUPERH_H
36 #endif
39 #undef TARGET_VERSION
40 #define TARGET_VERSION fprintf (stderr, " (SuperH SH special %s)", __DATE__);
43 /* We override TARGET_PROCESSOR_SWITCHES in order to remove all the unrequired cpu options
44 and add options for all the SuperH CPU variants:
45 -m4-100 is an alias for -m4.
46 -m4-200 is an alias for -m4.
47 -m4-400 is an alias for -m4-nofpu and passes -isa=sh4-nommu-nofpu to the assembler.
48 -m4-500 is an alias for -m4-nofpu and passes -isa=sh4-nofpu to the assembler. */
49 #undef TARGET_PROCESSOR_SWITCHES
50 #define TARGET_PROCESSOR_SWITCHES \
51 {"4-500", TARGET_NONE, "SH4 500 series (FPU-less)" }, \
52 {"4-500", SELECT_SH4_NOFPU, "" }, \
53 {"4-400", TARGET_NONE, "SH4 400 series (MMU/FPU-less)" }, \
54 {"4-400", SELECT_SH4_NOFPU, "" }, \
55 {"4-200-single-only", TARGET_NONE, "SH4 200 series with double = float (SH3e ABI)" }, \
56 {"4-200-single-only", SELECT_SH4_SINGLE_ONLY, "" }, \
57 {"4-200-single", TARGET_NONE, "SH4 200 series with single precision pervading" }, \
58 {"4-200-single", SELECT_SH4_SINGLE, "" }, \
59 {"4-200-nofpu", TARGET_NONE, "SH4 200 series using soft floating point" }, \
60 {"4-200-nofpu", SELECT_SH4_NOFPU, "" }, \
61 {"4-200", TARGET_NONE, "SH4 200 series" }, \
62 {"4-200", SELECT_SH4_NOFPU, "" }, \
63 {"4-100-single-only", TARGET_NONE, "SH4 100 series with double = float (SH3e ABI)" }, \
64 {"4-100-single-only", SELECT_SH4_SINGLE_ONLY, "" }, \
65 {"4-100-single", TARGET_NONE, "SH4 100 series with single precision pervading" }, \
66 {"4-100-single", SELECT_SH4_SINGLE, "" }, \
67 {"4-100-nofpu", TARGET_NONE, "SH4 100 series using soft floating point" }, \
68 {"4-100-nofpu", SELECT_SH4_NOFPU, "" }, \
69 {"4-100", TARGET_NONE, "SH4 100 series" }, \
70 {"4-100", SELECT_SH4_NOFPU, "" }, \
71 {"4-single-only", TARGET_NONE, "Generic SH4 with double = float (SH3e ABI)" }, \
72 {"4-single-only", SELECT_SH4_SINGLE_ONLY, "" }, \
73 {"4-single", TARGET_NONE, "Generic SH4 with single precision pervading" }, \
74 {"4-single", SELECT_SH4_SINGLE, "" }, \
75 {"4-nofpu", TARGET_NONE, "Generic SH4 using soft floating point" }, \
76 {"4-nofpu", SELECT_SH4_NOFPU, "" }, \
77 {"4", TARGET_NONE, "Generic SH4 (default)" }, \
78 {"4", SELECT_SH4, "" }
81 /* Provide the -mboard= option used by the boardspecs file */
82 #undef SUBTARGET_OPTIONS
83 #define SUBTARGET_OPTIONS \
84 { "board=", &boardtype, "Board name [and momory region].", 0 }, \
85 { "runtime=", &osruntime, "Runtime name.", 0 }, \
87 /* These are required by the mboard= option and runtime= option
88 and are defined in sh.c but are not used anywhere */
89 extern const char * boardtype;
90 extern const char * osruntime;
93 /* Override the linker spec strings to use the new emulation
94 The specstrings are concatenated as follows
95 LINK_EMUL_PREFIX.(''|'32'|'64'|LINK_DEFAULT_CPU_EMUL).SUBTARGET_LINK_EMUL_SUFFIX
97 #undef LINK_EMUL_PREFIX
98 #undef SUBTARGET_LINK_EMUL_SUFFIX
100 #define LINK_EMUL_PREFIX "superh"
101 #define SUBTARGET_LINK_EMUL_SUFFIX ""
103 /* Add the SUBTARGET_LINK_SPEC to add the board and runtime support and
104 change the endianness */
105 #undef SUBTARGET_LINK_SPEC
106 #if TARGET_ENDIAN_DEFAULT == LITTLE_ENDIAN_BIT
107 #define SUBTARGET_LINK_SPEC "%(board_link) %(ldruntime) %{ml|!mb:-EL}%{mb:-EB}"
108 #else
109 #define SUBTARGET_LINK_SPEC "%(board_link) %(ldruntime) %{ml:-EL}%{mb|!ml:-EB}"
110 #endif
113 /* This is used by the link spec if the boardspecs file is not used (for whatever reason).
114 If the boardspecs file overrides this then an alternative can be used. */
115 #undef SUBTARGET_EXTRA_SPECS
116 #define SUBTARGET_EXTRA_SPECS \
117 { "board_link", "--defsym _start=0x1000 --defsym _stack=0x30000" }, \
118 { "asruntime", "" }, \
119 { "cppruntime", "-D__GDB_SIM__" }, \
120 { "cc1runtime", "" }, \
121 { "ldruntime", "" }, \
122 { "libruntime", "-lc -lgloss" }
125 /* Set the SUBTARGET_CPP_SPEC to define __EMBEDDED_CROSS__ which has an effect
126 on newlib and provide the runtime support */
127 #undef SUBTARGET_CPP_SPEC
128 #define SUBTARGET_CPP_SPEC \
129 "-D__EMBEDDED_CROSS__ %{m4-100*:-D__SH4_100__} %{m4-200*:-D__SH4_200__} %{m4-400:-D__SH4_400__} %{m4-500:-D__SH4_500__} \
130 %(cppruntime)"
132 /* Override the SUBTARGET_ASM_SPEC to add the runtime support */
133 #undef SUBTARGET_ASM_SPEC
134 #define SUBTARGET_ASM_SPEC "%{m4-100*|m4-200*:-isa=sh4} %{m4-400:-isa=sh4-nommu-nofpu} %{m4-500:-isa=sh4-nofpu} %(asruntime)"
136 /* Override the SUBTARGET_ASM_RELAX_SPEC so it doesn't interfere with the
137 runtime support by adding -isa=sh4 in the wrong place. */
138 #undef SUBTARGET_ASM_RELAX_SPEC
139 #define SUBTARGET_ASM_RELAX_SPEC "%{!m4-100*:%{!m4-200*:%{!m4-400:%{!m4-500:-isa=sh4}}}}"
141 /* Create the CC1_SPEC to add the runtime support */
142 #undef CC1_SPEC
143 #define CC1_SPEC "%(cc1runtime)"
145 #undef CC1PLUS_SPEC
146 #define CC1PLUS_SPEC "%(cc1runtime)"
149 /* Override the LIB_SPEC to add the runtime support */
150 #undef LIB_SPEC
151 #define LIB_SPEC "%{!shared:%{!symbolic:%(libruntime) -lc}} %{pg:-lprofile -lc}"