OSDN Git Service

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