OSDN Git Service

* toplev.c (output_lang_identify): Delete.
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / sco5.h
1 /* Definitions for Intel 386 running SCO Unix System V 3.2 Version 5.
2    Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000
3    Free Software Foundation, Inc.
4    Contributed by Kean Johnston (hug@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 #include "i386/i386.h"  /* Base i386 target definitions */
24 #include "i386/att.h"   /* Use AT&T i386 assembler syntax */
25
26 #undef TARGET_VERSION
27 #define TARGET_VERSION fprintf (stderr, " (i386, SCO OpenServer 5 Syntax)");
28
29 #undef LPREFIX
30 #define LPREFIX                         ".L"
31
32 #undef ALIGN_ASM_OP
33 #define ALIGN_ASM_OP                    "\t.align\t"
34
35 #undef ASCII_DATA_ASM_OP
36 #define ASCII_DATA_ASM_OP               "\t.ascii\t"
37
38 #undef ASM_BYTE_OP
39 #define ASM_BYTE_OP                     "\t.byte\t"
40
41 #undef IDENT_ASM_OP
42 #define IDENT_ASM_OP                    "\t.ident\t"
43
44 #undef COMMON_ASM_OP
45 #define COMMON_ASM_OP                   "\t.comm\t"
46
47 #undef SET_ASM_OP
48 #define SET_ASM_OP                      "\t.set\t"
49
50 #undef LOCAL_ASM_OP
51 #define LOCAL_ASM_OP                    "\t.local\t"
52
53 #undef INT_ASM_OP
54 #define INT_ASM_OP                      "\t.long\t"
55
56 #undef ASM_SHORT
57 #define ASM_SHORT                       "\t.value"
58
59 #undef ASM_LONG
60 #define ASM_LONG                        "\t.long"
61
62 #undef ASM_DOUBLE
63 #define ASM_DOUBLE                      "\t.double"
64
65 #undef TYPE_ASM_OP
66 #define TYPE_ASM_OP                     "\t.type\t"
67
68 #undef SIZE_ASM_OP
69 #define SIZE_ASM_OP                     "\t.size\t"
70
71 #undef STRING_ASM_OP
72 #define STRING_ASM_OP                   "\t.string\t"
73
74 #undef SKIP_ASM_OP
75 #define SKIP_ASM_OP                     "\t.zero\t"
76
77 #undef GLOBAL_ASM_OP
78 #define GLOBAL_ASM_OP                   "\t.globl\t"
79
80 #undef EH_FRAME_SECTION_ASM_OP
81 #define EH_FRAME_SECTION_ASM_OP_COFF    "\t.section\t.ehfram, \"x\""
82 #define EH_FRAME_SECTION_ASM_OP_ELF     "\t.section\t.eh_frame, \"aw\""
83 #define EH_FRAME_SECTION_ASM_OP \
84   ((TARGET_ELF) ? EH_FRAME_SECTION_ASM_OP_ELF : EH_FRAME_SECTION_ASM_OP_COFF)
85
86 /* Avoid problems (long sectino names, forward assembler refs) with DWARF
87    exception unwinding when we're generating COFF */
88 #define DWARF2_UNWIND_INFO      \
89   ((TARGET_ELF) ? 1 : 0 )  
90
91 #undef CONST_SECTION_ASM_OP
92 #define CONST_SECTION_ASM_OP_COFF       "\t.section\t.rodata, \"x\""
93 #define CONST_SECTION_ASM_OP_ELF        "\t.section\t.rodata"
94 #define CONST_SECTION_ASM_OP    \
95   ((TARGET_ELF) ? CONST_SECTION_ASM_OP_ELF : CONST_SECTION_ASM_OP_COFF)
96
97 #undef USE_CONST_SECTION
98 #define USE_CONST_SECTION_ELF           1
99 #define USE_CONST_SECTION_COFF          0
100 #define USE_CONST_SECTION       \
101  ((TARGET_ELF) ? USE_CONST_SECTION_ELF : USE_CONST_SECTION_COFF)
102
103 #undef INIT_SECTION_ASM_OP
104 #define INIT_SECTION_ASM_OP_ELF         "\t.section\t.init"
105 /* Rename these for COFF becuase crt1.o will try to run them. */
106 #define INIT_SECTION_ASM_OP_COFF        "\t.section\t.ctor ,\"x\""
107 #define INIT_SECTION_ASM_OP     \
108   ((TARGET_ELF) ? INIT_SECTION_ASM_OP_ELF : INIT_SECTION_ASM_OP_COFF)
109
110 #undef CTORS_SECTION_ASM_OP
111 #define CTORS_SECTION_ASM_OP_ELF        "\t.section\t.ctors,\"aw\""
112 #define CTORS_SECTION_ASM_OP_COFF       INIT_SECTION_ASM_OP_COFF
113 #define CTORS_SECTION_ASM_OP    \
114  ((TARGET_ELF) ? CTORS_SECTION_ASM_OP_ELF : CTORS_SECTION_ASM_OP_COFF)
115
116 #undef DTORS_SECTION_ASM_OP
117 #define DTORS_SECTION_ASM_OP_ELF        "\t.section\t.dtors, \"aw\""
118 #define DTORS_SECTION_ASM_OP_COFF       FINI_SECTION_ASM_OP_COFF
119 #define DTORS_SECTION_ASM_OP    \
120  ((TARGET_ELF) ? DTORS_SECTION_ASM_OP_ELF : DTORS_SECTION_ASM_OP_COFF)
121
122 #undef FINI_SECTION_ASM_OP
123 #define FINI_SECTION_ASM_OP_ELF         "\t.section\t.fini"
124 #define FINI_SECTION_ASM_OP_COFF        "\t.section\t.dtor, \"x\""
125 #define FINI_SECTION_ASM_OP     \
126  ((TARGET_ELF) ? FINI_SECTION_ASM_OP_ELF : FINI_SECTION_ASM_OP_COFF)
127
128 #undef BSS_SECTION_ASM_OP
129 #define BSS_SECTION_ASM_OP              "\t.data"
130
131 #undef TEXT_SECTION_ASM_OP
132 #define TEXT_SECTION_ASM_OP             "\t.text"
133
134 #undef DATA_SECTION_ASM_OP
135 #define DATA_SECTION_ASM_OP             "\t.data"
136
137 #undef TYPE_OPERAND_FMT
138 #define TYPE_OPERAND_FMT                "@%s"
139
140 #undef APPLY_RESULT_SIZE
141 #define APPLY_RESULT_SIZE                                               \
142 (TARGET_ELF) ? size : 116
143
144 #ifndef ASM_DECLARE_RESULT
145 #define ASM_DECLARE_RESULT(FILE, RESULT)
146 #endif
147
148 #define SCO_DEFAULT_ASM_COFF(FILE,NAME)                                 \
149 do {                                                                    \
150       ASM_OUTPUT_LABEL (FILE, NAME);                                    \
151   } while (0)
152
153 #undef ASM_DECLARE_FUNCTION_NAME
154 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                     \
155   do {                                                                  \
156     if (TARGET_ELF) {                                                   \
157       fprintf (FILE, "%s", TYPE_ASM_OP);                                \
158       assemble_name (FILE, NAME);                                       \
159       putc (',', FILE);                                                 \
160       fprintf (FILE, TYPE_OPERAND_FMT, "function");                     \
161       putc ('\n', FILE);                                                \
162       ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));                    \
163       ASM_OUTPUT_LABEL(FILE, NAME);                                     \
164     } else                                                              \
165       SCO_DEFAULT_ASM_COFF(FILE, NAME);                                 \
166 } while (0)
167
168 #undef ASM_DECLARE_FUNCTION_SIZE
169 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)                    \
170   do {                                                                  \
171     if (TARGET_ELF) { if (!flag_inhibit_size_directive)                 \
172       {                                                                 \
173         fprintf (FILE, "%s", SIZE_ASM_OP);                              \
174         assemble_name (FILE, (FNAME));                                  \
175         fprintf (FILE, ",.-");                                          \
176         assemble_name (FILE, (FNAME));                                  \
177         putc ('\n', FILE);                                              \
178       } }                                                               \
179   } while (0)
180
181 #undef ASM_DECLARE_OBJECT_NAME
182 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)                       \
183   do {                                                                  \
184     if (TARGET_ELF) {                                                   \
185       fprintf (FILE, "%s", TYPE_ASM_OP);                                \
186       assemble_name (FILE, NAME);                                       \
187       putc (',', FILE);                                                 \
188       fprintf (FILE, TYPE_OPERAND_FMT, "object");                       \
189       putc ('\n', FILE);                                                \
190       size_directive_output = 0;                                        \
191       if (!flag_inhibit_size_directive && DECL_SIZE (DECL))             \
192         {                                                               \
193         size_directive_output = 1;                                      \
194         fprintf (FILE, "%s", SIZE_ASM_OP);                              \
195         assemble_name (FILE, NAME);                                     \
196         fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
197         }                                                               \
198       ASM_OUTPUT_LABEL(FILE, NAME);                                     \
199     } else                                                              \
200       SCO_DEFAULT_ASM_COFF(FILE, NAME);                                 \
201   } while (0)
202
203 #undef ASM_FILE_START_1
204 #define ASM_FILE_START_1(FILE)
205
206 #undef ASM_FILE_START
207 #define ASM_FILE_START(FILE)                                            \
208 do {                                                                    \
209   output_file_directive((FILE),main_input_filename);                    \
210   fprintf ((FILE), "\t.version\t\"01.01\"\n");                          \
211 } while (0)
212
213 #undef ASM_FINISH_DECLARE_OBJECT
214 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)         \
215 do {                                                                     \
216   if (TARGET_ELF) {                                                     \
217      const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);             \
218      if (!flag_inhibit_size_directive && DECL_SIZE (DECL)                \
219          && ! AT_END && TOP_LEVEL                                        \
220          && DECL_INITIAL (DECL) == error_mark_node                       \
221          && !size_directive_output)                                      \
222        {                                                                 \
223          size_directive_output = 1;                                      \
224          fprintf (FILE, "%s", SIZE_ASM_OP);                              \
225          assemble_name (FILE, name);                                     \
226          fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
227        }                                                                 \
228     }                                                                    \
229 } while (0)
230
231 #undef ASM_GENERATE_INTERNAL_LABEL
232 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM)                 \
233 do {                                                                    \
234   if (TARGET_ELF)                                                       \
235     sprintf (LABEL, "*.%s%d", (PREFIX), (NUM));                         \
236   else                                                                  \
237     sprintf (LABEL, ".%s%d", (PREFIX), (NUM));                          \
238 } while (0)
239
240 #undef ASM_OUTPUT_ADDR_DIFF_ELT
241 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
242 do {                                                                    \
243   if (TARGET_ELF)                                                       \
244     fprintf (FILE, "%s _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", ASM_LONG, LPREFIX, VALUE); \
245   else                                                                  \
246     fprintf (FILE, "\t.word %s%d-%s%d\n", LPREFIX,VALUE,LPREFIX,REL);   \
247 } while (0)
248
249 #undef ASM_OUTPUT_ALIGNED_COMMON
250 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)              \
251 do {                                                                    \
252   fprintf ((FILE), "%s", COMMON_ASM_OP);                                \
253   assemble_name ((FILE), (NAME));                                       \
254   if (TARGET_ELF)                                                       \
255     fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT);      \
256   else                                                                  \
257     fprintf ((FILE), ",%u\n", (SIZE));                                  \
258 } while (0)
259
260 #undef ASM_OUTPUT_ALIGNED_LOCAL
261 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)               \
262 do {                                                                    \
263   if (TARGET_ELF) {                                                     \
264     fprintf ((FILE), "%s", LOCAL_ASM_OP);                               \
265     assemble_name ((FILE), (NAME));                                     \
266     fprintf ((FILE), "\n");                                             \
267     ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN);                \
268   } else {                                                              \
269     int align = exact_log2 (ALIGN);                                     \
270     if (align > 2) align = 2;                                           \
271     if (TARGET_SVR3_SHLIB)                                              \
272       data_section ();                                                  \
273     else                                                                \
274       bss_section ();                                                   \
275     ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align);                 \
276     fprintf ((FILE), "%s\t", "\t.lcomm");                               \
277     assemble_name ((FILE), (NAME));                                     \
278     fprintf ((FILE), ",%u\n", (SIZE));                                  \
279    }                                                                    \
280 } while (0)
281
282 /* A C statement (sans semicolon) to output to the stdio stream
283    FILE the assembler definition of uninitialized global DECL named
284    NAME whose size is SIZE bytes and alignment is ALIGN bytes.
285    Try to use asm_output_aligned_bss to implement this macro.  */
286
287 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
288 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
289
290 #undef ESCAPES
291 #define ESCAPES \
292 "\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\
293 \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\
294 \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\
295 \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\
296 \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\
297 \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\
298 \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\
299 \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"
300
301 #undef STRING_LIMIT
302 #define STRING_LIMIT    ((unsigned) 256)
303
304 #undef ASM_OUTPUT_LIMITED_STRING
305 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR)                            \
306   do                                                                    \
307     {                                                                   \
308       register const unsigned char *_limited_str =                      \
309         (const unsigned char *) (STR);                                  \
310       register unsigned ch;                                             \
311       fprintf ((FILE), "%s\"", STRING_ASM_OP);                          \
312       for (; (ch = *_limited_str); _limited_str++)                      \
313         {                                                               \
314           register int escape;                                          \
315           switch (escape = ESCAPES[ch])                                 \
316             {                                                           \
317             case 0:                                                     \
318               putc (ch, (FILE));                                        \
319               break;                                                    \
320             case 1:                                                     \
321               fprintf ((FILE), "\\%03o", ch);                           \
322               break;                                                    \
323             default:                                                    \
324               putc ('\\', (FILE));                                      \
325               putc (escape, (FILE));                                    \
326               break;                                                    \
327             }                                                           \
328         }                                                               \
329       fprintf ((FILE), "\"\n");                                         \
330     }                                                                   \
331   while (0)
332
333
334 #undef ASM_OUTPUT_ASCII
335 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                             \
336 do {                                                                    \
337       register const unsigned char *_ascii_bytes =                      \
338         (const unsigned char *) (STR);                                  \
339       register const unsigned char *limit = _ascii_bytes + (LENGTH);    \
340       register unsigned bytes_in_chunk = 0;                             \
341       for (; _ascii_bytes < limit; _ascii_bytes++)                      \
342         {                                                               \
343           register unsigned const char *p;                              \
344           if (bytes_in_chunk >= 64)                                     \
345             {                                                           \
346               fputc ('\n', (FILE));                                     \
347               bytes_in_chunk = 0;                                       \
348             }                                                           \
349           for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
350             continue;                                                   \
351           if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT)          \
352             {                                                           \
353               if (bytes_in_chunk > 0)                                   \
354                 {                                                       \
355                   fputc ('\n', (FILE));                                 \
356                   bytes_in_chunk = 0;                                   \
357                 }                                                       \
358               ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
359               _ascii_bytes = p;                                         \
360             }                                                           \
361           else                                                          \
362             {                                                           \
363               if (bytes_in_chunk == 0)                                  \
364                 fprintf ((FILE), "%s", ASM_BYTE_OP);                    \
365               else                                                      \
366                 fputc (',', (FILE));                                    \
367               fprintf ((FILE), "0x%02x", *_ascii_bytes);                \
368               bytes_in_chunk += 5;                                      \
369             }                                                           \
370         }                                                               \
371       if (bytes_in_chunk > 0)                                           \
372         fprintf ((FILE), "\n");                                         \
373 } while (0) 
374
375 /* Must use data section for relocatable constants when pic.  */
376 #undef SELECT_RTX_SECTION
377 #define SELECT_RTX_SECTION(MODE,RTX)                                    \
378 {                                                                       \
379   if (TARGET_ELF) {                                                     \
380     if (flag_pic && symbolic_operand (RTX, VOIDmode))                   \
381       data_section ();                                                  \
382     else                                                                \
383       const_section ();                                                 \
384   } else                                                                \
385     readonly_data_section();                                            \
386 }
387
388 #undef ASM_OUTPUT_CASE_LABEL
389 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE)                \
390 do {                                                                    \
391   if (TARGET_ELF)                                                       \
392     ASM_OUTPUT_ALIGN ((FILE), 2);                                       \
393   ASM_OUTPUT_INTERNAL_LABEL((FILE),(PREFIX),(NUM));                     \
394 } while (0)
395
396
397 #undef ASM_OUTPUT_CONSTRUCTOR
398 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)                               \
399 do {                                                                    \
400   if (TARGET_ELF) {                                                     \
401      ctors_section ();                                                  \
402      fprintf (FILE, "%s", INT_ASM_OP);                                  \
403      assemble_name (FILE, NAME);                                        \
404      fprintf (FILE, "\n");                                              \
405   } else {                                                              \
406     init_section ();                                                    \
407     fprintf (FILE, "\tpushl $");                                        \
408     assemble_name (FILE, NAME);                                         \
409     fprintf (FILE, "\n"); }                                             \
410   } while (0)
411
412 #undef ASM_OUTPUT_DESTRUCTOR
413 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)                                \
414 do {                                                                    \
415   if (TARGET_ELF) {                                                     \
416     dtors_section ();                                                   \
417     fprintf (FILE, "%s", INT_ASM_OP);                                   \
418     assemble_name (FILE, NAME);                                         \
419     fprintf (FILE, "\n");                                               \
420   } else {                                                              \
421     fini_section ();                                                    \
422     fprintf (FILE, "%s\t ", ASM_LONG);                                  \
423     assemble_name (FILE, NAME);                                         \
424     fprintf (FILE, "\n"); }                                             \
425   } while (0)
426
427
428 #undef ASM_OUTPUT_IDENT
429 #define ASM_OUTPUT_IDENT(FILE, NAME) \
430   fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME);
431
432 #undef ASM_GLOBALIZE_LABEL
433 #define ASM_GLOBALIZE_LABEL(FILE,NAME)  \
434   (fprintf ((FILE), "%s", GLOBAL_ASM_OP), assemble_name (FILE, NAME), fputs ("\n", FILE))
435
436 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
437 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)                          \
438   if (TARGET_ELF) ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
439
440 #undef ASM_OUTPUT_INTERNAL_LABEL
441 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)                      \
442   fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
443
444 /* The prefix to add to user-visible assembler symbols. */
445
446 #undef USER_LABEL_PREFIX
447 #define USER_LABEL_PREFIX ""
448
449 /* 
450  * Compensate for the difference between ELF and COFF assembler syntax.
451  * Otherwise, this is cribbed from ../svr4.h.
452  * We rename 'gcc_except_table' to the shorter name in preparation
453  * for the day when we're ready to do DWARF2 eh unwinding under COFF 
454  */
455 #undef ASM_OUTPUT_SECTION_NAME
456 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
457 do {                                                                    \
458   static struct section_info                                            \
459     {                                                                   \
460       struct section_info *next;                                        \
461       char *name;                                                       \
462       enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type;                \
463     } *sections;                                                        \
464   struct section_info *s;                                               \
465   const char *mode;                                                     \
466   enum sect_enum type;                                                  \
467   const char *sname = NAME ;                                            \
468   if (strcmp(NAME, ".gcc_except_table") == 0) sname = ".gccexc" ;       \
469                                                                         \
470   for (s = sections; s; s = s->next)                                    \
471     if (!strcmp (NAME, s->name))                                        \
472       break;                                                            \
473                                                                         \
474   if (DECL && TREE_CODE (DECL) == FUNCTION_DECL)                        \
475     type = SECT_EXEC, mode = (TARGET_ELF) ? "ax" : "x" ;                \
476   else if (DECL && DECL_READONLY_SECTION (DECL, RELOC))                 \
477     type = SECT_RO, mode = "a";                                         \
478   else                                                                  \
479     type = SECT_RW, mode = (TARGET_ELF) ? "aw" : "w" ;                  \
480                                                                         \
481   if (s == 0)                                                           \
482     {                                                                   \
483       s = (struct section_info *) xmalloc (sizeof (struct section_info));  \
484       s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME));         \
485       strcpy (s->name, NAME);                                           \
486       s->type = type;                                                   \
487       s->next = sections;                                               \
488       sections = s;                                                     \
489       fprintf (FILE, ".section\t%s,\"%s\"%s\n", sname, mode,            \
490                 (TARGET_ELF) ? ",@progbits" : "" );                     \
491     }                                                                   \
492   else                                                                  \
493     {                                                                   \
494       if (DECL && s->type != type)                                      \
495         error_with_decl (DECL, "%s causes a section type conflict");    \
496                                                                         \
497       fprintf (FILE, ".section\t%s\n", sname);                          \
498     }                                                                   \
499 } while (0)
500
501 #undef ASM_OUTPUT_SKIP
502 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
503 do {                                                                    \
504   if (TARGET_ELF)                                                       \
505     fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (SIZE));                      \
506   else                                                                  \
507     fprintf ((FILE), "%s.,.+%u\n", SET_ASM_OP, (SIZE));         \
508 } while (0)
509
510
511 #undef CTOR_LIST_BEGIN
512 #define CTOR_LIST_BEGIN                                                 \
513 do {                                                                    \
514   asm (CTORS_SECTION_ASM_OP);                                           \
515   if (TARGET_ELF)                                                       \
516     STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) };             \
517   else                                                                  \
518     asm ("pushl $0");                                                   \
519 } while (0)
520
521 #undef CTOR_LIST_END
522 #define CTOR_LIST_END                                                   \
523 do {                                                                    \
524   if (TARGET_ELF) {                                                     \
525     asm (CTORS_SECTION_ASM_OP);                                         \
526     STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (0) };              \
527   } else {                                                              \
528     CTOR_LIST_BEGIN;                                                    \
529   }                                                                     \
530 } while (0)
531
532 #undef DBX_BLOCKS_FUNCTION_RELATIVE
533 #define DBX_BLOCKS_FUNCTION_RELATIVE 1
534
535 #undef DBX_FUNCTION_FIRST
536 #define DBX_FUNCTION_FIRST 1
537
538 #undef DBX_REGISTER_NUMBER
539 #define DBX_REGISTER_NUMBER(n) \
540   ((TARGET_ELF) ? svr4_dbx_register_map[n] : dbx_register_map[n])
541
542 #undef DWARF_DEBUGGING_INFO
543 #undef SDB_DEBUGGING_INFO
544 #undef DBX_DEBUGGING_INFO
545 #undef PREFERRED_DEBUGGING_TYPE
546
547 #define DWARF_DEBUGGING_INFO 1
548 #define SDB_DEBUGGING_INFO   1
549 #define DBX_DEBUGGING_INFO   1
550 #define PREFERRED_DEBUGGING_TYPE                                        \
551   ((TARGET_ELF) ? DWARF2_DEBUG: SDB_DEBUG)
552
553 #undef EXTRA_SECTIONS
554 #define EXTRA_SECTIONS in_const, in_init, in_fini, in_ctors, in_dtors
555
556 #undef EXTRA_SECTION_FUNCTIONS
557 #define EXTRA_SECTION_FUNCTIONS                                         \
558   CONST_SECTION_FUNCTION                                                \
559   INIT_SECTION_FUNCTION                                                 \
560   FINI_SECTION_FUNCTION                                                 \
561   CTORS_SECTION_FUNCTION                                                \
562   DTORS_SECTION_FUNCTION
563
564 #undef CONST_SECTION_FUNCTION
565 #define CONST_SECTION_FUNCTION                                          \
566 void                                                                    \
567 const_section ()                                                        \
568 {                                                                       \
569   if (!USE_CONST_SECTION)                                               \
570     text_section();                                                     \
571   else if (in_section != in_const)                                      \
572     {                                                                   \
573       fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP);             \
574       in_section = in_const;                                            \
575     }                                                                   \
576 }
577
578 #undef FINI_SECTION_FUNCTION
579 #define FINI_SECTION_FUNCTION                                           \
580 void                                                                    \
581 fini_section ()                                                         \
582 {                                                                       \
583   if ((!TARGET_ELF) && in_section != in_fini)                           \
584     {                                                                   \
585       fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP);              \
586       in_section = in_fini;                                             \
587     }                                                                   \
588 }
589
590 #undef INIT_SECTION_FUNCTION
591 #define INIT_SECTION_FUNCTION                                           \
592 void                                                                    \
593 init_section ()                                                         \
594 {                                                                       \
595   if ((!TARGET_ELF) && in_section != in_init)                           \
596     {                                                                   \
597       fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP);              \
598       in_section = in_init;                                             \
599     }                                                                   \
600 }
601
602 #undef CTORS_SECTION_FUNCTION
603 #define CTORS_SECTION_FUNCTION                                          \
604 void                                                                    \
605 ctors_section ()                                                        \
606 {                                                                       \
607   if (in_section != in_ctors)                                           \
608     {                                                                   \
609       fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);             \
610       in_section = in_ctors;                                            \
611     }                                                                   \
612 }
613
614 #undef DTORS_SECTION_FUNCTION
615 #define DTORS_SECTION_FUNCTION                                          \
616 void                                                                    \
617 dtors_section ()                                                        \
618 {                                                                       \
619   if (in_section != in_dtors)                                           \
620     {                                                                   \
621       fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);             \
622       in_section = in_dtors;                                            \
623     }                                                                   \
624 }
625
626 #undef SUBTARGET_FRAME_POINTER_REQUIRED
627 #define SUBTARGET_FRAME_POINTER_REQUIRED                                \
628   ((TARGET_ELF) ? 0 :                                                   \
629    (current_function_calls_setjmp || current_function_calls_longjmp))
630
631 #undef JUMP_TABLES_IN_TEXT_SECTION
632 #define JUMP_TABLES_IN_TEXT_SECTION (TARGET_ELF && flag_pic)
633
634 #undef LOCAL_LABEL_PREFIX
635 #define LOCAL_LABEL_PREFIX                                              \
636  ((TARGET_ELF) ? "" : ".")
637
638 #undef MD_EXEC_PREFIX
639 #undef MD_STARTFILE_PREFIX
640 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
641 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
642
643 #undef NON_SAVING_SETJMP
644 #define NON_SAVING_SETJMP                                               \
645   ((TARGET_ELF) ? 0 :                                                   \
646    (current_function_calls_setjmp && current_function_calls_longjmp))
647
648 #undef NO_IMPLICIT_EXTERN_C
649 #define NO_IMPLICIT_EXTERN_C 1
650
651 /* JKJ FIXME - examine the ramifications of RETURN_IN_MEMORY and
652    RETURN_POPS_ARGS */
653
654 #undef RETURN_POPS_ARGS
655 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE)                          \
656  ((TARGET_ELF) ?                                                        \
657   (ix86_return_pops_args (FUNDECL, FUNTYPE, SIZE)) :                    \
658   (((FUNDECL) && (TREE_CODE (FUNDECL) == IDENTIFIER_NODE)) ? 0          \
659    : (TARGET_RTD                                                        \
660       && (TYPE_ARG_TYPES (FUNTYPE) == 0                                 \
661           || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE)))         \
662               == void_type_node))) ? (SIZE)                             \
663    : 0))
664
665 #undef SELECT_SECTION
666 #define SELECT_SECTION(DECL,RELOC)                                      \
667 {                                                                       \
668   if (TARGET_ELF && flag_pic && RELOC)                                  \
669      data_section ();                                                   \
670   else if (TREE_CODE (DECL) == STRING_CST)                              \
671     {                                                                   \
672       if (! flag_writable_strings)                                      \
673         const_section ();                                               \
674       else                                                              \
675         data_section ();                                                \
676     }                                                                   \
677   else if (TREE_CODE (DECL) == VAR_DECL)                                \
678     {                                                                   \
679       if (! DECL_READONLY_SECTION (DECL, RELOC))                        \
680         data_section ();                                                \
681       else                                                              \
682         const_section ();                                               \
683     }                                                                   \
684   else                                                                  \
685     const_section ();                                                   \
686 }
687
688 #undef SWITCH_TAKES_ARG
689 #define SWITCH_TAKES_ARG(CHAR)                                          \
690   (DEFAULT_SWITCH_TAKES_ARG(CHAR)                                       \
691    || (CHAR) == 'h'                                                     \
692    || (CHAR) == 'R'                                                     \
693    || (CHAR) == 'Y'                                                     \
694    || (CHAR) == 'z')
695
696 #undef WORD_SWITCH_TAKES_ARG
697 #define WORD_SWITCH_TAKES_ARG(STR)                                      \
698  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                                   \
699   && strcmp (STR, "Tdata") && strcmp (STR, "Ttext")                     \
700   && strcmp (STR, "Tbss"))
701
702 #undef TARGET_SUBTARGET_DEFAULT
703 #define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
704
705 #undef HANDLE_SYSV_PRAGMA
706 #define HANDLE_SYSV_PRAGMA 1
707
708 /* Though OpenServer supports .weak in COFF, we don't use it.
709  * G++ will frequently emit a symol as .weak and then (in the same .s 
710  * file) declare it global.   The COFF assembler finds this unamusing.
711  */
712 #define SUPPORTS_WEAK (TARGET_ELF)
713 #define ASM_WEAKEN_LABEL(FILE,NAME) \
714   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME);           \
715         fputc ('\n', FILE); } while (0)
716
717 #undef SCCS_DIRECTIVE
718 #define SCCS_DIRECTIVE 1
719
720 /*
721  * Define sizes and types
722  */
723 #undef SIZE_TYPE
724 #undef PTRDIFF_TYPE
725 #undef WCHAR_TYPE
726 #undef WCHAR_TYPE_SIZE
727 #undef LONG_DOUBLE_TYPE_SIZE
728 #define LONG_DOUBLE_TYPE_SIZE   96
729 #define SIZE_TYPE               "unsigned int"
730 #define PTRDIFF_TYPE            "int"
731 #define WCHAR_TYPE              "long int"
732 #define WCHAR_TYPE_SIZE         BITS_PER_WORD
733
734 /*
735  * New for multilib support. Set the default switches for multilib,
736  * which is -melf.
737  */
738 #define MULTILIB_DEFAULTS { "melf" }
739
740 \f
741 /* Please note that these specs may look messy but they are required in
742    order to emulate the SCO Development system as closely as possible.
743    With SCO Open Server 5.0, you now get the linker and assembler free,
744    so that is what these specs are targeted for. These utilities are
745    very argument sensitive: a space in the wrong place breaks everything.
746    So RMS, please forgive this mess. It works.
747
748    Parameters which can be passed to gcc, and their SCO equivalents:
749    GCC Parameter                SCO Equivalent
750    -ansi                        -a ansi
751    -posix                       -a posix
752    -Xpg4                        -a xpg4
753    -Xpg4plus                    -a xpg4plus
754    -Xods30                      -a ods30
755
756    As with SCO, the default is XPG4 plus mode. SCO also allows you to
757    specify a C dialect with -Xt, -Xa, -Xc, -Xk and -Xm. These are passed
758    on to the assembler and linker in the same way that the SCO compiler
759    does.
760
761    SCO also allows you to compile, link and generate either ELF or COFF
762    binaries. With gcc, unlike the SCO compiler, the default is ELF.
763    Specify -mcoff to gcc to produce COFF binaries. -fpic will get the
764    assembler and linker to produce PIC code.
765 */
766
767 /* Set up assembler flags for PIC and ELF compilations */
768 #undef ASM_SPEC
769
770 #if USE_GAS
771   /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c 
772    * Undef MD_EXEC_PREFIX becuase we don't know where GAS is, but it's not
773    * likely in /usr/ccs/bin/ 
774    */
775 #undef MD_EXEC_PREFIX 
776 #else
777
778 #define ASM_SPEC \
779    "-b %{!mcoff:elf}%{mcoff:coff \
780      %{static:%e-static not valid with -mcoff} \
781      %{shared:%e-shared not valid with -mcoff} \
782      %{symbolic:%e-symbolic not valid with -mcoff}} \
783     %{Ym,*} %{Yd,*} %{Wa,*:%*} \
784     %{!mcoff:-E%{Xa:a}%{!Xa:%{Xc:c}%{!Xc:%{Xk:k}%{!Xk:%{Xt:t}%{!Xt:a}}}},%{ansi:ansi}%{!ansi:%{posix:posix}%{!posix:%{Xpg4:xpg4}%{!Xpg4:%{Xpg4plus:XPG4PLUS}%{!Xpg4plus:%{Xods30:ods30}%{!Xods30:XPG4PLUS}}}}},ELF %{Qn:} %{!Qy:-Qn}}"
785 #endif
786
787 /* Use crt1.o as a startup file and crtn.o as a closing file.  */
788
789 #undef STARTFILE_SPEC
790 #define STARTFILE_SPEC \
791  "%{shared: %{!mcoff: crti.o%s}} \
792   %{!shared:\
793    %{!symbolic: \
794     %{pg:gcrt.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}} \
795   %{ansi:values-Xc.o%s} \
796   %{!ansi: \
797    %{traditional:values-Xt.o%s} \
798     %{!traditional: \
799      %{Xa:values-Xa.o%s} \
800       %{!Xa:%{Xc:values-Xc.o%s} \
801        %{!Xc:%{Xk:values-Xk.o%s} \
802         %{!Xk:%{Xt:values-Xt.o%s} \
803          %{!Xt:values-Xa.o%s}}}}}} \
804   %{mcoff:crtbeginS.o%s} %{!mcoff:crtbegin.o%s}"
805
806 #undef ENDFILE_SPEC
807 #define ENDFILE_SPEC \
808  "%{!mcoff:crtend.o%s} \
809   %{mcoff:crtendS.o%s} \
810   %{pg:gcrtn.o%s}%{!pg:crtn.o%s}"
811
812 #undef CPP_PREDEFINES
813 #define CPP_PREDEFINES \
814  "-Asystem=svr3"
815
816 /* You are in a maze of GCC specs ... all alike */
817
818 #undef CPP_SPEC
819 #define CPP_SPEC "%(cpp_cpu) \
820   %{fpic:%{mcoff:%e-fpic is not valid with -mcoff}} \
821   %{fPIC:%{mcoff:%e-fPIC is not valid with -mcoff}} \
822   -D__i386 -D__unix -D_SCO_DS=1 -D_M_I386 -D_M_XENIX -D_M_UNIX \
823   %{!Xods30:-D_STRICT_NAMES} \
824   %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \
825   %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi -D_STRICT_ANSI} \
826   %{!ansi: \
827    %{posix:-isystem include/posix%s -isystem /usr/include/posix \
828            -D_POSIX_C_SOURCE=2 -D_POSIX_SOURCE=1} \
829     %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \
830                     -D_XOPEN_SOURCE=1} \
831      %{!Xpg4:-D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT \
832              -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII \
833              -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX \
834              %{Xods30:-isystem include/ods_30_compat%s \
835                       -isystem /usr/include/ods_30_compat \
836                       -D_SCO_ODS_30 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \
837                       -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \
838                       -DM_WORDSWAP}}}} \
839   %{scointl:-DM_INTERNAT -D_M_INTERNAT} \
840   %{traditional:-D_KR -D_SVID -D_NO_PROTOTYPE} \
841   %{!mcoff:-D_SCO_ELF} \
842   %{mcoff:-D_M_COFF -D_SCO_COFF} \
843   %{!mcoff:%{fpic:-D__PIC__ -D__pic__} \
844          %{fPIC:%{!fpic:-D__PIC__ -D__pic__}}} \
845   %{Xa:-D_SCO_C_DIALECT=1} \
846   %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \
847    %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \
848     %{!Xk:%{Xt:-D_SCO_C_DIALECT=2} \
849      %{!Xt:-D_SCO_C_DIALECT=1}}}} \
850   %{traditional:-traditional -D_KR -D_NO_PROTOTYPE}"
851
852 #undef LINK_SPEC
853 #define LINK_SPEC \
854  "-b %{!mcoff:elf}%{mcoff:coff \
855    %{static:%e-static not valid with -mcoff} \
856    %{shared:%e-shared not valid with -mcoff} \
857    %{symbolic:%e-symbolic not valid with -mcoff} \
858    %{fpic:%e-fpic not valid with -mcoff} \
859    %{fPIC:%e-fPIC not valid with -mcoff}} \
860   -R%{Xa:a}%{!Xa:%{Xc:c}%{!Xc:%{Xk:k}%{!Xk:%{Xt:t}%{!Xt:a}}}},%{ansi:ansi}%{!ansi:%{posix:posix}%{!posix:%{Xpg4:xpg4}%{!Xpg4:%{Xpg4plus:XPG4PLUS}%{!Xpg4plus:%{Xods30:ods30}%{!Xods30:XPG4PLUS}}}}},%{mcoff:COFF}%{!mcoff:ELF} \
861   %{Wl,*%*} %{YP,*} %{YL,*} %{YU,*} \
862   %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \
863    %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \
864   %{h*} %{static:-dn -Bstatic} %{shared:-G -dy %{!z*:-z text}} \
865   %{symbolic:-Bsymbolic -G -dy %{!z*:-z text}} %{z*} %{R*} %{Y*} \
866   %{G:-G} %{!mcoff:%{Qn:} %{!Qy:-Qn}}"
867
868 /* The SCO COFF linker gets confused on the difference between "-ofoo"
869    and "-o foo".   So we just always force a single space. */
870
871 #define SWITCHES_NEED_SPACES "o"
872
873 /* Library spec. If we are not building a shared library, provide the
874    standard libraries, as per the SCO compiler.  */
875
876 #undef LIB_SPEC
877 #define LIB_SPEC \
878  "%{shared:pic/libgcc.a%s}%{!shared:%{!symbolic:-lcrypt -lgen -lc}}"
879
880 #undef LIBGCC_SPEC
881 #define LIBGCC_SPEC \
882  "%{!shared:-lgcc}"
883
884 #define MASK_COFF               010000000000    /* Mask for elf generation */
885 #define TARGET_COFF             (target_flags & MASK_COFF)
886 #define TARGET_ELF              (1) /* (!(target_flags & MASK_COFF)) */
887
888 #undef SUBTARGET_SWITCHES
889 #define SUBTARGET_SWITCHES                                      \
890         { "elf", -MASK_COFF, N_("Generate ELF output")  },
891
892 #define NO_DOLLAR_IN_LABEL
893
894 /* Implicit library calls should use memcpy, not bcopy, etc.  They are 
895    faster on OpenServer libraries. */
896
897 #define TARGET_MEM_FUNCTIONS
898
899 /* Biggest alignment supported by the object file format of this
900    machine.  Use this macro to limit the alignment which can be
901    specified using the `__attribute__ ((aligned (N)))' construct.  If
902    not defined, the default value is `BIGGEST_ALIGNMENT'.  */
903
904 #define MAX_OFILE_ALIGNMENT (32768*8)
905
906 /* Define the `__builtin_va_list' type for the ABI.  On OpenServer, this
907    type is `char *'.  */
908 #undef BUILD_VA_LIST_TYPE
909 #define BUILD_VA_LIST_TYPE(VALIST) \
910   (VALIST) = build_pointer_type (char_type_node)
911
912
913 /*
914 Here comes some major hackery to get the crt stuff to compile properly.
915 Since we can (and do) compile for both COFF and ELF environments, we
916 set things up accordingly, based on the pre-processor defines for ELF
917 and COFF. This is insane, but then I guess having one compiler with a
918 single back-end supporting two vastly different file format types is
919 a little insane too. But it is not impossible and we get a useful
920 compiler at the end of the day. Onward we go ...
921 */
922
923 #if defined(CRT_BEGIN) || defined(CRT_END) || defined(IN_LIBGCC2)
924 # undef OBJECT_FORMAT_ELF
925 # undef INIT_SECTION_ASM_OP
926 # undef FINI_SECTION_ASM_OP
927 # undef CTORS_SECTION_ASM_OP
928 # undef DTORS_SECTION_ASM_OP
929 # undef EH_FRAME_SECTION_ASM_OP
930 # undef CTOR_LIST_BEGIN
931 # undef CTOR_LIST_END
932 # undef DO_GLOBAL_CTORS_BODY
933
934 # if defined (_SCO_ELF)
935 #  define OBJECT_FORMAT_ELF
936 #  define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_ELF
937 #  define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_ELF
938 #  define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_ELF
939 #  define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_ELF
940 #  define EH_FRAME_SECTION_ASM_OP EH_FRAME_SECTION_ASM_OP_ELF
941 # else /* ! _SCO_ELF */
942 #  define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_COFF
943 #  define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_COFF
944 #  define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_COFF
945 #  define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_COFF
946 #  define EH_FRAME_SECTION_ASM_OP EH_FRAME_SECTION_ASM_OP_COFF
947 #  define CTOR_LIST_BEGIN asm (INIT_SECTION_ASM_OP); asm ("pushl $0")
948 #  define CTOR_LIST_END CTOR_LIST_BEGIN
949 #  define DO_GLOBAL_CTORS_BODY                                          \
950 do {                                                                    \
951      func_ptr *p, *beg = alloca(0);                                     \
952      for (p = beg; *p;)                                                 \
953       (*p++) ();                                                        \
954 } while (0)
955 # endif /* ! _SCO_ELF */
956 #endif /* CRT_BEGIN !! CRT_END */