]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/ia64/sysv4.h
9c1c1250a924c7c6e9e5d863238a884873d94776
[thirdparty/gcc.git] / gcc / config / ia64 / sysv4.h
1 /* Override definitions in elfos.h/svr4.h to be correct for IA64. */
2
3 /* We want DWARF2 as specified by the IA64 ABI. */
4 #undef PREFERRED_DEBUGGING_TYPE
5 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
6
7 /* Various pseudo-ops for which the Intel assembler uses non-standard
8 definitions. */
9
10 #undef ASM_BYTE_OP
11 #define ASM_BYTE_OP "data1"
12
13 #undef STRING_ASM_OP
14 #define STRING_ASM_OP "stringz"
15
16 #undef SKIP_ASM_OP
17 #define SKIP_ASM_OP ".skip"
18
19 #undef COMMON_ASM_OP
20 #define COMMON_ASM_OP ".common"
21
22 #undef ASCII_DATA_ASM_OP
23 #define ASCII_DATA_ASM_OP "string"
24
25 /* ??? Unfortunately, .lcomm doesn't work, because it puts things in either
26 .bss or .sbss, and we can't control the decision of which is used. When
27 I use .lcomm, I get a cryptic "Section group has no member" error from
28 the Intel simulator. So we must explicitly put variables in .bss
29 instead. This matters only if we care about the Intel assembler. */
30
31 /* This is asm_output_aligned_bss from varasm.c without the ASM_GLOBALIZE_LABEL
32 call at the beginning. */
33
34 /* This is for final.c, because it is used by ASM_DECLARE_OBJECT_NAME. */
35 extern int size_directive_output;
36
37 #undef ASM_OUTPUT_ALIGNED_LOCAL
38 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
39 do { \
40 if (XSTR (XEXP (DECL_RTL (DECL), 0), 0)[0] == SDATA_NAME_FLAG_CHAR) \
41 sbss_section (); \
42 else \
43 bss_section (); \
44 ASM_OUTPUT_ALIGN (FILE, floor_log2 ((ALIGN) / BITS_PER_UNIT)); \
45 ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL); \
46 ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1); \
47 } while (0)
48
49 /* ??? Intel assembler does not allow "." in section names, so turn off
50 gnu.linkonce section support, but only when using the Intel assembler. */
51 #undef UNIQUE_SECTION_P
52 #define UNIQUE_SECTION_P(DECL) (TARGET_GNU_AS ? DECL_ONE_ONLY (DECL) : 0)
53
54 /* The # tells the Intel assembler that this is not a register name.
55 However, we can't emit the # in a label definition, so we set a variable
56 in ASM_OUTPUT_LABEL to control whether we want the postfix here or not. */
57
58 #undef ASM_OUTPUT_LABELREF
59 #define ASM_OUTPUT_LABELREF(STREAM, NAME) \
60 do \
61 { \
62 const char *real_name; \
63 STRIP_NAME_ENCODING (real_name, NAME); \
64 asm_fprintf (STREAM, "%U%s%s", real_name, \
65 (ia64_asm_output_label ? "" : "#")); \
66 } \
67 while (0)
68
69 /* Intel assembler requires both flags and type if declaring a non-predefined
70 section. */
71 #undef INIT_SECTION_ASM_OP
72 #define INIT_SECTION_ASM_OP ".section\t.init,\"ax\",\"progbits\""
73 #undef FINI_SECTION_ASM_OP
74 #define FINI_SECTION_ASM_OP ".section\t.fini,\"ax\",\"progbits\""
75 #undef CTORS_SECTION_ASM_OP
76 #define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\",\"progbits\""
77 #undef DTORS_SECTION_ASM_OP
78 #define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\",\"progbits\""
79
80 /* A C statement (sans semicolon) to output an element in the table of
81 global constructors. */
82 /* Must override this to get @fptr relocation. */
83 #undef ASM_OUTPUT_CONSTRUCTOR
84 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
85 do { \
86 ctors_section (); \
87 if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
88 fputs ("\tdata8\t ", FILE); \
89 else \
90 fputs ("\tdata8\t @fptr(", FILE); \
91 assemble_name (FILE, NAME); \
92 if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
93 fputs ("\n", FILE); \
94 else \
95 fputs (")\n", FILE); \
96 } while (0)
97
98 /* A C statement (sans semicolon) to output an element in the table of
99 global destructors. */
100 /* Must override this to get @fptr relocation. */
101 #undef ASM_OUTPUT_DESTRUCTOR
102 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
103 do { \
104 dtors_section (); \
105 if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
106 fputs ("\tdata8\t ", FILE); \
107 else \
108 fputs ("\tdata8\t @fptr(", FILE); \
109 assemble_name (FILE, NAME); \
110 if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
111 fputs ("\n", FILE); \
112 else \
113 fputs (")\n", FILE); \
114 } while (0)
115
116 /* svr4.h undefines this, so we need to define it here. */
117 #define DBX_REGISTER_NUMBER(REGNO) \
118 (IN_REGNO_P (REGNO) ? (32 + (REGNO) - IN_REG (0)) \
119 : LOC_REGNO_P (REGNO) ? (32 + ia64_input_regs + \
120 (REGNO) - LOC_REG (0)) \
121 : OUT_REGNO_P (REGNO) ? (32 + ia64_input_regs + ia64_local_regs \
122 + (REGNO) - OUT_REG (0)) \
123 : (REGNO) == FRAME_POINTER_REGNUM ? ia64_fp_regno \
124 : (REGNO))
125
126 /* Things that svr4.h defines to the wrong type, because it assumes 32 bit
127 ints and 32 bit longs. */
128
129 #undef SIZE_TYPE
130 #define SIZE_TYPE "long unsigned int"
131
132 #undef PTRDIFF_TYPE
133 #define PTRDIFF_TYPE "long int"
134
135 #undef WCHAR_TYPE
136 #define WCHAR_TYPE "int"
137
138 #undef WCHAR_TYPE_SIZE
139 #define WCHAR_TYPE_SIZE 32
140
141 /* We don't want any symbol at the beginning of the file. This is defined in
142 dbxelf.h which is included from elfos.h, so we need to undef/define it
143 here. */
144
145 #undef ASM_IDENTIFY_GCC
146 #define ASM_IDENTIFY_GCC(FILE)
147
148 /* We redefine this to use the ia64 .proc pseudo-op. */
149
150 #undef ASM_DECLARE_FUNCTION_NAME
151 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
152 do { \
153 fputs ("\t.proc ", FILE); \
154 assemble_name (FILE, NAME); \
155 fputc ('\n', FILE); \
156 ASM_OUTPUT_LABEL (FILE, NAME); \
157 } while (0)
158
159 /* We redefine this to use the ia64 .endp pseudo-op. */
160
161 #undef ASM_DECLARE_FUNCTION_SIZE
162 #define ASM_DECLARE_FUNCTION_SIZE(FILE, NAME, DECL) \
163 do { \
164 fputs ("\t.endp ", FILE); \
165 assemble_name (FILE, NAME); \
166 fputc ('\n', FILE); \
167 } while (0)
168
169 /* A C expression which outputs to the stdio stream STREAM some appropriate
170 text to go at the start of an assembler file. */
171
172 /* ??? Looks like almost every port, except for a few original ones, get this
173 wrong. Must emit #NO_APP as first line of file to turn of special assembler
174 preprocessing of files. */
175
176 /* ??? Even worse, it doesn't work, because gas does not accept the tab chars
177 that dwarf2out.c emits when #NO_APP. */
178
179 /* ??? Unrelated, but dwarf2out.c emits unnecessary newlines after strings,
180 may as well fix at the same time. */
181
182 #if 0
183 #undef ASM_FILE_START
184 #define ASM_FILE_START(STREAM) \
185 do { \
186 fputs (ASM_APP_OFF, STREAM); \
187 output_file_directive (STREAM, main_input_filename); \
188 } while (0)
189 #endif
190
191 /* Case label alignment is handled by ADDR_VEC_ALIGN now. */
192
193 #undef ASM_OUTPUT_BEFORE_CASE_LABEL
194 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE)
195
196 /* We override svr4.h so that we can support the sdata section. */
197
198 #undef SELECT_SECTION
199 #define SELECT_SECTION(DECL,RELOC) \
200 { \
201 if (TREE_CODE (DECL) == STRING_CST) \
202 { \
203 if (! flag_writable_strings) \
204 const_section (); \
205 else \
206 data_section (); \
207 } \
208 else if (TREE_CODE (DECL) == VAR_DECL) \
209 { \
210 if (XSTR (XEXP (DECL_RTL (DECL), 0), 0)[0] \
211 == SDATA_NAME_FLAG_CHAR) \
212 sdata_section (); \
213 /* ??? We need the extra ! RELOC check, because the default is to \
214 only check RELOC if flag_pic is set, and we don't set flag_pic \
215 (yet?). */ \
216 else if (DECL_READONLY_SECTION (DECL, RELOC) && ! (RELOC)) \
217 const_section (); \
218 else \
219 data_section (); \
220 } \
221 /* This could be a CONSTRUCTOR containing ADDR_EXPR of a VAR_DECL, \
222 in which case we can't put it in a shared library rodata. */ \
223 else if (flag_pic && (RELOC)) \
224 data_section (); \
225 else \
226 const_section (); \
227 }
228
229 /* Similarly for constant pool data. */
230
231 extern int ia64_section_threshold;
232 #undef SELECT_RTX_SECTION
233 #define SELECT_RTX_SECTION(MODE, RTX) \
234 { \
235 if (GET_MODE_SIZE (MODE) > 0 \
236 && GET_MODE_SIZE (MODE) <= ia64_section_threshold) \
237 sdata_section (); \
238 else if (flag_pic && symbolic_operand ((RTX), (MODE))) \
239 data_section (); \
240 else \
241 const_section (); \
242 }
243
244 #undef EXTRA_SECTIONS
245 #define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_sdata, in_sbss
246
247 #undef EXTRA_SECTION_FUNCTIONS
248 #define EXTRA_SECTION_FUNCTIONS \
249 CONST_SECTION_FUNCTION \
250 CTORS_SECTION_FUNCTION \
251 DTORS_SECTION_FUNCTION \
252 SDATA_SECTION_FUNCTION \
253 SBSS_SECTION_FUNCTION
254
255 #define SDATA_SECTION_ASM_OP ".sdata"
256
257 #define SDATA_SECTION_FUNCTION \
258 void \
259 sdata_section () \
260 { \
261 if (in_section != in_sdata) \
262 { \
263 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
264 in_section = in_sdata; \
265 } \
266 }
267
268 #define SBSS_SECTION_ASM_OP ".sbss"
269
270 #define SBSS_SECTION_FUNCTION \
271 void \
272 sbss_section () \
273 { \
274 if (in_section != in_sbss) \
275 { \
276 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
277 in_section = in_sbss; \
278 } \
279 }