]> gcc.gnu.org Git - gcc.git/blame - gcc/config/alpha/elf.h
(INT_ASM_OP): Change from ".long" to ".quad".
[gcc.git] / gcc / config / alpha / elf.h
CommitLineData
800e920a
RK
1/* Definitions of target machine for GNU compiler, for DEC Alpha w/ELF.
2 Copyright (C) 1996 Free Software Foundation, Inc.
3 Contributed by Richard Henderson (rth@tamu.edu).
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22/* This is used on Alpha platforms that use the ELF format.
23Currently only Linux uses this. */
24
25#undef TARGET_VERSION
26#define TARGET_VERSION fprintf (stderr, " (Alpha Linux/ELF)");
27
28#undef OBJECT_FORMAT_COFF
29#undef EXTENDED_COFF
30#define OBJECT_FORMAT_ELF
31
32#define SDB_DEBUGGING_INFO
33
34#undef ASM_FINAL_SPEC
35
36#undef CPP_PREDEFINES
37#define CPP_PREDEFINES "\
38-D__alpha -D__alpha__ -D__linux__ -D__linux -D_LONGLONG -Dlinux -Dunix \
39-Asystem(linux) -Acpu(alpha) -Amachine(alpha) -D__ELF__"
40
41#undef LINK_SPEC
8aeba621 42#define LINK_SPEC "-m elf64alpha -G 8 %{O*:-O3} %{!O*:-O1} \
800e920a
RK
43 %{shared:-shared} \
44 %{!shared: \
45 %{!static: \
46 %{rdynamic:-export-dynamic} \
47 %{!dynamic-linker:-dynamic-linker /lib/ld-gnu.so.1}} \
48 %{static:-static}}"
49
50/* Output at beginning of assembler file. */
51
52#undef ASM_FILE_START
53#define ASM_FILE_START(FILE) \
54{ \
55 alpha_write_verstamp (FILE); \
56 output_file_directive (FILE, main_input_filename); \
57 fprintf (FILE, "\t.version\t\"01.01\"\n"); \
58 fprintf (FILE, "\t.set noat\n"); \
59}
60
61#define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
62 alpha_output_lineno (STREAM, LINE)
63extern void alpha_output_lineno ();
64
65extern void output_file_directive ();
66
67/* Attach a special .ident directive to the end of the file to identify
68 the version of GCC which compiled this code. The format of the
69 .ident string is patterned after the ones produced by native svr4
70 C compilers. */
71
72#define IDENT_ASM_OP ".ident"
73
74#ifdef IDENTIFY_WITH_IDENT
75#define ASM_IDENTIFY_GCC(FILE) /* nothing */
76#define ASM_IDENTIFY_LANGUAGE(FILE) \
77 fprintf(FILE, "\t%s \"GCC (%s) %s\"\n", IDENT_ASM_OP, \
78 lang_identify(), version_string)
79#else
80#define ASM_FILE_END(FILE) \
81do { \
82 fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n", \
83 IDENT_ASM_OP, version_string); \
84 } while (0)
85#endif
86
87/* Allow #sccs in preprocessor. */
88
89#define SCCS_DIRECTIVE
90
91/* Output #ident as a .ident. */
92
93#define ASM_OUTPUT_IDENT(FILE, NAME) \
94 fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME);
95
96/* This is how to allocate empty space in some section. The .zero
97 pseudo-op is used for this on most svr4 assemblers. */
98
99#define SKIP_ASM_OP ".zero"
100
101#undef ASM_OUTPUT_SKIP
102#define ASM_OUTPUT_SKIP(FILE,SIZE) \
103 fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE))
104
105/* Output the label which precedes a jumptable. Note that for all svr4
106 systems where we actually generate jumptables (which is to say every
107 svr4 target except i386, where we use casesi instead) we put the jump-
108 tables into the .rodata section and since other stuff could have been
109 put into the .rodata section prior to any given jumptable, we have to
110 make sure that the location counter for the .rodata section gets pro-
111 perly re-aligned prior to the actual beginning of the jump table. */
112
113#define ALIGN_ASM_OP ".align"
114
115#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL
116#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
117 ASM_OUTPUT_ALIGN ((FILE), 2);
118#endif
119
120#undef ASM_OUTPUT_CASE_LABEL
121#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \
122 do { \
123 ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \
124 ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \
125 } while (0)
126
127/* The standard SVR4 assembler seems to require that certain builtin
128 library routines (e.g. .udiv) be explicitly declared as .globl
129 in each assembly file where they are referenced. */
130
131#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
132 ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
133
134/* This says how to output assembler code to declare an
135 uninitialized external linkage data object. Under SVR4,
136 the linker seems to want the alignment of data objects
137 to depend on their types. We do exactly that here. */
138
139#define COMMON_ASM_OP ".comm"
140
141#undef ASM_OUTPUT_ALIGNED_COMMON
142#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
143do { \
144 fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \
145 assemble_name ((FILE), (NAME)); \
146 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
147} while (0)
148
149/* This says how to output assembler code to declare an
150 uninitialized internal linkage data object. Under SVR4,
151 the linker seems to want the alignment of data objects
152 to depend on their types. We do exactly that here. */
153
154#define LOCAL_ASM_OP ".local"
155
156#undef ASM_OUTPUT_ALIGNED_LOCAL
157#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
158do { \
159 fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP); \
160 assemble_name ((FILE), (NAME)); \
161 fprintf ((FILE), "\n"); \
162 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
163} while (0)
164
8c9aceea
RK
165/* This is the pseudo-op used to generate a 64-bit word of data with a
166 specific value in some section. */
800e920a 167
8c9aceea 168#define INT_ASM_OP ".quad"
800e920a
RK
169
170/* This is the pseudo-op used to generate a contiguous sequence of byte
171 values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
172 AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */
173
174#undef ASCII_DATA_ASM_OP
175#define ASCII_DATA_ASM_OP ".ascii"
176
177/* Support const sections and the ctors and dtors sections for g++.
178 Note that there appears to be two different ways to support const
179 sections at the moment. You can either #define the symbol
180 READONLY_DATA_SECTION (giving it some code which switches to the
181 readonly data section) or else you can #define the symbols
182 EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
183 SELECT_RTX_SECTION. We do both here just to be on the safe side. */
184
185#define USE_CONST_SECTION 1
186
187#define CONST_SECTION_ASM_OP ".section\t.rodata"
188
189/* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
190
191 Note that we want to give these sections the SHF_WRITE attribute
192 because these sections will actually contain data (i.e. tables of
193 addresses of functions in the current root executable or shared library
194 file) and, in the case of a shared library, the relocatable addresses
195 will have to be properly resolved/relocated (and then written into) by
196 the dynamic linker when it actually attaches the given shared library
197 to the executing process. (Note that on SVR4, you may wish to use the
198 `-z text' option to the ELF linker, when building a shared library, as
199 an additional check that you are doing everything right. But if you do
200 use the `-z text' option when building a shared library, you will get
201 errors unless the .ctors and .dtors sections are marked as writable
202 via the SHF_WRITE attribute.) */
203
204#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\""
205#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\""
206
207/* On svr4, we *do* have support for the .init and .fini sections, and we
208 can put stuff in there to be executed before and after `main'. We let
209 crtstuff.c and other files know this by defining the following symbols.
210 The definitions say how to change sections to the .init and .fini
211 sections. This is the same for all known svr4 assemblers. */
212
213#define INIT_SECTION_ASM_OP ".section\t.init"
214#define FINI_SECTION_ASM_OP ".section\t.fini"
215
216/* A default list of other sections which we might be "in" at any given
217 time. For targets that use additional sections (e.g. .tdesc) you
218 should override this definition in the target-specific file which
219 includes this file. */
220
221#undef EXTRA_SECTIONS
222#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
223
224/* A default list of extra section function definitions. For targets
225 that use additional sections (e.g. .tdesc) you should override this
226 definition in the target-specific file which includes this file. */
227
228#undef EXTRA_SECTION_FUNCTIONS
229#define EXTRA_SECTION_FUNCTIONS \
230 CONST_SECTION_FUNCTION \
231 CTORS_SECTION_FUNCTION \
232 DTORS_SECTION_FUNCTION
233
234#undef READONLY_DATA_SECTION
235#define READONLY_DATA_SECTION() const_section ()
236
237extern void text_section ();
238
239#define CONST_SECTION_FUNCTION \
240void \
241const_section () \
242{ \
243 if (!USE_CONST_SECTION) \
244 text_section(); \
245 else if (in_section != in_const) \
246 { \
247 fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
248 in_section = in_const; \
249 } \
250}
251
252#define CTORS_SECTION_FUNCTION \
253void \
254ctors_section () \
255{ \
256 if (in_section != in_ctors) \
257 { \
258 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
259 in_section = in_ctors; \
260 } \
261}
262
263#define DTORS_SECTION_FUNCTION \
264void \
265dtors_section () \
266{ \
267 if (in_section != in_dtors) \
268 { \
269 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
270 in_section = in_dtors; \
271 } \
272}
273
274/* Switch into a generic section.
275 This is currently only used to support section attributes.
276
277 We make the section read-only and executable for a function decl,
278 read-only for a const data decl, and writable for a non-const data decl. */
279#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
280 fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \
281 (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
282 (DECL) && TREE_READONLY (DECL) ? "a" : "aw")
283
284
285/* A C statement (sans semicolon) to output an element in the table of
286 global constructors. */
287#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
288 do { \
289 ctors_section (); \
290 fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
291 assemble_name (FILE, NAME); \
292 fprintf (FILE, "\n"); \
293 } while (0)
294
295/* A C statement (sans semicolon) to output an element in the table of
296 global destructors. */
297#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
298 do { \
299 dtors_section (); \
300 fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
301 assemble_name (FILE, NAME); \
302 fprintf (FILE, "\n"); \
303 } while (0)
304
305/* A C statement or statements to switch to the appropriate
306 section for output of DECL. DECL is either a `VAR_DECL' node
307 or a constant of some sort. RELOC indicates whether forming
308 the initial value of DECL requires link-time relocations. */
309
310#define SELECT_SECTION(DECL,RELOC) \
311{ \
312 if (TREE_CODE (DECL) == STRING_CST) \
313 { \
314 if (! flag_writable_strings) \
315 const_section (); \
316 else \
317 data_section (); \
318 } \
319 else if (TREE_CODE (DECL) == VAR_DECL) \
320 { \
321 if ((flag_pic && RELOC) \
322 || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
323 || !DECL_INITIAL (DECL) \
324 || (DECL_INITIAL (DECL) != error_mark_node \
325 && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
326 data_section (); \
327 else \
328 const_section (); \
329 } \
330 else \
331 const_section (); \
332}
333
334/* A C statement or statements to switch to the appropriate
335 section for output of RTX in mode MODE. RTX is some kind
336 of constant in RTL. The argument MODE is redundant except
337 in the case of a `const_int' rtx. Currently, these always
338 go into the const section. */
339
340#undef SELECT_RTX_SECTION
341#define SELECT_RTX_SECTION(MODE,RTX) const_section()
342
343/* Define the strings used for the special svr4 .type and .size directives.
344 These strings generally do not vary from one system running svr4 to
345 another, but if a given system (e.g. m88k running svr) needs to use
346 different pseudo-op names for these, they may be overridden in the
347 file which includes this one. */
348
349#define TYPE_ASM_OP ".type"
350#define SIZE_ASM_OP ".size"
351
352/* This is how we tell the assembler that a symbol is weak. */
353
354#define ASM_WEAKEN_LABEL(FILE,NAME) \
355 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
356 fputc ('\n', FILE); } while (0)
357
358/* This is how we tell the assembler that two symbols have the same value. */
359
360#define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
361 do { assemble_name(FILE, NAME1); \
362 fputs(" = ", FILE); \
363 assemble_name(FILE, NAME2); \
364 fputc('\n', FILE); } while (0)
365
366/* The following macro defines the format used to output the second
367 operand of the .type assembler directive. Different svr4 assemblers
368 expect various different forms for this operand. The one given here
369 is just a default. You may need to override it in your machine-
370 specific tm.h file (depending upon the particulars of your assembler). */
371
372#define TYPE_OPERAND_FMT "@%s"
373
374/* Write the extra assembler code needed to declare a function's result.
375 Most svr4 assemblers don't require any special declaration of the
376 result value, but there are exceptions. */
377
378#ifndef ASM_DECLARE_RESULT
379#define ASM_DECLARE_RESULT(FILE, RESULT)
380#endif
381
382/* These macros generate the special .type and .size directives which
383 are used to set the corresponding fields of the linker symbol table
384 entries in an ELF object file under SVR4. These macros also output
385 the starting labels for the relevant functions/objects. */
386
387/* Write the extra assembler code needed to declare an object properly. */
388
389#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
390 do { \
391 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
392 assemble_name (FILE, NAME); \
393 putc (',', FILE); \
394 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
395 putc ('\n', FILE); \
396 size_directive_output = 0; \
397 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
398 { \
399 size_directive_output = 1; \
400 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
401 assemble_name (FILE, NAME); \
402 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
403 } \
404 ASM_OUTPUT_LABEL(FILE, NAME); \
405 } while (0)
406
407/* Output the size directive for a decl in rest_of_decl_compilation
408 in the case where we did not do so before the initializer.
409 Once we find the error_mark_node, we know that the value of
410 size_directive_output was set
411 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
412
413#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
414do { \
415 char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
416 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
417 && ! AT_END && TOP_LEVEL \
418 && DECL_INITIAL (DECL) == error_mark_node \
419 && !size_directive_output) \
420 { \
421 size_directive_output = 1; \
422 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
423 assemble_name (FILE, name); \
424 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
425 } \
426 } while (0)
427
428/* A table of bytes codes used by the ASM_OUTPUT_ASCII and
429 ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table
430 corresponds to a particular byte value [0..255]. For any
431 given byte value, if the value in the corresponding table
432 position is zero, the given character can be output directly.
433 If the table value is 1, the byte must be output as a \ooo
434 octal escape. If the tables value is anything else, then the
435 byte value should be output as a \ followed by the value
436 in the table. Note that we can use standard UN*X escape
437 sequences for many control characters, but we don't use
438 \a to represent BEL because some svr4 assemblers (e.g. on
439 the i386) don't know about that. Also, we don't use \v
440 since some versions of gas, such as 2.2 did not accept it. */
441
442#define ESCAPES \
443"\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\
444\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\
445\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\
446\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\
447\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\
448\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\
449\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\
450\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"
451
452/* Some svr4 assemblers have a limit on the number of characters which
453 can appear in the operand of a .string directive. If your assembler
454 has such a limitation, you should define STRING_LIMIT to reflect that
455 limit. Note that at least some svr4 assemblers have a limit on the
456 actual number of bytes in the double-quoted string, and that they
457 count each character in an escape sequence as one byte. Thus, an
458 escape sequence like \377 would count as four bytes.
459
460 If your target assembler doesn't support the .string directive, you
461 should define this to zero.
462*/
463
464#define STRING_LIMIT ((unsigned) 256)
465
466#define STRING_ASM_OP ".string"
467
468/*
469 * We always use gas here, so we don't worry about ECOFF assembler problems.
470 */
471#undef TARGET_GAS
472#define TARGET_GAS (1)
473
474#undef PREFERRED_DEBUGGING_TYPE
475#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
476
477/* Provide a STARTFILE_SPEC appropriate for Linux. Here we add
478 the Linux magical crtbegin.o file (see crtstuff.c) which
479 provides part of the support for getting C++ file-scope static
480 object constructed before entering `main'. */
481
482#undef STARTFILE_SPEC
483#define STARTFILE_SPEC \
484 "%{!shared: \
485 %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
486 crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
487
488/* Provide a ENDFILE_SPEC appropriate for Linux. Here we tack on
489 the Linux magical crtend.o file (see crtstuff.c) which
490 provides part of the support for getting C++ file-scope static
491 object constructed before entering `main', followed by a normal
492 Linux "finalizer" file, `crtn.o'. */
493
494#undef ENDFILE_SPEC
495#define ENDFILE_SPEC \
496 "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
This page took 0.08033 seconds and 5 git commands to generate.