OSDN Git Service

2008-11-09 Thomas Schwinge <tschwinge@gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / config / sh / superh.h
1 /* Definitions of target machine for gcc for Super-H using sh-superh-elf.
2    Copyright (C) 2001, 2006, 2007 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
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 3, or (at your option)
9 any later version.
10
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.
15
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3.  If not see
18 <http://www.gnu.org/licenses/>.  */
19
20
21 /* This header file is used when the vendor name is set to 'superh'.
22    config.gcc already configured the compiler for SH4 only and switched
23    the default endianess to little (although big endian is still available).
24    This file configures the spec file to the default board configuration
25    but in such a way that it can be overridden by a boardspecs file
26    (using the -specs= option). This file is expected to disable the
27    defaults and provide options --defsym _start and --defsym _stack
28    which are required by the SuperH configuration of GNU ld.
29
30    This file is intended to override sh.h.  */
31
32
33 #ifndef _SUPERH_H
34 #define _SUPERH_H
35 #endif
36
37
38 #undef TARGET_VERSION
39 #define TARGET_VERSION fprintf (stderr, " (SuperH SH special %s)", __DATE__);
40
41 /* Override the linker spec strings to use the new emulation
42    The specstrings are concatenated as follows
43    LINK_EMUL_PREFIX.(''|'32'|'64'|LINK_DEFAULT_CPU_EMUL).SUBTARGET_LINK_EMUL_SUFFIX
44 */
45 #undef LINK_EMUL_PREFIX
46 #undef SUBTARGET_LINK_EMUL_SUFFIX
47
48 #define LINK_EMUL_PREFIX "superh"
49 #define SUBTARGET_LINK_EMUL_SUFFIX ""
50
51 /* Add the SUBTARGET_LINK_SPEC to add the board and runtime support and
52    change the endianness */
53 #undef SUBTARGET_LINK_SPEC
54 #if  TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN
55 #define SUBTARGET_LINK_SPEC "%(board_link) %(ldruntime) %{ml|!mb:-EL}%{mb:-EB}"
56 #else
57 #define SUBTARGET_LINK_SPEC "%(board_link) %(ldruntime) %{ml:-EL}%{mb|!ml:-EB}"
58 #endif
59
60
61 /* This is used by the link spec if the boardspecs file is not used (for whatever reason).
62    If the boardspecs file overrides this then an alternative can be used. */
63 #undef SUBTARGET_EXTRA_SPECS
64 #define SUBTARGET_EXTRA_SPECS \
65 { "board_link", "--defsym _start=0x1000 --defsym _stack=0x30000" }, \
66 { "asruntime", "" }, \
67 { "cppruntime", "-D__GDB_SIM__" }, \
68 { "cc1runtime", "" }, \
69 { "ldruntime", "" }, \
70 { "libruntime", "-lc -lgloss" }
71
72
73 /* Set the SUBTARGET_CPP_SPEC to define __EMBEDDED_CROSS__ which has an effect
74    on newlib and provide the runtime support */
75 #undef SUBTARGET_CPP_SPEC
76 #define SUBTARGET_CPP_SPEC \
77 "-D__EMBEDDED_CROSS__ %{m4-100*:-D__SH4_100__} %{m4-200*:-D__SH4_200__} %{m4-300*:-D__SH4_300__} %{m4-340:-D__SH4_340__} %{m4-400:-D__SH4_400__} %{m4-500:-D__SH4_500__} \
78 %(cppruntime)"
79
80 /* Override the SUBTARGET_ASM_SPEC to add the runtime support */
81 #undef SUBTARGET_ASM_SPEC
82 #define SUBTARGET_ASM_SPEC "%{m4-100*|m4-200*:-isa=sh4} %{m4-400|m4-340:-isa=sh4-nommu-nofpu} %{m4-500:-isa=sh4-nofpu} %(asruntime)"
83
84 /* Override the SUBTARGET_ASM_RELAX_SPEC so it doesn't interfere with the
85    runtime support by adding -isa=sh4 in the wrong place.  */
86 #undef SUBTARGET_ASM_RELAX_SPEC
87 #define SUBTARGET_ASM_RELAX_SPEC "%{!m4-100*:%{!m4-200*:%{!m4-300*:%{!m4-340:%{!m4-400:%{!m4-500:-isa=sh4}}}}}}"
88
89 /* Create the CC1_SPEC to add the runtime support */
90 #undef CC1_SPEC
91 #define CC1_SPEC "%(cc1runtime)"
92
93 #undef CC1PLUS_SPEC
94 #define CC1PLUS_SPEC "%(cc1runtime)"
95
96
97 /* Override the LIB_SPEC to add the runtime support */
98 #undef LIB_SPEC
99 #define LIB_SPEC "%{!shared:%{!symbolic:%(libruntime) -lc}} %{pg:-lprofile -lc}"
100
101 /* Override STARTFILE_SPEC to add profiling and MMU support.  */
102 #undef STARTFILE_SPEC
103 #define STARTFILE_SPEC \
104   "%{!shared: %{!m4-400*:%{!m4-340*: %{pg:gcrt1-mmu.o%s}%{!pg:crt1-mmu.o%s}}}} \
105    %{!shared: %{m4-340*|m4-400*: %{pg:gcrt1.o%s}%{!pg:crt1.o%s}}} \
106    crti.o%s \
107    %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"