Introduce sh2a support.
[gcc.git] / gcc / config / sh / elf.h
1 /* Definitions of target machine for gcc for Renesas / SuperH SH using ELF.
2 Copyright (C) 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc.
3 Contributed by Ian Lance Taylor <ian@cygnus.com>.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 /* Let sh.c know this is ELF. */
23 #undef TARGET_ELF
24 #define TARGET_ELF 1
25
26 /* Generate DWARF2 debugging information and make it the default */
27 #define DWARF2_DEBUGGING_INFO 1
28
29 #undef PREFERRED_DEBUGGING_TYPE
30 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
31
32 /* use a more compact format for line information */
33 #define DWARF2_ASM_LINE_DEBUG_INFO 1
34
35 /* WCHAR_TYPE / WCHAR_TYPE_SIZE are defined to long int / BITS_PER_WORD in
36 svr4.h, but these work out as 64 bit for shmedia64. */
37 #undef WCHAR_TYPE
38 /* #define WCHAR_TYPE (TARGET_SH5 ? "int" : "long int") */
39 #define WCHAR_TYPE SH_ELF_WCHAR_TYPE
40
41 #undef WCHAR_TYPE_SIZE
42 #define WCHAR_TYPE_SIZE 32
43
44
45 /* The prefix to add to user-visible assembler symbols. */
46
47 #undef LOCAL_LABEL_PREFIX
48 #define LOCAL_LABEL_PREFIX "."
49
50 #undef SIZE_TYPE
51 #define SIZE_TYPE (TARGET_SH5 ? "long unsigned int" : "unsigned int")
52
53 #undef PTRDIFF_TYPE
54 #define PTRDIFF_TYPE (TARGET_SH5 ? "long int" : "int")
55
56 /* Pass -ml and -mrelax to the assembler and linker. */
57 #undef ASM_SPEC
58 #define ASM_SPEC SH_ASM_SPEC
59 #undef SUBTARGET_ASM_ISA_SPEC
60 #define SUBTARGET_ASM_ISA_SPEC "\
61 %{m2a:--isa=sh2a} \
62 %{m2a-single:--isa=sh2a} \
63 %{m2a-single-only:--isa=sh2a} \
64 %{m2a-nofpu:--isa=sh2a-nofpu} \
65 %{m5-compact*:--isa=SHcompact} %{m5-32media*:--isa=SHmedia --abi=32} \
66 %{m5-64media*:--isa=SHmedia --abi=64}" ASM_ISA_DEFAULT_SPEC
67
68 #undef LINK_SPEC
69 #define LINK_SPEC SH_LINK_SPEC
70 #undef LINK_EMUL_PREFIX
71 #if TARGET_ENDIAN_DEFAULT == LITTLE_ENDIAN_BIT
72 #define LINK_EMUL_PREFIX "sh%{!mb:l}elf"
73 #else
74 #define LINK_EMUL_PREFIX "sh%{ml:l}elf"
75 #endif
76
77 /* svr4.h undefined DBX_REGISTER_NUMBER, so we need to define it
78 again. */
79 #define DBX_REGISTER_NUMBER(REGNO) SH_DBX_REGISTER_NUMBER (REGNO)
80
81 #undef ASM_GENERATE_INTERNAL_LABEL
82 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
83 sprintf ((STRING), "*%s%s%ld", LOCAL_LABEL_PREFIX, (PREFIX), (long)(NUM))
84
85 #undef ASM_OUTPUT_SOURCE_LINE
86 #define ASM_OUTPUT_SOURCE_LINE(file, line, counter) \
87 do \
88 { \
89 asm_fprintf ((file), ".stabn 68,0,%d,%LLM%d-", \
90 (line), (counter)); \
91 assemble_name ((file), \
92 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
93 asm_fprintf ((file), "\n%LLM%d:\n", (counter)); \
94 } \
95 while (0)
96
97 #undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
98 #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
99 do { \
100 text_section (); \
101 asm_fprintf ((FILE), "\t.stabs \"\",%d,0,0,%LLetext\n%LLetext:\n", N_SO); \
102 } while (0)
103
104 #undef STARTFILE_SPEC
105 #define STARTFILE_SPEC \
106 "%{!shared: crt1.o%s} crti.o%s \
107 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
108
109 #undef ENDFILE_SPEC
110 #define ENDFILE_SPEC \
111 "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
112
113 /* ASM_OUTPUT_CASE_LABEL is defined in elfos.h. With it,
114 a redundant .align was generated. */
115 #undef ASM_OUTPUT_CASE_LABEL