Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / gcc / config / i386 / i386-interix.h
1 /* Target definitions for GNU compiler for Intel 80386 running Interix
2    Parts Copyright (C) 1991, 1999 Free Software Foundation, Inc.
3
4    Parts:
5      by Douglas B. Rupp (drupp@cs.washington.edu).
6      by Ron Guilmette (rfg@netcom.com).
7      by Donn Terry (donn@softway.com).
8      by Mumit Khan (khan@xraylith.wisc.edu).
9
10 This file is part of GNU CC.
11
12 GNU CC is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2, or (at your option)
15 any later version.
16
17 GNU CC is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with GNU CC; see the file COPYING.  If not, write to
24 the Free Software Foundation, 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.  */
26
27 #define YES_UNDERSCORES
28
29 /* YES_UNDERSCORES must preceed gas.h */
30 #include <i386/gas.h>
31 /* The rest must follow. */
32
33 #define DBX_DEBUGGING_INFO
34 #define SDB_DEBUGGING_INFO
35 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
36
37 #define HANDLE_SYSV_PRAGMA
38 #undef HANDLE_PRAGMA_WEAK  /* until the link format can handle it */
39
40 /* By default, target has a 80387, uses IEEE compatible arithmetic,
41    and returns float values in the 387 and needs stack probes
42    We also align doubles to 64-bits for MSVC default compatability */
43 #undef TARGET_DEFAULT
44 #define TARGET_DEFAULT \
45    (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE | \
46     MASK_ALIGN_DOUBLE)
47
48 #undef TARGET_CPU_DEFAULT
49 #define TARGET_CPU_DEFAULT 2 /* 486 */
50
51 #define WCHAR_UNSIGNED 1
52 #define WCHAR_TYPE_SIZE 16
53 #define WCHAR_TYPE "short unsigned int"
54
55 /* WinNT (and thus Interix) use unsigned int */
56 #define SIZE_TYPE "unsigned int"
57
58 #define ASM_LOAD_ADDR(loc, reg)   "     leal " #loc "," #reg "\n"
59
60 /* For the sake of libgcc2.c, indicate target supports atexit.  */
61 #define HAVE_ATEXIT
62
63 /* cpp handles __STDC__ */
64 #undef CPP_PREDEFINES
65 #define CPP_PREDEFINES " \
66   -D__INTERIX \
67   -D__OPENNT \
68   -D_M_IX86=300 -D_X86_=1 \
69   -D__stdcall=__attribute__((__stdcall__)) \
70   -D__cdecl=__attribute__((__cdecl__)) \
71   -Asystem(unix) -Asystem(interix) -Asystem(interix) -Acpu(i386) -Amachine(i386)"
72
73 #undef CPP_SPEC
74 /* Write out the correct language type definition for the header files.  
75    Unless we have assembler language, write out the symbols for C.
76    cpp_cpu is an Intel specific variant. See i386.h
77    mieee is an Alpha specific variant.  Cross polination a bad idea.
78    */
79 #define CPP_SPEC "\
80 %{!.S:  -D__LANGUAGE_C__ -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}  \
81 %{.S:   -D__LANGUAGE_ASSEMBLY__ -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
82 %{.cc:  -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
83 %{.cxx: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
84 %{.C:   -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
85 %{.m:   -D__LANGUAGE_OBJECTIVE_C__ -D__LANGUAGE_OBJECTIVE_C} \
86 -remap \
87 %(cpp_cpu) \
88 %{posix:-D_POSIX_SOURCE} \
89 -idirafter %$INTERIX_ROOT/usr/include"
90
91 #undef TARGET_VERSION
92 #define TARGET_VERSION fprintf (stderr, " (i386 Interix)");
93
94 /* The global __fltused is necessary to cause the printf/scanf routines
95    for outputting/inputting floating point numbers to be loaded.  Since this
96    is kind of hard to detect, we just do it all the time. */
97
98 #ifdef ASM_FILE_START
99 #undef ASM_FILE_START
100 #endif
101 #define ASM_FILE_START(FILE) \
102   do {  fprintf (FILE, "\t.file\t");                            \
103         output_quoted_string (FILE, dump_base_name);            \
104         fprintf (FILE, "\n");                                   \
105         fprintf (FILE, ".global\t__fltused\n");                 \
106   } while (0)
107
108 /* A table of bytes codes used by the ASM_OUTPUT_ASCII and
109    ASM_OUTPUT_LIMITED_STRING macros.  Each byte in the table
110    corresponds to a particular byte value [0..255].  For any
111    given byte value, if the value in the corresponding table
112    position is zero, the given character can be output directly.
113    If the table value is 1, the byte must be output as a \ooo
114    octal escape.  If the tables value is anything else, then the
115    byte value should be output as a \ followed by the value
116    in the table.  Note that we can use standard UN*X escape
117    sequences for many control characters, but we don't use
118    \a to represent BEL because some svr4 assemblers (e.g. on
119    the i386) don't know about that.  Also, we don't use \v
120    since some versions of gas, such as 2.2 did not accept it.  */
121
122 #define ESCAPES \
123 "\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\
124 \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\
125 \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\
126 \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\
127 \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\
128 \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\
129 \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\
130 \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"
131
132 /* Some svr4 assemblers have a limit on the number of characters which
133    can appear in the operand of a .string directive.  If your assembler
134    has such a limitation, you should define STRING_LIMIT to reflect that
135    limit.  Note that at least some svr4 assemblers have a limit on the
136    actual number of bytes in the double-quoted string, and that they
137    count each character in an escape sequence as one byte.  Thus, an
138    escape sequence like \377 would count as four bytes.
139
140    If your target assembler doesn't support the .string directive, you
141    should define this to zero.
142 */
143
144 #define STRING_LIMIT    ((unsigned) 256)
145
146 #define STRING_ASM_OP   ".string"
147
148 /* The routine used to output NUL terminated strings.  We use a special
149    version of this for most svr4 targets because doing so makes the
150    generated assembly code more compact (and thus faster to assemble)
151    as well as more readable, especially for targets like the i386
152    (where the only alternative is to output character sequences as
153    comma separated lists of numbers).   */
154
155 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR)                            \
156   do                                                                    \
157     {                                                                   \
158       register unsigned char *_limited_str = (unsigned char *) (STR);   \
159       register unsigned ch;                                             \
160       fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP);                      \
161       for (; (ch = *_limited_str); _limited_str++)                      \
162         {                                                               \
163           register int escape = ESCAPES[ch];                            \
164           switch (escape)                                               \
165             {                                                           \
166             case 0:                                                     \
167               putc (ch, (FILE));                                        \
168               break;                                                    \
169             case 1:                                                     \
170               fprintf ((FILE), "\\%03o", ch);                           \
171               break;                                                    \
172             default:                                                    \
173               putc ('\\', (FILE));                                      \
174               putc (escape, (FILE));                                    \
175               break;                                                    \
176             }                                                           \
177         }                                                               \
178       fprintf ((FILE), "\"\n");                                         \
179     }                                                                   \
180   while (0)
181
182 /* The routine used to output sequences of byte values.  We use a special
183    version of this for most svr4 targets because doing so makes the
184    generated assembly code more compact (and thus faster to assemble)
185    as well as more readable.  Note that if we find subparts of the
186    character sequence which end with NUL (and which are shorter than
187    STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
188
189 #undef ASM_OUTPUT_ASCII
190 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                             \
191   do                                                                    \
192     {                                                                   \
193       register unsigned char *_ascii_bytes = (unsigned char *) (STR);   \
194       register unsigned char *limit = _ascii_bytes + (LENGTH);          \
195       register unsigned bytes_in_chunk = 0;                             \
196       for (; _ascii_bytes < limit; _ascii_bytes++)                      \
197         {                                                               \
198           register unsigned char *p;                                    \
199           if (bytes_in_chunk >= 64)                                     \
200             {                                                           \
201               fputc ('\n', (FILE));                                     \
202               bytes_in_chunk = 0;                                       \
203             }                                                           \
204           for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
205             continue;                                                   \
206           if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT)          \
207             {                                                           \
208               if (bytes_in_chunk > 0)                                   \
209                 {                                                       \
210                   fputc ('\n', (FILE));                                 \
211                   bytes_in_chunk = 0;                                   \
212                 }                                                       \
213               ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
214               _ascii_bytes = p;                                         \
215             }                                                           \
216           else                                                          \
217             {                                                           \
218               if (bytes_in_chunk == 0)                                  \
219                 fprintf ((FILE), "\t.byte\t");                          \
220               else                                                      \
221                 fputc (',', (FILE));                                    \
222               fprintf ((FILE), "0x%02x", *_ascii_bytes);                \
223               bytes_in_chunk += 5;                                      \
224             }                                                           \
225         }                                                               \
226       if (bytes_in_chunk > 0)                                           \
227         fprintf ((FILE), "\n");                                         \
228     }                                                                   \
229   while (0)
230
231 /* This is how to output an element of a case-vector that is relative.
232    This is only used for PIC code.  See comments by the `casesi' insn in
233    i386.md for an explanation of the expression this outputs.
234    PE format differs on what PC-relative offsets look like (see
235    coff_i386_rtype_to_howto), and we need to compensate (by one word) here. */
236
237 #undef ASM_OUTPUT_ADDR_DIFF_ELT
238 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
239   fprintf (FILE, "\t.long __GLOBAL_OFFSET_TABLE_+[.-%s%d+4]\n", LPREFIX, VALUE)
240
241 /* Indicate that jump tables go in the text section.  This is
242    necessary when compiling PIC code.  */
243
244 #define JUMP_TABLES_IN_TEXT_SECTION 1
245
246 /* Emit code to check the stack when allocating more that 4000
247    bytes in one go. */
248
249 #define CHECK_STACK_LIMIT 0x1000
250
251 /* the following are OSF linker (not gld) specific... we don't want them */
252 #undef HAS_INIT_SECTION
253 #undef LD_INIT_SWITCH
254 #undef LD_FINI_SWITCH
255
256
257 /* The following are needed for C++, but also needed for profiling */
258
259 /* Support const sections and the ctors and dtors sections for g++.
260    Note that there appears to be two different ways to support const
261    sections at the moment.  You can either #define the symbol
262    READONLY_DATA_SECTION (giving it some code which switches to the
263    readonly data section) or else you can #define the symbols
264    EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
265    SELECT_RTX_SECTION.  We do both here just to be on the safe side.  */
266
267 #define USE_CONST_SECTION       1
268
269 #define CONST_SECTION_ASM_OP    ".section\t.rdata,\"r\""
270
271 /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
272
273    Note that we want to give these sections the SHF_WRITE attribute
274    because these sections will actually contain data (i.e. tables of
275    addresses of functions in the current root executable or shared library
276    file) and, in the case of a shared library, the relocatable addresses
277    will have to be properly resolved/relocated (and then written into) by
278    the dynamic linker when it actually attaches the given shared library
279    to the executing process.  (Note that on SVR4, you may wish to use the
280    `-z text' option to the ELF linker, when building a shared library, as
281    an additional check that you are doing everything right.  But if you do
282    use the `-z text' option when building a shared library, you will get
283    errors unless the .ctors and .dtors sections are marked as writable
284    via the SHF_WRITE attribute.)  */
285
286 #define CTORS_SECTION_ASM_OP    ".section\t.ctors,\"x\""
287 #define DTORS_SECTION_ASM_OP    ".section\t.dtors,\"x\""
288
289 /* A default list of other sections which we might be "in" at any given
290    time.  For targets that use additional sections (e.g. .tdesc) you
291    should override this definition in the target-specific file which
292    includes this file.  */
293
294 #undef EXTRA_SECTIONS
295 #define EXTRA_SECTIONS in_const, in_ctors, in_dtors
296
297 /* A default list of extra section function definitions.  For targets
298    that use additional sections (e.g. .tdesc) you should override this
299    definition in the target-specific file which includes this file.  */
300
301 #undef EXTRA_SECTION_FUNCTIONS
302 #define EXTRA_SECTION_FUNCTIONS                                         \
303   CONST_SECTION_FUNCTION                                                \
304   CTORS_SECTION_FUNCTION                                                \
305   DTORS_SECTION_FUNCTION
306
307 #undef READONLY_DATA_SECTION
308 #define READONLY_DATA_SECTION() const_section ()
309
310 extern void text_section ();
311
312 #define CONST_SECTION_FUNCTION                                          \
313 void                                                                    \
314 const_section ()                                                        \
315 {                                                                       \
316   if (!USE_CONST_SECTION)                                               \
317     text_section();                                                     \
318   else if (in_section != in_const)                                      \
319     {                                                                   \
320       fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP);             \
321       in_section = in_const;                                            \
322     }                                                                   \
323 }
324
325 #define CTORS_SECTION_FUNCTION                                          \
326 void                                                                    \
327 ctors_section ()                                                        \
328 {                                                                       \
329   if (in_section != in_ctors)                                           \
330     {                                                                   \
331       fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);             \
332       in_section = in_ctors;                                            \
333     }                                                                   \
334 }
335
336 #define DTORS_SECTION_FUNCTION                                          \
337 void                                                                    \
338 dtors_section ()                                                        \
339 {                                                                       \
340   if (in_section != in_dtors)                                           \
341     {                                                                   \
342       fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);             \
343       in_section = in_dtors;                                            \
344     }                                                                   \
345 }
346
347 #if 0
348 /* Currently gas chokes on this; that's not too hard to fix, but there's
349    not a lot of impeteus to do it, either.  If it is done, gas will have
350    to handle long section name escapes (which are defined in the COFF/PE
351    document as /nnn where nnn is a string table index).  The benefit:
352    section attributes and -ffunction-sections, neither of which seem to
353    be critical. */
354 /* gas may have been fixed? bfd was. */
355
356 /* Switch into a generic section.
357    This is currently only used to support section attributes.
358
359    We make the section read-only and executable for a function decl,
360    read-only for a const data decl, and writable for a non-const data decl.  */
361 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
362   fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \
363            (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
364            (DECL) && TREE_READONLY (DECL) ? "a" : "aw")
365 #endif
366
367 #define INT_ASM_OP              ".long"
368
369 /* The MS compilers take alignment as a number of bytes, so we do as well */
370 #undef ASM_OUTPUT_ALIGN
371 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
372   if ((LOG)!=0) fprintf ((FILE), "\t.balign %d\n", 1<<(LOG))
373
374 /* A C statement (sans semicolon) to output an element in the table of
375    global constructors.  */
376 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)                               \
377   do {                                                                  \
378     ctors_section ();                                                   \
379     fprintf (FILE, "\t%s\t ", INT_ASM_OP);                              \
380     assemble_name (FILE, NAME);                                         \
381     fprintf (FILE, "\n");                                               \
382   } while (0)
383
384 /* A C statement (sans semicolon) to output an element in the table of
385    global destructors.  */
386 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)                                \
387   do {                                                                  \
388     dtors_section ();                                                   \
389     fprintf (FILE, "\t%s\t ", INT_ASM_OP);                              \
390     assemble_name (FILE, NAME);                                         \
391     fprintf (FILE, "\n");                                               \
392   } while (0)
393
394 /* The linker will take care of this, and having them causes problems with
395    ld -r (specifically -rU). */
396 #define CTOR_LISTS_DEFINED_EXTERNALLY 1
397
398 #define SET_ASM_OP      ".set"
399 /* Output a definition (implements alias) */
400 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
401 do                                                                      \
402 {                                                                       \
403     fprintf ((FILE), "\t%s\t", SET_ASM_OP);                             \
404     assemble_name (FILE, LABEL1);                                       \
405     fprintf (FILE, ",");                                                \
406     assemble_name (FILE, LABEL2);                                       \
407     fprintf (FILE, "\n");                                               \
408     }                                                                   \
409 while (0)
410
411 #define HOST_PTR_PRINTF "%p"
412 #define HOST_PTR_AS_INT unsigned long
413
414 #define PCC_BITFIELD_TYPE_MATTERS 1
415 #define PCC_BITFIELD_TYPE_TEST TYPE_NATIVE(rec)
416 #define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
417
418 /* The following two flags are usually "off" for i386, because some non-gnu
419    tools (for the i386) don't handle them.  However, we don't have that
420    problem, so.... */
421
422 /* Forward references to tags are allowed.  */
423 #define SDB_ALLOW_FORWARD_REFERENCES
424
425 /* Unknown tags are also allowed.  */
426 #define SDB_ALLOW_UNKNOWN_REFERENCES
427
428 /* The integer half of this list needs to be constant.  However, there's
429    a lot of disagreement about what the floating point adjustments should
430    be.  We pick one that works with gdb.  (The underlying problem is
431    what to do about the segment registers.  Since we have access to them
432    from /proc, we'll allow them to be accessed in gdb, even tho the
433    gcc compiler can't generate them.  (There's some evidence that 
434    MSVC does, but possibly only for certain special "canned" sequences.) */
435
436 #undef DBX_REGISTER_NUMBER
437 #define DBX_REGISTER_NUMBER(n) \
438 ((n) == 0 ? 0 \
439  : (n) == 1 ? 2 \
440  : (n) == 2 ? 1 \
441  : (n) == 3 ? 3 \
442  : (n) == 4 ? 6 \
443  : (n) == 5 ? 7 \
444  : (n) == 6 ? 5 \
445  : (n) == 7 ? 4 \
446  : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+8 \
447  : (-1))
448
449 /* Define this macro if references to a symbol must be treated
450    differently depending on something about the variable or
451    function named by the symbol (such as what section it is in).
452
453    Apply stddef, handle (as yet unimplemented) pic.
454
455    stddef renaming does NOT apply to Alpha. */
456
457 char *gen_stdcall_suffix ();
458
459 #undef ENCODE_SECTION_INFO
460 #define ENCODE_SECTION_INFO(DECL)                                       \
461 do                                                                      \
462   {                                                                     \
463     if (flag_pic)                                                       \
464       {                                                                 \
465         rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'            \
466                    ? TREE_CST_RTL (DECL) : DECL_RTL (DECL));            \
467         SYMBOL_REF_FLAG (XEXP (rtl, 0))                                 \
468           = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'                  \
469              || ! TREE_PUBLIC (DECL));                                  \
470       }                                                                 \
471     if (TREE_CODE (DECL) == FUNCTION_DECL)                              \
472       if (lookup_attribute ("stdcall",                                  \
473                             TYPE_ATTRIBUTES (TREE_TYPE (DECL))))        \
474         XEXP (DECL_RTL (DECL), 0) =                                     \
475           gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL));       \
476   }                                                                     \
477 while (0)
478
479 /* This macro gets just the user-specified name
480    out of the string in a SYMBOL_REF.  Discard
481    trailing @[NUM] encoded by ENCODE_SECTION_INFO.  */
482 #undef  STRIP_NAME_ENCODING
483 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME)                            \
484 do {                                                                    \
485   char *_p;                                                             \
486   char *_name = SYMBOL_NAME;                                            \
487   for (_p = _name; *_p && *_p != '@'; ++_p)                             \
488     ;                                                                   \
489   if (*_p == '@')                                                       \
490     {                                                                   \
491       int _len = _p - _name;                                            \
492       (VAR) = (char *) alloca (_len + 1);                               \
493       strncpy ((VAR), _name, _len);                                     \
494       (VAR)[_len] = '\0';                                               \
495     }                                                                   \
496   else                                                                  \
497     (VAR) = _name;                                                      \
498 } while (0)
499       
500 #if 0   
501 /* Turn this back on when the linker is updated to handle grouped
502    .data$ sections correctly. See corresponding note in i386/interix.c. 
503    MK. */
504
505 /* Define this macro if in some cases global symbols from one translation
506    unit may not be bound to undefined symbols in another translation unit
507    without user intervention.  For instance, under Microsoft Windows
508    symbols must be explicitly imported from shared libraries (DLLs).  */
509 #define MULTIPLE_SYMBOL_SPACES
510
511 #define UNIQUE_SECTION_P(DECL) DECL_ONE_ONLY (DECL)
512 extern void i386_pe_unique_section ();
513 #define UNIQUE_SECTION(DECL,RELOC) i386_pe_unique_section (DECL, RELOC)
514
515 #define SUPPORTS_ONE_ONLY 1
516
517 /* A C statement to output something to the assembler file to switch to section
518    NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
519    NULL_TREE.  Some target formats do not support arbitrary sections.  Do not
520    define this macro in such cases.  */
521 #undef ASM_OUTPUT_SECTION_NAME
522 #define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC)              \
523 do {                                                                    \
524   static struct section_info                                            \
525     {                                                                   \
526       struct section_info *next;                                        \
527       char *name;                                                       \
528       enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type;                \
529     } *sections;                                                        \
530   struct section_info *s;                                               \
531   char *mode;                                                           \
532   enum sect_enum type;                                                  \
533                                                                         \
534   for (s = sections; s; s = s->next)                                    \
535     if (!strcmp (NAME, s->name))                                        \
536       break;                                                            \
537                                                                         \
538   if (DECL && TREE_CODE (DECL) == FUNCTION_DECL)                        \
539     type = SECT_EXEC, mode = "x";                                       \
540   else if (DECL && DECL_READONLY_SECTION (DECL, RELOC))                 \
541     type = SECT_RO, mode = "r";                                         \
542   else                                                                  \
543     type = SECT_RW, mode = "w";                                         \
544                                                                         \
545   if (s == 0)                                                           \
546     {                                                                   \
547       s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
548       s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME));         \
549       strcpy (s->name, NAME);                                           \
550       s->type = type;                                                   \
551       s->next = sections;                                               \
552       sections = s;                                                     \
553       fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode);            \
554       /* Functions may have been compiled at various levels of          \
555          optimization so we can't use `same_size' here.  Instead,       \
556          have the linker pick one.  */                                  \
557       if ((DECL) && DECL_ONE_ONLY (DECL))                               \
558         fprintf (STREAM, "\t.linkonce %s\n",                            \
559                  TREE_CODE (DECL) == FUNCTION_DECL                      \
560                  ? "discard" : "same_size");                            \
561     }                                                                   \
562   else                                                                  \
563     {                                                                   \
564       fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode);            \
565     }                                                                   \
566 } while (0)
567
568 #endif /* 0 */
569
570 /* DWARF2 Unwinding doesn't work with exception handling yet. */
571 #define DWARF2_UNWIND_INFO 0
572
573 /* Don't assume anything about the header files. */
574 #define NO_IMPLICIT_EXTERN_C
575