]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/sh/elf.h
config/sh reorganization to factor out endianness and coff:
[thirdparty/gcc.git] / gcc / config / sh / elf.h
1 /* Definitions of target machine for gcc for Hitachi / 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 GNU CC.
6
7 GNU CC 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 GNU CC 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 GNU CC; 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 /* Generate DWARF2 debugging information and make it the default */
23 #undef DWARF2_DEBUGGING_INFO
24 #define DWARF2_DEBUGGING_INFO 1
25
26 #undef PREFERRED_DEBUGGING_TYPE
27 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
28
29 /* use a more compact format for line information */
30 #define DWARF2_ASM_LINE_DEBUG_INFO 1
31
32 /* WCHAR_TYPE / WCHAR_TYPE_SIZE are defined to long int / BITS_PER_WORD in
33 svr4.h, but these work out as 64 bit for shmedia64. */
34 #undef WCHAR_TYPE
35 /* #define WCHAR_TYPE (TARGET_SH5 ? "int" : "long int") */
36 #define WCHAR_TYPE SH_ELF_WCHAR_TYPE
37
38 #undef WCHAR_TYPE_SIZE
39 #define WCHAR_TYPE_SIZE 32
40
41
42 /* The prefix to add to user-visible assembler symbols. */
43
44 #undef LOCAL_LABEL_PREFIX
45 #define LOCAL_LABEL_PREFIX "."
46
47 #undef ASM_FILE_START
48 #define ASM_FILE_START(FILE) do { \
49 output_file_directive ((FILE), main_input_filename); \
50 /* We also need to show the text section with the proper \
51 attributes as in TEXT_SECTION_ASM_OP, before dwarf2out \
52 emits it without attributes in TEXT_SECTION, else GAS \
53 will complain. We can teach GAS specifically about the \
54 default attributes for our choice of text section, but \
55 then we would have to change GAS again if/when we change \
56 the text section name. */ \
57 fprintf ((FILE), "%s\n", TEXT_SECTION_ASM_OP); \
58 if (TARGET_LITTLE_ENDIAN) \
59 fprintf ((FILE), "\t.little\n"); \
60 } while (0)
61
62
63
64 /* Let code know that this is ELF. */
65 #define TARGET_OBJFMT_CPP_BUILTINS() builtin_define ("__ELF__")
66
67 #undef SIZE_TYPE
68 #define SIZE_TYPE (TARGET_SH5 ? "long unsigned int" : "unsigned int")
69
70 #undef PTRDIFF_TYPE
71 #define PTRDIFF_TYPE (TARGET_SH5 ? "long int" : "int")
72 /* Pass -ml and -mrelax to the assembler and linker. */
73 #undef ASM_SPEC
74 #define ASM_SPEC "%{ml:-little} %{mrelax:-relax} \
75 %{m5-compact:--isa=SHcompact} %{m5-compact-nofpu:--isa=SHcompact} \
76 %{m5-32media:--isa=SHmedia --abi=32} %{m5-32media-nofpu:--isa=SHmedia --abi=32} \
77 %{m5-64media:--isa=SHmedia --abi=64} %{m5-64media-nofpu:--isa=SHmedia --abi=64}"
78
79 #undef LINK_SPEC
80 #define LINK_SPEC SH_LINK_SPEC
81 #undef LINK_EMUL_PREFIX
82 #if TARGET_ENDIAN_DEFAULT == LITTLE_ENDIAN_BIT
83 #define LINK_EMUL_PREFIX "sh%{!mb:l}elf"
84 #else
85 #define LINK_EMUL_PREFIX "sh%{ml:l}elf"
86 #endif
87
88 /* svr4.h undefined DBX_REGISTER_NUMBER, so we need to define it
89 again. */
90 #define DBX_REGISTER_NUMBER(REGNO) SH_DBX_REGISTER_NUMBER (REGNO)
91
92 #undef ASM_GENERATE_INTERNAL_LABEL
93 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
94 sprintf ((STRING), "*%s%s%ld", LOCAL_LABEL_PREFIX, (PREFIX), (long)(NUM))
95
96 #undef ASM_OUTPUT_INTERNAL_LABEL
97 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
98 asm_fprintf ((FILE), "%L%s%d:\n", (PREFIX), (NUM))
99
100 #undef ASM_OUTPUT_SOURCE_LINE
101 #define ASM_OUTPUT_SOURCE_LINE(file, line) \
102 do \
103 { \
104 static int sym_lineno = 1; \
105 asm_fprintf ((file), ".stabn 68,0,%d,%LLM%d-", \
106 (line), sym_lineno); \
107 assemble_name ((file), \
108 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
109 asm_fprintf ((file), "\n%LLM%d:\n", sym_lineno); \
110 sym_lineno += 1; \
111 } \
112 while (0)
113
114 #undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
115 #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
116 do { \
117 text_section (); \
118 fprintf ((FILE), "\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO); \
119 } while (0)
120
121 #undef STARTFILE_SPEC
122 #define STARTFILE_SPEC \
123 "%{!shared: crt1.o%s} crti.o%s \
124 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
125
126 #undef ENDFILE_SPEC
127 #define ENDFILE_SPEC \
128 "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
129
130 /* ASM_OUTPUT_CASE_LABEL is defined in elfos.h. With it,
131 a redundant .align was generated. */
132 #undef ASM_OUTPUT_CASE_LABEL