22b63f07cb46fd2acd7070567dbaf519fe77f07c
[platform/upstream/gcc.git] / gcc / config / alpha / elf.h
1 /* Definitions of target machine for GNU compiler, for DEC Alpha w/ELF.
2    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
3    Free Software Foundation, Inc.
4    Contributed by Richard Henderson (rth@tamu.edu).
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.    */
22
23 #undef OBJECT_FORMAT_COFF
24 #undef EXTENDED_COFF
25 #define OBJECT_FORMAT_ELF
26
27 /* ??? Move all SDB stuff from alpha.h to osf.h.  */
28 #undef SDB_DEBUGGING_INFO
29
30 #define DBX_DEBUGGING_INFO
31 #define DWARF2_DEBUGGING_INFO
32
33 #undef  PREFERRED_DEBUGGING_TYPE
34 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
35
36 #undef ASM_FINAL_SPEC
37
38 #undef  CPP_SUBTARGET_SPEC
39 #define CPP_SUBTARGET_SPEC "-D__ELF__"
40
41 #undef  CC1_SPEC
42 #define CC1_SPEC  "%{G*}"
43
44 #undef  ASM_SPEC
45 #define ASM_SPEC  "%{G*} %{relax:-relax} %{!gstabs*:-no-mdebug}%{gstabs*:-mdebug}"
46
47 /* Output at beginning of assembler file.  */
48 #undef  ASM_FILE_START
49 #define ASM_FILE_START(FILE)                                    \
50 do {                                                            \
51   if (write_symbols == DBX_DEBUG)                               \
52     {                                                           \
53       alpha_write_verstamp (FILE);                              \
54       output_file_directive (FILE, main_input_filename);        \
55     }                                                           \
56   fprintf (FILE, "\t.set noat\n");                              \
57   fprintf (FILE, "\t.set noreorder\n");                         \
58   if (TARGET_EXPLICIT_RELOCS)                                   \
59     fprintf (FILE, "\t.set nomacro\n");                         \
60   if (TARGET_BWX | TARGET_MAX | TARGET_FIX | TARGET_CIX)        \
61     {                                                           \
62       fprintf (FILE, "\t.arch %s\n",                            \
63                (TARGET_CPU_EV6 ? "ev6"                          \
64                 : TARGET_MAX ? "pca56" : "ev56"));              \
65     }                                                           \
66 } while (0)
67
68 #undef  IDENT_ASM_OP
69 #define IDENT_ASM_OP "\t.ident\t"
70
71 /* Allow #sccs in preprocessor.  */
72 #define SCCS_DIRECTIVE
73
74 /* Output #ident as a .ident.  */
75 #undef  ASM_OUTPUT_IDENT
76 #define ASM_OUTPUT_IDENT(FILE, NAME) \
77   fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME);
78
79 /* This is how to allocate empty space in some section.  The .zero
80    pseudo-op is used for this on most svr4 assemblers.  */
81
82 #undef  SKIP_ASM_OP
83 #define SKIP_ASM_OP     "\t.zero\t"
84
85 #undef  ASM_OUTPUT_SKIP
86 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
87   fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (SIZE))
88
89 /* Output the label which precedes a jumptable.  Note that for all svr4
90    systems where we actually generate jumptables (which is to say every
91    svr4 target except i386, where we use casesi instead) we put the jump-
92    tables into the .rodata section and since other stuff could have been
93    put into the .rodata section prior to any given jumptable, we have to
94    make sure that the location counter for the .rodata section gets pro-
95    perly re-aligned prior to the actual beginning of the jump table.  */
96
97 #undef  ALIGN_ASM_OP
98 #define ALIGN_ASM_OP "\t.align\t"
99
100 #ifndef ASM_OUTPUT_BEFORE_CASE_LABEL
101 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \
102   ASM_OUTPUT_ALIGN ((FILE), 2);
103 #endif
104
105 #undef  ASM_OUTPUT_CASE_LABEL
106 #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE)             \
107   do {                                                                  \
108     ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE)         \
109     ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM);                      \
110   } while (0)
111
112 /* The standard SVR4 assembler seems to require that certain builtin
113    library routines (e.g. .udiv) be explicitly declared as .globl
114    in each assembly file where they are referenced.  */
115
116 #undef  ASM_OUTPUT_EXTERNAL_LIBCALL
117 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)                          \
118   ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
119
120 /* This says how to output assembler code to declare an
121    uninitialized external linkage data object.  Under SVR4,
122    the linker seems to want the alignment of data objects
123    to depend on their types.  We do exactly that here.  */
124
125 #undef  COMMON_ASM_OP
126 #define COMMON_ASM_OP   "\t.comm\t"
127
128 #undef  ASM_OUTPUT_ALIGNED_COMMON
129 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)              \
130 do {                                                                    \
131   fprintf ((FILE), "%s", COMMON_ASM_OP);                                \
132   assemble_name ((FILE), (NAME));                                       \
133   fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT);        \
134 } while (0)
135
136 /* This says how to output assembler code to declare an
137    uninitialized internal 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
141 #undef  ASM_OUTPUT_ALIGNED_LOCAL
142 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)               \
143 do {                                                                    \
144   if ((SIZE) <= g_switch_value)                                         \
145     sbss_section();                                                     \
146   else                                                                  \
147     bss_section();                                                      \
148   fprintf (FILE, "%s", TYPE_ASM_OP);                                    \
149   assemble_name (FILE, NAME);                                           \
150   putc (',', FILE);                                                     \
151   fprintf (FILE, TYPE_OPERAND_FMT, "object");                           \
152   putc ('\n', FILE);                                                    \
153   if (!flag_inhibit_size_directive)                                     \
154     {                                                                   \
155       fprintf (FILE, "%s", SIZE_ASM_OP);                                \
156       assemble_name (FILE, NAME);                                       \
157       fprintf (FILE, ",%d\n", (SIZE));                                  \
158     }                                                                   \
159   ASM_OUTPUT_ALIGN ((FILE), exact_log2((ALIGN) / BITS_PER_UNIT));       \
160   ASM_OUTPUT_LABEL(FILE, NAME);                                         \
161   ASM_OUTPUT_SKIP((FILE), (SIZE));                                      \
162 } while (0)
163
164 /* This says how to output assembler code to declare an
165    uninitialized external linkage data object.  */
166
167 #undef  ASM_OUTPUT_ALIGNED_BSS
168 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)           \
169 do {                                                                    \
170   ASM_GLOBALIZE_LABEL (FILE, NAME);                                     \
171   ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN);                   \
172 } while (0)
173
174 /* Biggest alignment supported by the object file format of this
175    machine.  Use this macro to limit the alignment which can be
176    specified using the `__attribute__ ((aligned (N)))' construct.  If
177    not defined, the default value is `BIGGEST_ALIGNMENT'. 
178
179    This value is really 2^63.  Since gcc figures the alignment in bits,
180    we could only potentially get to 2^60 on suitible hosts.  Due to other
181    considerations in varasm, we must restrict this to what fits in an int.  */
182
183 #undef  MAX_OFILE_ALIGNMENT
184 #define MAX_OFILE_ALIGNMENT \
185   (1 << (HOST_BITS_PER_INT < 64 ? HOST_BITS_PER_INT - 2 : 62))
186
187 /* This is the pseudo-op used to generate a contiguous sequence of byte
188    values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
189    AUTOMATICALLY APPENDED.  This is the same for most svr4 assemblers.  */
190
191 #undef  ASCII_DATA_ASM_OP
192 #define ASCII_DATA_ASM_OP       "\t.ascii\t"
193
194 /* Support const sections and the ctors and dtors sections for g++.
195    Note that there appears to be two different ways to support const
196    sections at the moment.  You can either #define the symbol
197    READONLY_DATA_SECTION (giving it some code which switches to the
198    readonly data section) or else you can #define the symbols
199    EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
200    SELECT_RTX_SECTION.  We do both here just to be on the safe side.  */
201
202 #undef USE_CONST_SECTION
203 #define USE_CONST_SECTION       1
204
205 #undef  CONST_SECTION_ASM_OP
206 #define CONST_SECTION_ASM_OP    "\t.section\t.rodata"
207
208 #undef  BSS_SECTION_ASM_OP
209 #define BSS_SECTION_ASM_OP      "\t.section\t.bss"
210 #undef  SBSS_SECTION_ASM_OP
211 #define SBSS_SECTION_ASM_OP     "\t.section\t.sbss,\"aw\""
212 #undef  SDATA_SECTION_ASM_OP
213 #define SDATA_SECTION_ASM_OP    "\t.section\t.sdata,\"aw\""
214
215 /* On svr4, we *do* have support for the .init and .fini sections, and we
216    can put stuff in there to be executed before and after `main'.  We let
217    crtstuff.c and other files know this by defining the following symbols.
218    The definitions say how to change sections to the .init and .fini
219    sections.  This is the same for all known svr4 assemblers.  */
220
221 #undef  INIT_SECTION_ASM_OP
222 #define INIT_SECTION_ASM_OP     "\t.section\t.init"
223 #undef  FINI_SECTION_ASM_OP
224 #define FINI_SECTION_ASM_OP     "\t.section\t.fini"
225
226 #ifdef HAVE_GAS_SUBSECTION_ORDERING
227
228 #define ASM_SECTION_START_OP    "\t.subsection\t-1"
229
230 /* Output assembly directive to move to the beginning of current section.  */
231 #define ASM_OUTPUT_SECTION_START(FILE)  \
232   fprintf ((FILE), "%s\n", ASM_SECTION_START_OP)
233
234 #endif
235
236 /* A default list of other sections which we might be "in" at any given
237    time.  For targets that use additional sections (e.g. .tdesc) you
238    should override this definition in the target-specific file which
239    includes this file.  */
240
241 #undef  EXTRA_SECTIONS
242 #define EXTRA_SECTIONS in_const, in_sbss, in_sdata
243
244 /* A default list of extra section function definitions.  For targets
245    that use additional sections (e.g. .tdesc) you should override this
246    definition in the target-specific file which includes this file.  */
247
248 #undef  EXTRA_SECTION_FUNCTIONS
249 #define EXTRA_SECTION_FUNCTIONS                                         \
250   CONST_SECTION_FUNCTION                                                \
251   SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) \
252   SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP)
253
254 extern void sbss_section                PARAMS ((void));
255 extern void sdata_section               PARAMS ((void));
256
257 #undef  READONLY_DATA_SECTION
258 #define READONLY_DATA_SECTION() const_section ()
259
260 #undef  CONST_SECTION_FUNCTION
261 #define CONST_SECTION_FUNCTION                                  \
262 void                                                            \
263 const_section ()                                                \
264 {                                                               \
265   if (!USE_CONST_SECTION)                                       \
266     text_section();                                             \
267   else if (in_section != in_const)                              \
268     {                                                           \
269       fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP);     \
270       in_section = in_const;                                    \
271     }                                                           \
272 }
273
274 #undef  SECTION_FUNCTION_TEMPLATE
275 #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \
276 void FN ()                                      \
277 {                                               \
278   if (in_section != ENUM)                       \
279     {                                           \
280       fprintf (asm_out_file, "%s\n", OP);       \
281       in_section = ENUM;                        \
282     }                                           \
283 }
284
285 /* Switch into a generic section.  */
286 #define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
287
288 /* A C statement or statements to switch to the appropriate
289    section for output of DECL.  DECL is either a `VAR_DECL' node
290    or a constant of some sort.  RELOC indicates whether forming
291    the initial value of DECL requires link-time relocations.
292
293    Set SECNUM to:
294         0       .text
295         1       .rodata
296         2       .data
297         3       .sdata
298         4       .bss
299         5       .sbss
300 */
301
302 #define DO_SELECT_SECTION(SECNUM, DECL, RELOC)                  \
303   do                                                            \
304      {                                                          \
305        HOST_WIDE_INT size;                                      \
306        SECNUM = 1;                                              \
307        if (TREE_CODE (DECL) == FUNCTION_DECL)                   \
308          {                                                      \
309            SECNUM = 0;                                          \
310            break;                                               \
311          }                                                      \
312        else if (TREE_CODE (DECL) == STRING_CST)                 \
313          {                                                      \
314            if (flag_writable_strings)                           \
315              SECNUM = 2;                                        \
316            else                                                 \
317              SECNUM = 0x101;                                    \
318            break;                                               \
319          }                                                      \
320        else if (TREE_CODE (DECL) == VAR_DECL)                   \
321          {                                                      \
322            if (DECL_INITIAL (DECL) == NULL                      \
323                || DECL_INITIAL (DECL) == error_mark_node)       \
324              SECNUM = 4;                                        \
325            else if ((flag_pic && RELOC)                         \
326                     || ! TREE_READONLY (DECL)                   \
327                     || TREE_SIDE_EFFECTS (DECL)                 \
328                     || ! TREE_CONSTANT (DECL_INITIAL (DECL)))   \
329              SECNUM = 2;                                        \
330           else if (flag_merge_constants >= 2)                   \
331             {                                                   \
332               /* C and C++ don't allow different variables to   \
333                  share the same location.  -fmerge-all-constants\
334                  allows even that (at the expense of not        \
335                  conforming).  */                               \
336               if (TREE_CODE (DECL_INITIAL (DECL)) == STRING_CST)\
337                 SECNUM = 0x201;                                 \
338               else                                              \
339                 SECNUM = 0x301;                                 \
340             }                                                   \
341          }                                                      \
342        else if (TREE_CODE (DECL) == CONSTRUCTOR)                \
343          {                                                      \
344            if ((flag_pic && RELOC)                              \
345                || TREE_SIDE_EFFECTS (DECL)                      \
346                || ! TREE_CONSTANT (DECL))                       \
347              SECNUM = 2;                                        \
348          }                                                      \
349                                                                 \
350        /* Select small data sections based on size.  */         \
351        size = int_size_in_bytes (TREE_TYPE (DECL));             \
352        if (size >= 0 && size <= g_switch_value)                 \
353          {                                                      \
354            if ((SECNUM & 0xff) >= 2)                            \
355              SECNUM += 1;                                       \
356            /* Move readonly data to .sdata only if -msmall-data.  */ \
357            /* ??? Consider .sdata.{lit4,lit8} as                \
358               SHF_MERGE|SHF_ALPHA_GPREL.  */                    \
359            else if (TARGET_SMALL_DATA)                          \
360              SECNUM = 3;                                        \
361          }                                                      \
362      }                                                          \
363    while (0)
364
365 #undef  SELECT_SECTION
366 #define SELECT_SECTION(DECL, RELOC, ALIGN)              \
367   do                                                    \
368     {                                                   \
369       typedef void (*sec_fn) PARAMS ((void));           \
370       static sec_fn const sec_functions[6] =            \
371       {                                                 \
372         text_section,                                   \
373         const_section,                                  \
374         data_section,                                   \
375         sdata_section,                                  \
376         bss_section,                                    \
377         sbss_section                                    \
378       };                                                \
379                                                         \
380       int sec;                                          \
381                                                         \
382       DO_SELECT_SECTION (sec, DECL, RELOC);             \
383                                                         \
384       switch (sec)                                      \
385         {                                               \
386         case 0x101:                                     \
387           mergeable_string_section (DECL, ALIGN, 0);    \
388           break;                                        \
389         case 0x201:                                     \
390           mergeable_string_section (DECL_INITIAL (DECL),\
391                                     ALIGN, 0);          \
392           break;                                        \
393         case 0x301:                                     \
394           mergeable_constant_section (DECL_MODE (DECL), \
395                                       ALIGN, 0);        \
396           break;                                        \
397         default:                                        \
398           (*sec_functions[sec]) ();                     \
399           break;                                        \
400         }                                               \
401     }                                                   \
402   while (0)
403
404 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
405
406 #undef  UNIQUE_SECTION
407 #define UNIQUE_SECTION(DECL, RELOC)                                     \
408   do                                                                    \
409     {                                                                   \
410       static const char * const prefixes[6][2] =                        \
411       {                                                                 \
412         { ".text.",   ".gnu.linkonce.t." },                             \
413         { ".rodata.", ".gnu.linkonce.r." },                             \
414         { ".data.",   ".gnu.linkonce.d." },                             \
415         { ".sdata.",  ".gnu.linkonce.s." },                             \
416         { ".bss.",    ".gnu.linkonce.b." },                             \
417         { ".sbss.",   ".gnu.linkonce.sb." }                             \
418       };                                                                \
419                                                                         \
420       int nlen, plen, sec;                                              \
421       const char *name, *prefix;                                        \
422       char *string;                                                     \
423                                                                         \
424       DO_SELECT_SECTION (sec, DECL, RELOC);                             \
425                                                                         \
426       name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));           \
427       STRIP_NAME_ENCODING (name, name);                                 \
428       nlen = strlen (name);                                             \
429                                                                         \
430       prefix = prefixes[sec & 0xff][DECL_ONE_ONLY(DECL)];               \
431       plen = strlen (prefix);                                           \
432                                                                         \
433       string = alloca (nlen + plen + 1);                                \
434                                                                         \
435       memcpy (string, prefix, plen);                                    \
436       memcpy (string + plen, name, nlen + 1);                           \
437                                                                         \
438       DECL_SECTION_NAME (DECL) = build_string (nlen + plen, string);    \
439     }                                                                   \
440   while (0)
441
442 /* A C statement or statements to switch to the appropriate
443    section for output of RTX in mode MODE.  RTX is some kind
444    of constant in RTL.  The argument MODE is redundant except
445    in the case of a `const_int' rtx.  Currently, these always
446    go into the const section.  */
447
448 #undef  SELECT_RTX_SECTION
449 #define SELECT_RTX_SECTION(MODE, RTX, ALIGN)                            \
450 do {                                                                    \
451   if (TARGET_SMALL_DATA && GET_MODE_SIZE (MODE) <= g_switch_value)      \
452      /* ??? Consider .sdata.{lit4,lit8} as SHF_MERGE|SHF_ALPHA_GPREL.  */ \
453     sdata_section ();                                                   \
454   else                                                                  \
455     mergeable_constant_section((MODE), (ALIGN), 0);                     \
456 } while (0)
457
458 /* Define the strings used for the special svr4 .type and .size directives.
459    These strings generally do not vary from one system running svr4 to
460    another, but if a given system (e.g. m88k running svr) needs to use
461    different pseudo-op names for these, they may be overridden in the
462    file which includes this one.  */
463
464 #undef  TYPE_ASM_OP
465 #define TYPE_ASM_OP     "\t.type\t"
466 #undef  SIZE_ASM_OP
467 #define SIZE_ASM_OP     "\t.size\t"
468
469 /* This is how we tell the assembler that a symbol is weak.  */
470
471 #undef  ASM_WEAKEN_LABEL
472 #define ASM_WEAKEN_LABEL(FILE, NAME) \
473   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
474        fputc ('\n', FILE); } while (0)
475
476 /* This is how we tell the assembler that two symbols have the same value.  */
477
478 #undef  ASM_OUTPUT_DEF
479 #define ASM_OUTPUT_DEF(FILE, ALIAS, NAME)                       \
480   do {                                                          \
481     assemble_name(FILE, ALIAS);                                 \
482     fputs(" = ", FILE);                                         \
483     assemble_name(FILE, NAME);                                  \
484     fputc('\n', FILE);                                          \
485   } while (0)
486
487 #undef  ASM_OUTPUT_DEF_FROM_DECLS
488 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET)           \
489   do {                                                          \
490     const char *alias = XSTR (XEXP (DECL_RTL (DECL), 0), 0);    \
491     const char *name = IDENTIFIER_POINTER (TARGET);             \
492     if (TREE_CODE (DECL) == FUNCTION_DECL)                      \
493       {                                                         \
494         fputc ('$', FILE);                                      \
495         assemble_name (FILE, alias);                            \
496         fputs ("..ng = $", FILE);                               \
497         assemble_name (FILE, name);                             \
498         fputs ("..ng\n", FILE);                                 \
499       }                                                         \
500     assemble_name(FILE, alias);                                 \
501     fputs(" = ", FILE);                                         \
502     assemble_name(FILE, name);                                  \
503     fputc('\n', FILE);                                          \
504   } while (0)
505
506 /* The following macro defines the format used to output the second
507    operand of the .type assembler directive.  Different svr4 assemblers
508    expect various different forms for this operand.  The one given here
509    is just a default.  You may need to override it in your machine-
510    specific tm.h file (depending upon the particulars of your assembler).  */
511
512 #undef  TYPE_OPERAND_FMT
513 #define TYPE_OPERAND_FMT        "@%s"
514
515 /* Write the extra assembler code needed to declare a function's result.
516    Most svr4 assemblers don't require any special declaration of the
517    result value, but there are exceptions.  */
518
519 #ifndef ASM_DECLARE_RESULT
520 #define ASM_DECLARE_RESULT(FILE, RESULT)
521 #endif
522
523 /* These macros generate the special .type and .size directives which
524    are used to set the corresponding fields of the linker symbol table
525    entries in an ELF object file under SVR4.  These macros also output
526    the starting labels for the relevant functions/objects.  */
527
528 /* Write the extra assembler code needed to declare an object properly.  */
529
530 #undef  ASM_DECLARE_OBJECT_NAME
531 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)               \
532   do {                                                          \
533     HOST_WIDE_INT size;                                         \
534     fprintf (FILE, "%s", TYPE_ASM_OP);                          \
535     assemble_name (FILE, NAME);                                 \
536     putc (',', FILE);                                           \
537     fprintf (FILE, TYPE_OPERAND_FMT, "object");                 \
538     putc ('\n', FILE);                                          \
539     size_directive_output = 0;                                  \
540     if (!flag_inhibit_size_directive                            \
541         && DECL_SIZE (DECL)                                     \
542         && (size = int_size_in_bytes (TREE_TYPE (DECL))) > 0)   \
543       {                                                         \
544         size_directive_output = 1;                              \
545         fprintf (FILE, "%s", SIZE_ASM_OP);                      \
546         assemble_name (FILE, NAME);                             \
547         fputc (',', FILE);                                      \
548         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, size);          \
549         fputc ('\n', FILE);                                     \
550       }                                                         \
551     ASM_OUTPUT_LABEL(FILE, NAME);                               \
552   } while (0)
553
554 /* Output the size directive for a decl in rest_of_decl_compilation
555    in the case where we did not do so before the initializer.
556    Once we find the error_mark_node, we know that the value of
557    size_directive_output was set
558    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
559
560 #undef  ASM_FINISH_DECLARE_OBJECT
561 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)        \
562   do {                                                                  \
563     const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);             \
564     HOST_WIDE_INT size;                                                 \
565     if (!flag_inhibit_size_directive                                    \
566         && DECL_SIZE (DECL)                                             \
567         && ! AT_END && TOP_LEVEL                                        \
568         && DECL_INITIAL (DECL) == error_mark_node                       \
569         && !size_directive_output                                       \
570         && (size = int_size_in_bytes (TREE_TYPE (DECL))) > 0)           \
571       {                                                                 \
572         size_directive_output = 1;                                      \
573         fprintf (FILE, "%s", SIZE_ASM_OP);                              \
574         assemble_name (FILE, name);                                     \
575         fputc (',', FILE);                                              \
576         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, size);                  \
577         fputc ('\n', FILE);                                             \
578       }                                                                 \
579   } while (0)
580
581 /* A table of bytes codes used by the ASM_OUTPUT_ASCII and
582    ASM_OUTPUT_LIMITED_STRING macros.  Each byte in the table
583    corresponds to a particular byte value [0..255].  For any
584    given byte value, if the value in the corresponding table
585    position is zero, the given character can be output directly.
586    If the table value is 1, the byte must be output as a \ooo
587    octal escape.  If the tables value is anything else, then the
588    byte value should be output as a \ followed by the value
589    in the table.  Note that we can use standard UN*X escape
590    sequences for many control characters, but we don't use
591    \a to represent BEL because some svr4 assemblers (e.g. on
592    the i386) don't know about that.  Also, we don't use \v
593    since some versions of gas, such as 2.2 did not accept it.  */
594
595 #undef  ESCAPES
596 #define ESCAPES \
597 "\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\
598 \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\
599 \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\
600 \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\
601 \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\
602 \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\
603 \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\
604 \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"
605
606 /* Some svr4 assemblers have a limit on the number of characters which
607    can appear in the operand of a .string directive.  If your assembler
608    has such a limitation, you should define STRING_LIMIT to reflect that
609    limit.  Note that at least some svr4 assemblers have a limit on the
610    actual number of bytes in the double-quoted string, and that they
611    count each character in an escape sequence as one byte.  Thus, an
612    escape sequence like \377 would count as four bytes.
613
614    If your target assembler doesn't support the .string directive, you
615    should define this to zero.  */
616
617 #undef  STRING_LIMIT
618 #define STRING_LIMIT    ((unsigned) 256)
619 #undef  STRING_ASM_OP
620 #define STRING_ASM_OP   "\t.string\t"
621
622 /* GAS is the only Alpha/ELF assembler.  */
623 #undef  TARGET_GAS
624 #define TARGET_GAS      (1)
625
626 /* Provide a STARTFILE_SPEC appropriate for ELF.  Here we add the
627    (even more) magical crtbegin.o file which provides part of the
628    support for getting C++ file-scope static object constructed
629    before entering `main'.   */
630
631 #undef  STARTFILE_SPEC
632 #define STARTFILE_SPEC \
633   "%{!shared: \
634      %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
635    crti.o%s %{static:crtbeginT.o%s}\
636    %{!static:%{shared:crtbeginS.o%s}%{!shared:crtbegin.o%s}}"
637
638 /* Provide a ENDFILE_SPEC appropriate for ELF.  Here we tack on the
639    magical crtend.o file which provides part of the support for
640    getting C++ file-scope static object constructed before entering
641    `main', followed by a normal ELF "finalizer" file, `crtn.o'.  */
642
643 #undef  ENDFILE_SPEC
644 #define ENDFILE_SPEC \
645   "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
646    %{shared:crtendS.o%s}%{!shared:crtend.o%s} crtn.o%s"
647
648 /* We support #pragma.  */
649 #define HANDLE_SYSV_PRAGMA
650
651 /* Select a format to encode pointers in exception handling data.  CODE
652    is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
653    true if the symbol may be affected by dynamic relocations.
654
655    Since application size is already constrained to <2GB by the form of
656    the ldgp relocation, we can use a 32-bit pc-relative relocation to
657    static data.  Dynamic data is accessed indirectly to allow for read
658    only EH sections.  */
659 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)       \
660   (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4)
661
662 /* If defined, a C statement to be executed just prior to the output of
663    assembler code for INSN.  */
664 #define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS)      \
665  (alpha_this_literal_sequence_number = 0,               \
666   alpha_this_gpdisp_sequence_number = 0)
667 extern int alpha_this_literal_sequence_number;
668 extern int alpha_this_gpdisp_sequence_number;
669
670 /* Since the bits of the _init and _fini function is spread across
671    many object files, each potentially with its own GP, we must assume
672    we need to load our GP.  Further, the .init/.fini section can
673    easily be more than 4MB away from the function to call so we can't
674    use bsr.  */
675 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)      \
676    asm (SECTION_OP "\n"                                 \
677 "       br $29,1f\n"                                    \
678 "1:     ldgp $29,0($29)\n"                              \
679 "       unop\n"                                         \
680 "       jsr $26," USER_LABEL_PREFIX #FUNC "\n"          \
681 "       .align 3\n"                                     \
682 "       .previous");
683
684 /* If we have the capability create headers for efficient EH lookup.
685    As of Jan 2002, only glibc 2.2.4 can actually make use of this, but
686    I imagine that other systems will catch up.  In the meantime, it
687    doesn't harm to make sure that the data exists to be used later.  */
688 #if defined(HAVE_LD_EH_FRAME_HDR)
689 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
690 #endif