OSDN Git Service

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