OSDN Git Service

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