OSDN Git Service

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