OSDN Git Service

* fixinc/fixtests.c(stdc_0_in_system_headers_test): Must return "FIX"
[pf3gnuchains/gcc-fork.git] / gcc / config / elfos.h
1 /* elfos.h  --  operating system specific defines to be used when
2    targeting GCC for some generic ELF system
3    Copyright (C) 1991, 1994, 1995, 1999, 2000, 2001
4    Free Software Foundation, Inc.
5    Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com).
6
7 This file is part of GNU CC.
8
9 GNU CC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 GNU CC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GNU CC; see the file COPYING.  If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA.  */
23
24 /* The prefix to add to user-visible assembler symbols.
25
26    For ELF systems the convention is *not* to prepend a leading
27    underscore onto user-level symbol names.  */
28
29 #undef  USER_LABEL_PREFIX
30 #define USER_LABEL_PREFIX ""
31
32 /* Biggest alignment supported by the object file format of this
33    machine.  Use this macro to limit the alignment which can be
34    specified using the `__attribute__ ((aligned (N)))' construct.  If
35    not defined, the default value is `BIGGEST_ALIGNMENT'.  */
36 #ifndef MAX_OFILE_ALIGNMENT
37 #define MAX_OFILE_ALIGNMENT (32768 * 8)
38 #endif
39
40 #undef  ENDFILE_SPEC
41 #define ENDFILE_SPEC "crtend.o%s"
42
43 #undef  STARTFILE_SPEC
44 #define STARTFILE_SPEC "%{!shared: \
45                          %{!symbolic: \
46                           %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\
47                         crtbegin.o%s"
48
49 /* Use periods rather than dollar signs in special g++ assembler names.  */
50
51 #define NO_DOLLAR_IN_LABEL
52
53 /* Writing `int' for a bitfield forces int alignment for the structure.  */
54
55 #define PCC_BITFIELD_TYPE_MATTERS 1
56
57 /* Implicit library calls should use memcpy, not bcopy, etc.  */
58
59 #define TARGET_MEM_FUNCTIONS
60
61 /* Handle #pragma weak and #pragma pack.  */
62
63 #define HANDLE_SYSV_PRAGMA
64
65 /* System V Release 4 uses DWARF debugging info.  */
66
67 #ifndef DWARF_DEBUGGING_INFO
68 #define DWARF_DEBUGGING_INFO 1
69 #endif
70
71 /* All ELF targets can support DWARF-2.  */
72
73 #ifndef DWARF2_DEBUGGING_INFO
74 #define DWARF2_DEBUGGING_INFO 1
75 #endif
76
77 /* Also allow them to support STABS debugging.  */
78
79 #include "dbxelf.h"
80
81 /* The GNU tools operate better with stabs.  Since we don't have
82    any native tools to be compatible with, default to stabs.  */
83
84 #ifndef PREFERRED_DEBUGGING_TYPE
85 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
86 #endif
87
88 /* All SVR4 targets use the ELF object file format.  */
89 #define OBJECT_FORMAT_ELF
90
91
92 /* Output #ident as a .ident.  */
93
94 #define ASM_OUTPUT_IDENT(FILE, NAME) \
95   fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME);
96
97 #define IDENT_ASM_OP "\t.ident\t"
98
99 #undef  ASM_BYTE_OP
100 #define ASM_BYTE_OP     "\t.byte\t"
101
102 #undef  SET_ASM_OP
103 #define SET_ASM_OP      "\t.set\t"
104
105 /* This is how to begin an assembly language file.  Most svr4 assemblers want
106    at least a .file directive to come first, and some want to see a .version
107    directive come right after that.  Here we just establish a default
108    which generates only the .file directive.  If you need a .version
109    directive for any specific target, you should override this definition
110    in the target-specific file which includes this one.  */
111
112 #undef ASM_FILE_START
113 #define ASM_FILE_START(FILE)                            \
114   output_file_directive ((FILE), main_input_filename)
115
116 /* This is how to allocate empty space in some section.  The .zero
117    pseudo-op is used for this on most svr4 assemblers.  */
118
119 #define SKIP_ASM_OP     "\t.zero\t"
120
121 #undef  ASM_OUTPUT_SKIP
122 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
123   fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (SIZE))
124
125 /* This is how to output an internal numbered label where
126    PREFIX is the class of label and NUM is the number within the class.
127
128    For most svr4 systems, the convention is that any symbol which begins
129    with a period is not put into the linker symbol table by the assembler.  */
130
131 #undef  ASM_OUTPUT_INTERNAL_LABEL
132 #define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM)    \
133   do                                                    \
134     {                                                   \
135       fprintf (FILE, ".%s%d:\n", PREFIX, NUM);          \
136     }                                                   \
137   while (0)
138
139 /* This is how to store into the string LABEL
140    the symbol_ref name of an internal numbered label where
141    PREFIX is the class of label and NUM is the number within the class.
142    This is suitable for output with `assemble_name'.
143
144    For most svr4 systems, the convention is that any symbol which begins
145    with a period is not put into the linker symbol table by the assembler.  */
146
147 #undef  ASM_GENERATE_INTERNAL_LABEL
148 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM)         \
149   do                                                            \
150     {                                                           \
151       sprintf (LABEL, "*.%s%u", PREFIX, (unsigned) (NUM));      \
152     }                                                           \
153   while (0)
154
155 /* Output the label which precedes a jumptable.  Note that for all svr4
156    systems where we actually generate jumptables (which is to say every
157    svr4 target except i386, where we use casesi instead) we put the jump-
158    tables into the .rodata section and since other stuff could have been
159    put into the .rodata section prior to any given jumptable, we have to
160    make sure that the location counter for the .rodata section gets pro-
161    perly re-aligned prior to the actual beginning of the jump table.  */
162
163 #define ALIGN_ASM_OP "\t.align\t"
164
165 #ifndef ASM_OUTPUT_BEFORE_CASE_LABEL
166 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \
167   ASM_OUTPUT_ALIGN ((FILE), 2);
168 #endif
169
170 #undef  ASM_OUTPUT_CASE_LABEL
171 #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE)             \
172   do                                                                    \
173     {                                                                   \
174       ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE)       \
175         ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM);                  \
176     }                                                                   \
177   while (0)
178
179 /* The standard SVR4 assembler seems to require that certain builtin
180    library routines (e.g. .udiv) be explicitly declared as .globl
181    in each assembly file where they are referenced.  */
182
183 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)  \
184   ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
185
186 /* This says how to output assembler code to declare an
187    uninitialized external linkage data object.  Under SVR4,
188    the linker seems to want the alignment of data objects
189    to depend on their types.  We do exactly that here.  */
190
191 #define COMMON_ASM_OP   "\t.comm\t"
192
193 #undef  ASM_OUTPUT_ALIGNED_COMMON
194 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)              \
195   do                                                                    \
196     {                                                                   \
197       fprintf ((FILE), "%s", COMMON_ASM_OP);                            \
198       assemble_name ((FILE), (NAME));                                   \
199       fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT);    \
200     }                                                                   \
201   while (0)
202
203 /* This says how to output assembler code to declare an
204    uninitialized internal linkage data object.  Under SVR4,
205    the linker seems to want the alignment of data objects
206    to depend on their types.  We do exactly that here.  */
207
208 #define LOCAL_ASM_OP    "\t.local\t"
209
210 #undef  ASM_OUTPUT_ALIGNED_LOCAL
211 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)       \
212   do                                                            \
213     {                                                           \
214       fprintf ((FILE), "%s", LOCAL_ASM_OP);                     \
215       assemble_name ((FILE), (NAME));                           \
216       fprintf ((FILE), "\n");                                   \
217       ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN);      \
218     }                                                           \
219   while (0)
220
221 /* This is the pseudo-op used to generate a reference to a specific
222    symbol in some section.  It is only used in machine-specific
223    configuration files, typically only in ASM_OUTPUT_CONSTRUCTOR and
224    ASM_OUTPUT_DESTRUCTOR.  This is the same for all known svr4
225    assemblers, except those in targets that don't use 32-bit pointers.
226    Those should override INT_ASM_OP.  Yes, the name of the macro is
227    misleading.  */
228
229 #ifndef INT_ASM_OP
230 #define INT_ASM_OP              "\t.long\t"
231 #endif
232
233 /* This is the pseudo-op used to generate a contiguous sequence of byte
234    values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
235    AUTOMATICALLY APPENDED.  This is the same for most svr4 assemblers.  */
236
237 #undef  ASCII_DATA_ASM_OP
238 #define ASCII_DATA_ASM_OP       "\t.ascii\t"
239
240 /* Support const sections and the ctors and dtors sections for g++.
241    Note that there appears to be two different ways to support const
242    sections at the moment.  You can either #define the symbol
243    READONLY_DATA_SECTION (giving it some code which switches to the
244    readonly data section) or else you can #define the symbols
245    EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
246    SELECT_RTX_SECTION.  We do both here just to be on the safe side.  */
247
248 #define USE_CONST_SECTION       1
249
250 #define CONST_SECTION_ASM_OP    "\t.section\t.rodata"
251
252 /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
253
254    Note that we want to give these sections the SHF_WRITE attribute
255    because these sections will actually contain data (i.e. tables of
256    addresses of functions in the current root executable or shared library
257    file) and, in the case of a shared library, the relocatable addresses
258    will have to be properly resolved/relocated (and then written into) by
259    the dynamic linker when it actually attaches the given shared library
260    to the executing process.  (Note that on SVR4, you may wish to use the
261    `-z text' option to the ELF linker, when building a shared library, as
262    an additional check that you are doing everything right.  But if you do
263    use the `-z text' option when building a shared library, you will get
264    errors unless the .ctors and .dtors sections are marked as writable
265    via the SHF_WRITE attribute.)  */
266
267 #define CTORS_SECTION_ASM_OP    "\t.section\t.ctors,\"aw\""
268 #define DTORS_SECTION_ASM_OP    "\t.section\t.dtors,\"aw\""
269
270 /* On svr4, we *do* have support for the .init and .fini sections, and we
271    can put stuff in there to be executed before and after `main'.  We let
272    crtstuff.c and other files know this by defining the following symbols.
273    The definitions say how to change sections to the .init and .fini
274    sections.  This is the same for all known svr4 assemblers.  */
275
276 #define INIT_SECTION_ASM_OP     "\t.section\t.init"
277 #define FINI_SECTION_ASM_OP     "\t.section\t.fini"
278
279 /* A default list of other sections which we might be "in" at any given
280    time.  For targets that use additional sections (e.g. .tdesc) you
281    should override this definition in the target-specific file which
282    includes this file.  */
283
284 #undef  EXTRA_SECTIONS
285 #define EXTRA_SECTIONS in_const, in_ctors, in_dtors
286
287 /* A default list of extra section function definitions.  For targets
288    that use additional sections (e.g. .tdesc) you should override this
289    definition in the target-specific file which includes this file.  */
290
291 #undef  EXTRA_SECTION_FUNCTIONS
292 #define EXTRA_SECTION_FUNCTIONS         \
293   CONST_SECTION_FUNCTION                \
294   CTORS_SECTION_FUNCTION                \
295   DTORS_SECTION_FUNCTION
296
297 #define READONLY_DATA_SECTION() const_section ()
298
299 #define CONST_SECTION_FUNCTION                                  \
300 void                                                            \
301 const_section ()                                                \
302 {                                                               \
303   if (!USE_CONST_SECTION)                                       \
304     text_section ();                                            \
305   else if (in_section != in_const)                              \
306     {                                                           \
307       fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP);     \
308       in_section = in_const;                                    \
309     }                                                           \
310 }
311
312 #define CTORS_SECTION_FUNCTION                                  \
313 void                                                            \
314 ctors_section ()                                                \
315 {                                                               \
316   if (in_section != in_ctors)                                   \
317     {                                                           \
318       fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);     \
319       in_section = in_ctors;                                    \
320     }                                                           \
321 }
322
323 #define DTORS_SECTION_FUNCTION                                  \
324 void                                                            \
325 dtors_section ()                                                \
326 {                                                               \
327   if (in_section != in_dtors)                                   \
328     {                                                           \
329       fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);     \
330       in_section = in_dtors;                                    \
331     }                                                           \
332 }
333
334 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
335
336 #define UNIQUE_SECTION_P(DECL)   (DECL_ONE_ONLY (DECL))
337
338 #define UNIQUE_SECTION(DECL, RELOC)                             \
339   do                                                            \
340     {                                                           \
341       int len;                                                  \
342       int sec;                                                  \
343       const char *name;                                         \
344       char *string;                                             \
345       const char *prefix;                                       \
346       static const char *prefixes[/*4*/3][2] =                  \
347       {                                                         \
348         { ".text.",   ".gnu.linkonce.t." },                     \
349         { ".rodata.", ".gnu.linkonce.r." },                     \
350         { ".data.",   ".gnu.linkonce.d." }                      \
351         /* Do not generate unique sections for uninitialised    \
352            data since we do not have support for this in the    \
353            linker scripts yet...                                \
354         ,{ ".bss.",    ".gnu.linkonce.b." }  */                 \
355       };                                                        \
356                                                                 \
357       if (TREE_CODE (DECL) == FUNCTION_DECL)                    \
358         sec = 0;                                                \
359   /*  else if (DECL_INITIAL (DECL) == 0                         \
360                || DECL_INITIAL (DECL) == error_mark_node)       \
361         sec =  3; */                                            \
362       else if (DECL_READONLY_SECTION (DECL, RELOC))             \
363         sec = 1;                                                \
364       else                                                      \
365         sec = 2;                                                \
366                                                                 \
367       name   = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
368       /* Strip off any encoding in name.  */                    \
369       STRIP_NAME_ENCODING (name, name);                         \
370       prefix = prefixes[sec][DECL_ONE_ONLY(DECL)];              \
371       len    = strlen (name) + strlen (prefix);                 \
372       string = alloca (len + 1);                                \
373                                                                 \
374       sprintf (string, "%s%s", prefix, name);                   \
375                                                                 \
376       DECL_SECTION_NAME (DECL) = build_string (len, string);    \
377     }                                                           \
378   while (0)
379      
380 /* A C statement (sans semicolon) to output an
381    element in the table of global constructors.  */
382 #define ASM_OUTPUT_CONSTRUCTOR(FILE, NAME)                      \
383   do                                                            \
384     {                                                           \
385       ctors_section ();                                         \
386       fprintf (FILE, "%s", INT_ASM_OP);                         \
387       assemble_name (FILE, NAME);                               \
388       fprintf (FILE, "\n");                                     \
389     }                                                           \
390   while (0)
391
392 /* A C statement (sans semicolon) to output an
393    element in the table of global destructors.  */
394 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)                        \
395   do                                                            \
396     {                                                           \
397       dtors_section ();                                         \
398       fprintf (FILE, "%s", INT_ASM_OP);                         \
399       assemble_name (FILE, NAME);                               \
400       fprintf (FILE, "\n");                                     \
401     }                                                           \
402   while (0)
403
404 /* Switch into a generic section.
405  
406    We make the section read-only and executable for a function decl,
407    read-only for a const data decl, and writable for a non-const data decl.
408  
409    If the section has already been defined, we must not
410    emit the attributes here. The SVR4 assembler does not
411    recognize section redefinitions.
412    If DECL is NULL, no attributes are emitted.  */
413
414 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC)                \
415   do                                                                    \
416     {                                                                   \
417       static htab_t htab;                                               \
418                                                                         \
419       struct section_info                                               \
420       {                                                                 \
421         enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type;              \
422       };                                                                \
423                                                                         \
424       struct section_info *s;                                           \
425       const char *mode;                                                 \
426       enum sect_enum type;                                              \
427       PTR* slot;                                                        \
428                                                                         \
429       /* The names we put in the hashtable will always be the unique    \
430          versions gived to us by the stringtable, so we can just use    \
431          their addresses as the keys.  */                               \
432       if (!htab)                                                        \
433         htab = htab_create (31,                                         \
434                             htab_hash_pointer,                          \
435                             htab_eq_pointer,                            \
436                             NULL);                                      \
437                                                                         \
438       if (DECL && TREE_CODE (DECL) == FUNCTION_DECL)                    \
439         type = SECT_EXEC, mode = "ax";                                  \
440       else if (DECL && DECL_READONLY_SECTION (DECL, RELOC))             \
441         type = SECT_RO, mode = "a";                                     \
442       else                                                              \
443         type = SECT_RW, mode = "aw";                                    \
444                                                                         \
445                                                                         \
446       /* See if we already have an entry for this section.  */          \
447       slot = htab_find_slot (htab, NAME, INSERT);                       \
448       if (!*slot)                                                       \
449         {                                                               \
450           s = (struct section_info *) xmalloc (sizeof (* s));           \
451           s->type = type;                                               \
452           *slot = s;                                                    \
453           fprintf (FILE, "\t.section\t%s,\"%s\",@progbits\n",           \
454                    NAME, mode);                                         \
455         }                                                               \
456       else                                                              \
457         {                                                               \
458           s = (struct section_info *) *slot;                            \
459           if (DECL && s->type != type)                                  \
460             error_with_decl (DECL,                                      \
461                              "%s causes a section type conflict");      \
462                                                                         \
463           fprintf (FILE, "\t.section\t%s\n", NAME);                     \
464         }                                                               \
465     }                                                                   \
466   while (0)
467
468 /* A C statement or statements to switch to the appropriate
469    section for output of RTX in mode MODE.  RTX is some kind
470    of constant in RTL.  The argument MODE is redundant except
471    in the case of a `const_int' rtx.  Currently, these always
472    go into the const section.  */
473
474 #undef  SELECT_RTX_SECTION
475 #define SELECT_RTX_SECTION(MODE, RTX) const_section ()
476
477 /* A C statement or statements to switch to the appropriate
478    section for output of DECL.  DECL is either a `VAR_DECL' node
479    or a constant of some sort.  RELOC indicates whether forming
480    the initial value of DECL requires link-time relocations.  */
481
482 #undef SELECT_SECTION
483 #define SELECT_SECTION(DECL, RELOC)                             \
484 {                                                               \
485   if (TREE_CODE (DECL) == STRING_CST)                           \
486     {                                                           \
487       if (! flag_writable_strings)                              \
488         const_section ();                                       \
489       else                                                      \
490         data_section ();                                        \
491     }                                                           \
492   else if (TREE_CODE (DECL) == VAR_DECL)                        \
493     {                                                           \
494       if ((flag_pic && RELOC)                                   \
495           || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)  \
496           || !DECL_INITIAL (DECL)                               \
497           || (DECL_INITIAL (DECL) != error_mark_node            \
498               && !TREE_CONSTANT (DECL_INITIAL (DECL))))         \
499         data_section ();                                        \
500       else                                                      \
501         const_section ();                                       \
502     }                                                           \
503   else if (TREE_CODE (DECL) == CONSTRUCTOR)                     \
504     {                                                           \
505       if ((flag_pic && RELOC)                                   \
506           || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)  \
507           || ! TREE_CONSTANT (DECL))                            \
508         data_section ();                                        \
509       else                                                      \
510         const_section ();                                       \
511     }                                                           \
512   else                                                          \
513     const_section ();                                           \
514 }
515
516 /* Define the strings used for the special svr4 .type and .size directives.
517    These strings generally do not vary from one system running svr4 to
518    another, but if a given system (e.g. m88k running svr) needs to use
519    different pseudo-op names for these, they may be overridden in the
520    file which includes this one.  */
521
522 #define TYPE_ASM_OP     "\t.type\t"
523 #define SIZE_ASM_OP     "\t.size\t"
524
525 /* This is how we tell the assembler that a symbol is weak.  */
526
527 #define ASM_WEAKEN_LABEL(FILE, NAME)    \
528   do                                    \
529     {                                   \
530       fputs ("\t.weak\t", (FILE));      \
531       assemble_name ((FILE), (NAME));   \
532       fputc ('\n', (FILE));             \
533     }                                   \
534   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 #define TYPE_OPERAND_FMT        "@%s"
543
544 /* Write the extra assembler code needed to declare a function's result.
545    Most svr4 assemblers don't require any special declaration of the
546    result value, but there are exceptions.  */
547
548 #ifndef ASM_DECLARE_RESULT
549 #define ASM_DECLARE_RESULT(FILE, RESULT)
550 #endif
551
552 /* These macros generate the special .type and .size directives which
553    are used to set the corresponding fields of the linker symbol table
554    entries in an ELF object file under SVR4.  These macros also output
555    the starting labels for the relevant functions/objects.  */
556
557 /* Write the extra assembler code needed to declare a function properly.
558    Some svr4 assemblers need to also have something extra said about the
559    function's return value.  We allow for that here.  */
560
561 #ifndef ASM_DECLARE_FUNCTION_NAME
562 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)     \
563   do                                                    \
564     {                                                   \
565       fprintf (FILE, "%s", TYPE_ASM_OP);                \
566       assemble_name (FILE, NAME);                       \
567       putc (',', FILE);                                 \
568       fprintf (FILE, TYPE_OPERAND_FMT, "function");     \
569       putc ('\n', FILE);                                \
570                                                         \
571       ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));    \
572       ASM_OUTPUT_LABEL(FILE, NAME);                     \
573     }                                                   \
574   while (0)
575 #endif
576
577 /* Write the extra assembler code needed to declare an object properly.  */
578
579 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)               \
580   do                                                            \
581     {                                                           \
582       fprintf (FILE, "%s", TYPE_ASM_OP);                        \
583       assemble_name (FILE, NAME);                               \
584       putc (',', FILE);                                         \
585       fprintf (FILE, TYPE_OPERAND_FMT, "object");               \
586       putc ('\n', FILE);                                        \
587                                                                 \
588       size_directive_output = 0;                                \
589                                                                 \
590       if (!flag_inhibit_size_directive                          \
591           && (DECL) && DECL_SIZE (DECL))                        \
592         {                                                       \
593           size_directive_output = 1;                            \
594           fprintf (FILE, "%s", SIZE_ASM_OP);                    \
595           assemble_name (FILE, NAME);                           \
596           putc (',', FILE);                                     \
597           fprintf (FILE, HOST_WIDE_INT_PRINT_DEC,               \
598                    int_size_in_bytes (TREE_TYPE (DECL)));       \
599           fputc ('\n', FILE);                                   \
600         }                                                       \
601                                                                 \
602       ASM_OUTPUT_LABEL (FILE, NAME);                            \
603     }                                                           \
604   while (0)
605
606 /* Output the size directive for a decl in rest_of_decl_compilation
607    in the case where we did not do so before the initializer.
608    Once we find the error_mark_node, we know that the value of
609    size_directive_output was set
610    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
611
612 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
613   do                                                            \
614     {                                                           \
615       const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);   \
616                                                                 \
617       if (!flag_inhibit_size_directive                          \
618           && DECL_SIZE (DECL)                                   \
619           && ! AT_END && TOP_LEVEL                              \
620           && DECL_INITIAL (DECL) == error_mark_node             \
621           && !size_directive_output)                            \
622         {                                                       \
623           size_directive_output = 1;                            \
624           fprintf (FILE, "%s", SIZE_ASM_OP);                    \
625           assemble_name (FILE, name);                           \
626           putc (',', FILE);                                     \
627           fprintf (FILE, HOST_WIDE_INT_PRINT_DEC,               \
628                    int_size_in_bytes (TREE_TYPE (DECL)));       \
629           fputc ('\n', FILE);                                   \
630         }                                                       \
631     }                                                           \
632   while (0)
633
634 /* This is how to declare the size of a function.  */
635 #ifndef ASM_DECLARE_FUNCTION_SIZE
636 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)            \
637   do                                                            \
638     {                                                           \
639       if (!flag_inhibit_size_directive)                         \
640         {                                                       \
641           char label[256];                                      \
642           static int labelno;                                   \
643                                                                 \
644           labelno++;                                            \
645                                                                 \
646           ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno);  \
647           ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno);     \
648                                                                 \
649           fprintf (FILE, "%s", SIZE_ASM_OP);                    \
650           assemble_name (FILE, (FNAME));                        \
651           fprintf (FILE, ",");                                  \
652           assemble_name (FILE, label);                          \
653           fprintf (FILE, "-");                                  \
654           assemble_name (FILE, (FNAME));                        \
655           putc ('\n', FILE);                                    \
656         }                                                       \
657     }                                                           \
658   while (0)
659 #endif
660
661 /* A table of bytes codes used by the ASM_OUTPUT_ASCII and
662    ASM_OUTPUT_LIMITED_STRING macros.  Each byte in the table
663    corresponds to a particular byte value [0..255].  For any
664    given byte value, if the value in the corresponding table
665    position is zero, the given character can be output directly.
666    If the table value is 1, the byte must be output as a \ooo
667    octal escape.  If the tables value is anything else, then the
668    byte value should be output as a \ followed by the value
669    in the table.  Note that we can use standard UN*X escape
670    sequences for many control characters, but we don't use
671    \a to represent BEL because some svr4 assemblers (e.g. on
672    the i386) don't know about that.  Also, we don't use \v
673    since some versions of gas, such as 2.2 did not accept it.  */
674
675 #define ESCAPES \
676 "\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\
677 \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\
678 \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\
679 \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\
680 \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\
681 \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\
682 \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\
683 \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"
684
685 /* Some svr4 assemblers have a limit on the number of characters which
686    can appear in the operand of a .string directive.  If your assembler
687    has such a limitation, you should define STRING_LIMIT to reflect that
688    limit.  Note that at least some svr4 assemblers have a limit on the
689    actual number of bytes in the double-quoted string, and that they
690    count each character in an escape sequence as one byte.  Thus, an
691    escape sequence like \377 would count as four bytes.
692
693    If your target assembler doesn't support the .string directive, you
694    should define this to zero.
695 */
696
697 #define STRING_LIMIT    ((unsigned) 256)
698
699 #define STRING_ASM_OP   "\t.string\t"
700
701 /* The routine used to output NUL terminated strings.  We use a special
702    version of this for most svr4 targets because doing so makes the
703    generated assembly code more compact (and thus faster to assemble)
704    as well as more readable, especially for targets like the i386
705    (where the only alternative is to output character sequences as
706    comma separated lists of numbers).   */
707
708 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR)            \
709   do                                                    \
710     {                                                   \
711       register const unsigned char *_limited_str =      \
712         (const unsigned char *) (STR);                  \
713       register unsigned ch;                             \
714                                                         \
715       fprintf ((FILE), "%s\"", STRING_ASM_OP);          \
716                                                         \
717       for (; (ch = *_limited_str); _limited_str++)      \
718         {                                               \
719           register int escape;                          \
720                                                         \
721           switch (escape = ESCAPES[ch])                 \
722             {                                           \
723             case 0:                                     \
724               putc (ch, (FILE));                        \
725               break;                                    \
726             case 1:                                     \
727               fprintf ((FILE), "\\%03o", ch);           \
728               break;                                    \
729             default:                                    \
730               putc ('\\', (FILE));                      \
731               putc (escape, (FILE));                    \
732               break;                                    \
733             }                                           \
734         }                                               \
735                                                         \
736       fprintf ((FILE), "\"\n");                         \
737     }                                                   \
738   while (0)
739
740 /* The routine used to output sequences of byte values.  We use a special
741    version of this for most svr4 targets because doing so makes the
742    generated assembly code more compact (and thus faster to assemble)
743    as well as more readable.  Note that if we find subparts of the
744    character sequence which end with NUL (and which are shorter than
745    STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
746
747 #undef  ASM_OUTPUT_ASCII
748 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                             \
749   do                                                                    \
750     {                                                                   \
751       register const unsigned char *_ascii_bytes =                      \
752         (const unsigned char *) (STR);                                  \
753       register const unsigned char *limit = _ascii_bytes + (LENGTH);    \
754       register unsigned bytes_in_chunk = 0;                             \
755                                                                         \
756       for (; _ascii_bytes < limit; _ascii_bytes++)                      \
757         {                                                               \
758           register const unsigned char *p;                              \
759                                                                         \
760           if (bytes_in_chunk >= 60)                                     \
761             {                                                           \
762               fprintf ((FILE), "\"\n");                                 \
763               bytes_in_chunk = 0;                                       \
764             }                                                           \
765                                                                         \
766           for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
767             continue;                                                   \
768                                                                         \
769           if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT)    \
770             {                                                           \
771               if (bytes_in_chunk > 0)                                   \
772                 {                                                       \
773                   fprintf ((FILE), "\"\n");                             \
774                   bytes_in_chunk = 0;                                   \
775                 }                                                       \
776                                                                         \
777               ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
778               _ascii_bytes = p;                                         \
779             }                                                           \
780           else                                                          \
781             {                                                           \
782               register int escape;                                      \
783               register unsigned ch;                                     \
784                                                                         \
785               if (bytes_in_chunk == 0)                                  \
786                 fprintf ((FILE), "%s\"", ASCII_DATA_ASM_OP);            \
787                                                                         \
788               switch (escape = ESCAPES[ch = *_ascii_bytes])             \
789                 {                                                       \
790                 case 0:                                                 \
791                   putc (ch, (FILE));                                    \
792                   bytes_in_chunk++;                                     \
793                   break;                                                \
794                 case 1:                                                 \
795                   fprintf ((FILE), "\\%03o", ch);                       \
796                   bytes_in_chunk += 4;                                  \
797                   break;                                                \
798                 default:                                                \
799                   putc ('\\', (FILE));                                  \
800                   putc (escape, (FILE));                                \
801                   bytes_in_chunk += 2;                                  \
802                   break;                                                \
803                 }                                                       \
804             }                                                           \
805         }                                                               \
806                                                                         \
807       if (bytes_in_chunk > 0)                                           \
808         fprintf ((FILE), "\"\n");                                       \
809     }                                                                   \
810   while (0)