]>
Commit | Line | Data |
---|---|---|
800e920a | 1 | /* Definitions of target machine for GNU compiler, for DEC Alpha w/ELF. |
9ddd9abd | 2 | Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. |
800e920a RK |
3 | Contributed by Richard Henderson (rth@tamu.edu). |
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 | ||
800e920a RK |
22 | #undef OBJECT_FORMAT_COFF |
23 | #undef EXTENDED_COFF | |
24 | #define OBJECT_FORMAT_ELF | |
25 | ||
b0435cf4 | 26 | #define DBX_DEBUGGING_INFO |
6abc6f40 | 27 | #define DWARF2_DEBUGGING_INFO |
800e920a | 28 | |
d38d55b4 | 29 | #undef PREFERRED_DEBUGGING_TYPE |
48adb36e | 30 | #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG |
800e920a | 31 | |
b0435cf4 | 32 | #undef ASM_FINAL_SPEC |
800e920a | 33 | |
d38d55b4 | 34 | #undef CC1_SPEC |
bb8ebb7f RH |
35 | #define CC1_SPEC "%{G*}" |
36 | ||
d38d55b4 | 37 | #undef ASM_SPEC |
48adb36e | 38 | #define ASM_SPEC "%{G*} %{relax:-relax} %{!gstabs*:-no-mdebug}%{gstabs*:-mdebug}" |
bb8ebb7f | 39 | |
d38d55b4 | 40 | #undef LINK_SPEC |
bb8ebb7f RH |
41 | #define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \ |
42 | %{O*:-O3} %{!O*:-O1} \ | |
800e920a RK |
43 | %{shared:-shared} \ |
44 | %{!shared: \ | |
45 | %{!static: \ | |
46 | %{rdynamic:-export-dynamic} \ | |
952fc2ed | 47 | %{!dynamic-linker:-dynamic-linker %(elf_dynamic_linker)}} \ |
800e920a | 48 | %{static:-static}}" |
ca20876d | 49 | |
800e920a | 50 | /* Output at beginning of assembler file. */ |
d38d55b4 | 51 | #undef ASM_FILE_START |
800e920a | 52 | #define ASM_FILE_START(FILE) \ |
6abc6f40 | 53 | do { \ |
48adb36e | 54 | if (write_symbols == DBX_DEBUG) \ |
6abc6f40 RH |
55 | { \ |
56 | alpha_write_verstamp (FILE); \ | |
57 | output_file_directive (FILE, main_input_filename); \ | |
58 | } \ | |
800e920a | 59 | fprintf (FILE, "\t.set noat\n"); \ |
6abc6f40 | 60 | fprintf (FILE, "\t.set noreorder\n"); \ |
de4abb91 | 61 | if (TARGET_BWX | TARGET_MAX | TARGET_FIX | TARGET_CIX) \ |
b0435cf4 RH |
62 | { \ |
63 | fprintf (FILE, "\t.arch %s\n", \ | |
a3b815cb | 64 | (TARGET_CPU_EV6 ? "ev6" \ |
b0435cf4 RH |
65 | : TARGET_MAX ? "pca56" : "ev56")); \ |
66 | } \ | |
6abc6f40 | 67 | } while (0) |
800e920a | 68 | |
800e920a RK |
69 | /* Attach a special .ident directive to the end of the file to identify |
70 | the version of GCC which compiled this code. The format of the | |
71 | .ident string is patterned after the ones produced by native svr4 | |
72 | C compilers. */ | |
73 | ||
8c13c7b3 | 74 | #define IDENT_ASM_OP "\t.ident\t" |
800e920a RK |
75 | |
76 | #ifdef IDENTIFY_WITH_IDENT | |
77 | #define ASM_IDENTIFY_GCC(FILE) /* nothing */ | |
78 | #define ASM_IDENTIFY_LANGUAGE(FILE) \ | |
8202cda0 | 79 | fprintf(FILE, "%s\"GCC (%s) %s\"\n", IDENT_ASM_OP, \ |
800e920a RK |
80 | lang_identify(), version_string) |
81 | #else | |
82 | #define ASM_FILE_END(FILE) \ | |
83 | do { \ | |
be163a70 | 84 | if (!flag_no_ident) \ |
8202cda0 | 85 | fprintf ((FILE), "%s\"GCC: (GNU) %s\"\n", \ |
be163a70 | 86 | IDENT_ASM_OP, version_string); \ |
800e920a RK |
87 | } while (0) |
88 | #endif | |
89 | ||
90 | /* Allow #sccs in preprocessor. */ | |
800e920a RK |
91 | #define SCCS_DIRECTIVE |
92 | ||
93 | /* Output #ident as a .ident. */ | |
94984e91 | 94 | #undef ASM_OUTPUT_IDENT |
800e920a | 95 | #define ASM_OUTPUT_IDENT(FILE, NAME) \ |
8202cda0 | 96 | fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME); |
800e920a RK |
97 | |
98 | /* This is how to allocate empty space in some section. The .zero | |
99 | pseudo-op is used for this on most svr4 assemblers. */ | |
100 | ||
8c13c7b3 | 101 | #define SKIP_ASM_OP "\t.zero\t" |
800e920a | 102 | |
d38d55b4 DB |
103 | #undef ASM_OUTPUT_SKIP |
104 | #define ASM_OUTPUT_SKIP(FILE, SIZE) \ | |
8202cda0 | 105 | fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (SIZE)) |
800e920a RK |
106 | |
107 | /* Output the label which precedes a jumptable. Note that for all svr4 | |
108 | systems where we actually generate jumptables (which is to say every | |
109 | svr4 target except i386, where we use casesi instead) we put the jump- | |
110 | tables into the .rodata section and since other stuff could have been | |
111 | put into the .rodata section prior to any given jumptable, we have to | |
112 | make sure that the location counter for the .rodata section gets pro- | |
113 | perly re-aligned prior to the actual beginning of the jump table. */ | |
114 | ||
8c13c7b3 | 115 | #define ALIGN_ASM_OP "\t.align\t" |
800e920a RK |
116 | |
117 | #ifndef ASM_OUTPUT_BEFORE_CASE_LABEL | |
d38d55b4 | 118 | #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \ |
800e920a RK |
119 | ASM_OUTPUT_ALIGN ((FILE), 2); |
120 | #endif | |
121 | ||
d38d55b4 DB |
122 | #undef ASM_OUTPUT_CASE_LABEL |
123 | #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \ | |
800e920a RK |
124 | do { \ |
125 | ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \ | |
126 | ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \ | |
127 | } while (0) | |
128 | ||
129 | /* The standard SVR4 assembler seems to require that certain builtin | |
130 | library routines (e.g. .udiv) be explicitly declared as .globl | |
131 | in each assembly file where they are referenced. */ | |
132 | ||
133 | #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ | |
134 | ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0)) | |
135 | ||
136 | /* This says how to output assembler code to declare an | |
137 | uninitialized external linkage data object. Under SVR4, | |
138 | the linker seems to want the alignment of data objects | |
139 | to depend on their types. We do exactly that here. */ | |
140 | ||
8c13c7b3 | 141 | #define COMMON_ASM_OP "\t.comm\t" |
800e920a | 142 | |
d38d55b4 | 143 | #undef ASM_OUTPUT_ALIGNED_COMMON |
800e920a RK |
144 | #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ |
145 | do { \ | |
8202cda0 | 146 | fprintf ((FILE), "%s", COMMON_ASM_OP); \ |
800e920a RK |
147 | assemble_name ((FILE), (NAME)); \ |
148 | fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ | |
149 | } while (0) | |
150 | ||
151 | /* This says how to output assembler code to declare an | |
152 | uninitialized internal linkage data object. Under SVR4, | |
153 | the linker seems to want the alignment of data objects | |
154 | to depend on their types. We do exactly that here. */ | |
155 | ||
d38d55b4 | 156 | #undef ASM_OUTPUT_ALIGNED_LOCAL |
800e920a RK |
157 | #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ |
158 | do { \ | |
bb8ebb7f RH |
159 | if ((SIZE) <= g_switch_value) \ |
160 | sbss_section(); \ | |
161 | else \ | |
162 | bss_section(); \ | |
8202cda0 | 163 | fprintf (FILE, "%s", TYPE_ASM_OP); \ |
bb8ebb7f RH |
164 | assemble_name (FILE, NAME); \ |
165 | putc (',', FILE); \ | |
166 | fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ | |
167 | putc ('\n', FILE); \ | |
168 | if (!flag_inhibit_size_directive) \ | |
169 | { \ | |
8202cda0 | 170 | fprintf (FILE, "%s", SIZE_ASM_OP); \ |
bb8ebb7f RH |
171 | assemble_name (FILE, NAME); \ |
172 | fprintf (FILE, ",%d\n", (SIZE)); \ | |
173 | } \ | |
174 | ASM_OUTPUT_ALIGN ((FILE), exact_log2((ALIGN) / BITS_PER_UNIT)); \ | |
175 | ASM_OUTPUT_LABEL(FILE, NAME); \ | |
176 | ASM_OUTPUT_SKIP((FILE), (SIZE)); \ | |
800e920a RK |
177 | } while (0) |
178 | ||
8c9aceea RK |
179 | /* This is the pseudo-op used to generate a 64-bit word of data with a |
180 | specific value in some section. */ | |
800e920a | 181 | |
8c13c7b3 | 182 | #define INT_ASM_OP "\t.quad\t" |
800e920a | 183 | |
bb8ebb7f RH |
184 | /* Biggest alignment supported by the object file format of this |
185 | machine. Use this macro to limit the alignment which can be | |
186 | specified using the `__attribute__ ((aligned (N)))' construct. If | |
187 | not defined, the default value is `BIGGEST_ALIGNMENT'. | |
188 | ||
189 | This value is really 2^63. Since gcc figures the alignment in bits, | |
190 | we could only potentially get to 2^60 on suitible hosts. Due to other | |
191 | considerations in varasm, we must restrict this to what fits in an int. */ | |
192 | ||
193 | #define MAX_OFILE_ALIGNMENT \ | |
194 | (1 << (HOST_BITS_PER_INT < 64 ? HOST_BITS_PER_INT - 2 : 62)) | |
195 | ||
800e920a RK |
196 | /* This is the pseudo-op used to generate a contiguous sequence of byte |
197 | values from a double-quoted string WITHOUT HAVING A TERMINATING NUL | |
198 | AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */ | |
199 | ||
d38d55b4 | 200 | #undef ASCII_DATA_ASM_OP |
8c13c7b3 | 201 | #define ASCII_DATA_ASM_OP "\t.ascii\t" |
800e920a RK |
202 | |
203 | /* Support const sections and the ctors and dtors sections for g++. | |
204 | Note that there appears to be two different ways to support const | |
205 | sections at the moment. You can either #define the symbol | |
206 | READONLY_DATA_SECTION (giving it some code which switches to the | |
207 | readonly data section) or else you can #define the symbols | |
208 | EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and | |
209 | SELECT_RTX_SECTION. We do both here just to be on the safe side. */ | |
210 | ||
211 | #define USE_CONST_SECTION 1 | |
212 | ||
8c13c7b3 | 213 | #define CONST_SECTION_ASM_OP "\t.section\t.rodata" |
800e920a RK |
214 | |
215 | /* Define the pseudo-ops used to switch to the .ctors and .dtors sections. | |
216 | ||
217 | Note that we want to give these sections the SHF_WRITE attribute | |
218 | because these sections will actually contain data (i.e. tables of | |
219 | addresses of functions in the current root executable or shared library | |
220 | file) and, in the case of a shared library, the relocatable addresses | |
221 | will have to be properly resolved/relocated (and then written into) by | |
222 | the dynamic linker when it actually attaches the given shared library | |
223 | to the executing process. (Note that on SVR4, you may wish to use the | |
224 | `-z text' option to the ELF linker, when building a shared library, as | |
225 | an additional check that you are doing everything right. But if you do | |
226 | use the `-z text' option when building a shared library, you will get | |
227 | errors unless the .ctors and .dtors sections are marked as writable | |
228 | via the SHF_WRITE attribute.) */ | |
229 | ||
8c13c7b3 HPN |
230 | #define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\"" |
231 | #define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\"" | |
800e920a | 232 | |
bb8ebb7f | 233 | /* Handle the small data sections. */ |
8c13c7b3 HPN |
234 | #define BSS_SECTION_ASM_OP "\t.section\t.bss" |
235 | #define SBSS_SECTION_ASM_OP "\t.section\t.sbss,\"aw\"" | |
236 | #define SDATA_SECTION_ASM_OP "\t.section\t.sdata,\"aw\"" | |
bb8ebb7f | 237 | |
800e920a RK |
238 | /* On svr4, we *do* have support for the .init and .fini sections, and we |
239 | can put stuff in there to be executed before and after `main'. We let | |
240 | crtstuff.c and other files know this by defining the following symbols. | |
241 | The definitions say how to change sections to the .init and .fini | |
242 | sections. This is the same for all known svr4 assemblers. */ | |
243 | ||
8c13c7b3 HPN |
244 | #define INIT_SECTION_ASM_OP "\t.section\t.init" |
245 | #define FINI_SECTION_ASM_OP "\t.section\t.fini" | |
800e920a RK |
246 | |
247 | /* A default list of other sections which we might be "in" at any given | |
248 | time. For targets that use additional sections (e.g. .tdesc) you | |
249 | should override this definition in the target-specific file which | |
250 | includes this file. */ | |
251 | ||
d38d55b4 | 252 | #undef EXTRA_SECTIONS |
bb8ebb7f | 253 | #define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_sbss, in_sdata |
800e920a RK |
254 | |
255 | /* A default list of extra section function definitions. For targets | |
256 | that use additional sections (e.g. .tdesc) you should override this | |
257 | definition in the target-specific file which includes this file. */ | |
258 | ||
d38d55b4 | 259 | #undef EXTRA_SECTION_FUNCTIONS |
800e920a RK |
260 | #define EXTRA_SECTION_FUNCTIONS \ |
261 | CONST_SECTION_FUNCTION \ | |
bb8ebb7f RH |
262 | SECTION_FUNCTION_TEMPLATE(ctors_section, in_ctors, CTORS_SECTION_ASM_OP) \ |
263 | SECTION_FUNCTION_TEMPLATE(dtors_section, in_dtors, DTORS_SECTION_ASM_OP) \ | |
264 | SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) \ | |
265 | SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) | |
800e920a | 266 | |
a82c7f05 RH |
267 | extern void ctors_section PARAMS ((void)); |
268 | extern void dtors_section PARAMS ((void)); | |
269 | extern void sbss_section PARAMS ((void)); | |
270 | extern void sdata_section PARAMS ((void)); | |
271 | ||
d38d55b4 | 272 | #undef READONLY_DATA_SECTION |
800e920a RK |
273 | #define READONLY_DATA_SECTION() const_section () |
274 | ||
aa388f29 | 275 | #define CONST_SECTION_FUNCTION \ |
aa388f29 RH |
276 | void \ |
277 | const_section () \ | |
278 | { \ | |
279 | if (!USE_CONST_SECTION) \ | |
280 | text_section(); \ | |
281 | else if (in_section != in_const) \ | |
282 | { \ | |
283 | fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ | |
284 | in_section = in_const; \ | |
285 | } \ | |
800e920a RK |
286 | } |
287 | ||
aa388f29 | 288 | #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \ |
aa388f29 RH |
289 | void FN () \ |
290 | { \ | |
291 | if (in_section != ENUM) \ | |
292 | { \ | |
293 | fprintf (asm_out_file, "%s\n", OP); \ | |
294 | in_section = ENUM; \ | |
295 | } \ | |
800e920a RK |
296 | } |
297 | ||
800e920a RK |
298 | |
299 | /* Switch into a generic section. | |
300 | This is currently only used to support section attributes. | |
301 | ||
302 | We make the section read-only and executable for a function decl, | |
303 | read-only for a const data decl, and writable for a non-const data decl. */ | |
ad4ff310 | 304 | #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \ |
800e920a RK |
305 | fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \ |
306 | (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \ | |
ad4ff310 | 307 | (DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "aw") |
800e920a RK |
308 | |
309 | ||
310 | /* A C statement (sans semicolon) to output an element in the table of | |
311 | global constructors. */ | |
d38d55b4 | 312 | #define ASM_OUTPUT_CONSTRUCTOR(FILE, NAME) \ |
800e920a RK |
313 | do { \ |
314 | ctors_section (); \ | |
8202cda0 | 315 | fprintf (FILE, "%s", INT_ASM_OP); \ |
800e920a RK |
316 | assemble_name (FILE, NAME); \ |
317 | fprintf (FILE, "\n"); \ | |
318 | } while (0) | |
319 | ||
320 | /* A C statement (sans semicolon) to output an element in the table of | |
321 | global destructors. */ | |
d38d55b4 | 322 | #define ASM_OUTPUT_DESTRUCTOR(FILE, NAME) \ |
800e920a RK |
323 | do { \ |
324 | dtors_section (); \ | |
8202cda0 | 325 | fprintf (FILE, "%s", INT_ASM_OP); \ |
800e920a RK |
326 | assemble_name (FILE, NAME); \ |
327 | fprintf (FILE, "\n"); \ | |
328 | } while (0) | |
329 | ||
330 | /* A C statement or statements to switch to the appropriate | |
331 | section for output of DECL. DECL is either a `VAR_DECL' node | |
332 | or a constant of some sort. RELOC indicates whether forming | |
333 | the initial value of DECL requires link-time relocations. */ | |
334 | ||
d38d55b4 | 335 | #define SELECT_SECTION(DECL, RELOC) \ |
800e920a RK |
336 | { \ |
337 | if (TREE_CODE (DECL) == STRING_CST) \ | |
338 | { \ | |
339 | if (! flag_writable_strings) \ | |
340 | const_section (); \ | |
341 | else \ | |
342 | data_section (); \ | |
343 | } \ | |
a1920fc3 | 344 | else if (TREE_CODE (DECL) == VAR_DECL) \ |
800e920a RK |
345 | { \ |
346 | if ((flag_pic && RELOC) \ | |
a1920fc3 RH |
347 | || ! TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ |
348 | || ! DECL_INITIAL (DECL) \ | |
800e920a RK |
349 | || (DECL_INITIAL (DECL) != error_mark_node \ |
350 | && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ | |
bb8ebb7f RH |
351 | { \ |
352 | int size = int_size_in_bytes (TREE_TYPE (DECL)); \ | |
353 | if (size >= 0 && size <= g_switch_value) \ | |
354 | sdata_section (); \ | |
355 | else \ | |
356 | data_section (); \ | |
357 | } \ | |
800e920a RK |
358 | else \ |
359 | const_section (); \ | |
360 | } \ | |
a1920fc3 RH |
361 | else if (TREE_CODE (DECL) == CONSTRUCTOR) \ |
362 | { \ | |
363 | if ((flag_pic && RELOC) \ | |
364 | || ! TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ | |
365 | || ! TREE_CONSTANT (DECL)) \ | |
366 | { \ | |
367 | int size = int_size_in_bytes (TREE_TYPE (DECL)); \ | |
368 | if (size >= 0 && size <= g_switch_value) \ | |
369 | sdata_section (); \ | |
370 | else \ | |
371 | data_section (); \ | |
372 | } \ | |
373 | else \ | |
374 | const_section (); \ | |
375 | } \ | |
800e920a RK |
376 | else \ |
377 | const_section (); \ | |
378 | } | |
379 | ||
380 | /* A C statement or statements to switch to the appropriate | |
381 | section for output of RTX in mode MODE. RTX is some kind | |
382 | of constant in RTL. The argument MODE is redundant except | |
383 | in the case of a `const_int' rtx. Currently, these always | |
384 | go into the const section. */ | |
385 | ||
d38d55b4 DB |
386 | #undef SELECT_RTX_SECTION |
387 | #define SELECT_RTX_SECTION(MODE, RTX) \ | |
388 | const_section() | |
800e920a RK |
389 | |
390 | /* Define the strings used for the special svr4 .type and .size directives. | |
391 | These strings generally do not vary from one system running svr4 to | |
392 | another, but if a given system (e.g. m88k running svr) needs to use | |
393 | different pseudo-op names for these, they may be overridden in the | |
394 | file which includes this one. */ | |
395 | ||
8c13c7b3 HPN |
396 | #define TYPE_ASM_OP "\t.type\t" |
397 | #define SIZE_ASM_OP "\t.size\t" | |
800e920a RK |
398 | |
399 | /* This is how we tell the assembler that a symbol is weak. */ | |
400 | ||
d38d55b4 | 401 | #define ASM_WEAKEN_LABEL(FILE, NAME) \ |
800e920a RK |
402 | do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ |
403 | fputc ('\n', FILE); } while (0) | |
404 | ||
405 | /* This is how we tell the assembler that two symbols have the same value. */ | |
406 | ||
d38d55b4 | 407 | #define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \ |
800e920a RK |
408 | do { assemble_name(FILE, NAME1); \ |
409 | fputs(" = ", FILE); \ | |
410 | assemble_name(FILE, NAME2); \ | |
411 | fputc('\n', FILE); } while (0) | |
412 | ||
413 | /* The following macro defines the format used to output the second | |
414 | operand of the .type assembler directive. Different svr4 assemblers | |
415 | expect various different forms for this operand. The one given here | |
416 | is just a default. You may need to override it in your machine- | |
417 | specific tm.h file (depending upon the particulars of your assembler). */ | |
418 | ||
419 | #define TYPE_OPERAND_FMT "@%s" | |
420 | ||
421 | /* Write the extra assembler code needed to declare a function's result. | |
422 | Most svr4 assemblers don't require any special declaration of the | |
423 | result value, but there are exceptions. */ | |
424 | ||
425 | #ifndef ASM_DECLARE_RESULT | |
426 | #define ASM_DECLARE_RESULT(FILE, RESULT) | |
427 | #endif | |
428 | ||
429 | /* These macros generate the special .type and .size directives which | |
430 | are used to set the corresponding fields of the linker symbol table | |
431 | entries in an ELF object file under SVR4. These macros also output | |
432 | the starting labels for the relevant functions/objects. */ | |
433 | ||
434 | /* Write the extra assembler code needed to declare an object properly. */ | |
435 | ||
e2bef702 RH |
436 | #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ |
437 | do { \ | |
438 | HOST_WIDE_INT size; \ | |
8202cda0 | 439 | fprintf (FILE, "%s", TYPE_ASM_OP); \ |
e2bef702 RH |
440 | assemble_name (FILE, NAME); \ |
441 | putc (',', FILE); \ | |
442 | fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ | |
443 | putc ('\n', FILE); \ | |
444 | size_directive_output = 0; \ | |
445 | if (!flag_inhibit_size_directive \ | |
446 | && DECL_SIZE (DECL) \ | |
447 | && (size = int_size_in_bytes (TREE_TYPE (DECL))) > 0) \ | |
448 | { \ | |
449 | size_directive_output = 1; \ | |
8202cda0 | 450 | fprintf (FILE, "%s", SIZE_ASM_OP); \ |
e2bef702 RH |
451 | assemble_name (FILE, NAME); \ |
452 | fputc (',', FILE); \ | |
453 | fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, size); \ | |
454 | fputc ('\n', FILE); \ | |
455 | } \ | |
456 | ASM_OUTPUT_LABEL(FILE, NAME); \ | |
800e920a RK |
457 | } while (0) |
458 | ||
459 | /* Output the size directive for a decl in rest_of_decl_compilation | |
460 | in the case where we did not do so before the initializer. | |
461 | Once we find the error_mark_node, we know that the value of | |
462 | size_directive_output was set | |
463 | by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ | |
464 | ||
ca7cdae3 | 465 | #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ |
e2bef702 | 466 | do { \ |
e03c5670 | 467 | const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ |
e2bef702 RH |
468 | HOST_WIDE_INT size; \ |
469 | if (!flag_inhibit_size_directive \ | |
470 | && DECL_SIZE (DECL) \ | |
471 | && ! AT_END && TOP_LEVEL \ | |
472 | && DECL_INITIAL (DECL) == error_mark_node \ | |
473 | && !size_directive_output \ | |
474 | && (size = int_size_in_bytes (TREE_TYPE (DECL))) > 0) \ | |
475 | { \ | |
476 | size_directive_output = 1; \ | |
8202cda0 | 477 | fprintf (FILE, "%s", SIZE_ASM_OP); \ |
e2bef702 RH |
478 | assemble_name (FILE, name); \ |
479 | fputc (',', FILE); \ | |
480 | fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, size); \ | |
481 | fputc ('\n', FILE); \ | |
482 | } \ | |
483 | } while (0) | |
800e920a RK |
484 | |
485 | /* A table of bytes codes used by the ASM_OUTPUT_ASCII and | |
486 | ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table | |
487 | corresponds to a particular byte value [0..255]. For any | |
488 | given byte value, if the value in the corresponding table | |
489 | position is zero, the given character can be output directly. | |
490 | If the table value is 1, the byte must be output as a \ooo | |
491 | octal escape. If the tables value is anything else, then the | |
492 | byte value should be output as a \ followed by the value | |
493 | in the table. Note that we can use standard UN*X escape | |
494 | sequences for many control characters, but we don't use | |
495 | \a to represent BEL because some svr4 assemblers (e.g. on | |
496 | the i386) don't know about that. Also, we don't use \v | |
497 | since some versions of gas, such as 2.2 did not accept it. */ | |
498 | ||
499 | #define ESCAPES \ | |
500 | "\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ | |
501 | \0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ | |
502 | \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\ | |
503 | \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\ | |
504 | \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ | |
505 | \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ | |
506 | \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ | |
507 | \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1" | |
508 | ||
509 | /* Some svr4 assemblers have a limit on the number of characters which | |
510 | can appear in the operand of a .string directive. If your assembler | |
511 | has such a limitation, you should define STRING_LIMIT to reflect that | |
512 | limit. Note that at least some svr4 assemblers have a limit on the | |
513 | actual number of bytes in the double-quoted string, and that they | |
514 | count each character in an escape sequence as one byte. Thus, an | |
515 | escape sequence like \377 would count as four bytes. | |
516 | ||
517 | If your target assembler doesn't support the .string directive, you | |
b0435cf4 | 518 | should define this to zero. */ |
800e920a RK |
519 | |
520 | #define STRING_LIMIT ((unsigned) 256) | |
8c13c7b3 | 521 | #define STRING_ASM_OP "\t.string\t" |
800e920a | 522 | |
b0435cf4 | 523 | /* GAS is the only Alpha/ELF assembler. */ |
d38d55b4 | 524 | #undef TARGET_GAS |
800e920a RK |
525 | #define TARGET_GAS (1) |
526 | ||
b0435cf4 RH |
527 | /* Provide a STARTFILE_SPEC appropriate for ELF. Here we add the |
528 | (even more) magical crtbegin.o file which provides part of the | |
ee8d66f7 RH |
529 | support for getting C++ file-scope static object constructed |
530 | before entering `main'. | |
800e920a | 531 | |
ee8d66f7 RH |
532 | Don't bother seeing crtstuff.c -- there is absolutely no hope |
533 | of getting that file to understand multiple GPs. We provide a | |
534 | hand-coded assembly version. */ | |
800e920a RK |
535 | |
536 | #undef STARTFILE_SPEC | |
537 | #define STARTFILE_SPEC \ | |
538 | "%{!shared: \ | |
539 | %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\ | |
ee8d66f7 | 540 | crti.o%s %{shared:crtbeginS.o%s}%{!shared:crtbegin.o%s}" |
800e920a | 541 | |
b0435cf4 RH |
542 | /* Provide a ENDFILE_SPEC appropriate for ELF. Here we tack on the |
543 | magical crtend.o file which provides part of the support for | |
544 | getting C++ file-scope static object constructed before entering | |
545 | `main', followed by a normal ELF "finalizer" file, `crtn.o'. */ | |
800e920a RK |
546 | |
547 | #undef ENDFILE_SPEC | |
548 | #define ENDFILE_SPEC \ | |
ee8d66f7 | 549 | "%{shared:crtendS.o%s}%{!shared:crtend.o%s} crtn.o%s" |
b0435cf4 RH |
550 | |
551 | /* We support #pragma. */ | |
552 | #define HANDLE_SYSV_PRAGMA | |
6690d24c RH |
553 | |
554 | /* Undo the auto-alignment stuff from alpha.h. ELF has unaligned data | |
555 | pseudos natively. */ | |
556 | #undef UNALIGNED_SHORT_ASM_OP | |
557 | #undef UNALIGNED_INT_ASM_OP | |
558 | #undef UNALIGNED_DOUBLE_INT_ASM_OP |