OSDN Git Service

* configure.in (HAVE_AS_GOTOFF_IN_DATA): New x86 check.
[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\t"
58
59 #undef ASM_LONG
60 #define ASM_LONG                        "\t.long\t"
61
62 #undef ASM_QUAD
63 #define ASM_QUAD "\t.quad\t"  /* Should not be used for 32bit compilation.  */
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_NAME_COFF      ".ehfram"
82 #define EH_FRAME_SECTION_NAME_ELF       ".eh_frame"
83 #define EH_FRAME_SECTION_NAME   \
84   ((TARGET_ELF) ? EH_FRAME_SECTION_NAME_ELF : EH_FRAME_SECTION_NAME_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_ALIGNED_COMMON
241 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)              \
242 do {                                                                    \
243   fprintf ((FILE), "%s", COMMON_ASM_OP);                                \
244   assemble_name ((FILE), (NAME));                                       \
245   if (TARGET_ELF)                                                       \
246     fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT);      \
247   else                                                                  \
248     fprintf ((FILE), ",%u\n", (SIZE));                                  \
249 } while (0)
250
251 #undef ASM_OUTPUT_ALIGNED_LOCAL
252 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)               \
253 do {                                                                    \
254   if (TARGET_ELF) {                                                     \
255     fprintf ((FILE), "%s", LOCAL_ASM_OP);                               \
256     assemble_name ((FILE), (NAME));                                     \
257     fprintf ((FILE), "\n");                                             \
258     ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN);                \
259   } else {                                                              \
260     int align = exact_log2 (ALIGN);                                     \
261     if (align > 2) align = 2;                                           \
262     if (TARGET_SVR3_SHLIB)                                              \
263       data_section ();                                                  \
264     else                                                                \
265       bss_section ();                                                   \
266     ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align);                 \
267     fprintf ((FILE), "%s\t", "\t.lcomm");                               \
268     assemble_name ((FILE), (NAME));                                     \
269     fprintf ((FILE), ",%u\n", (SIZE));                                  \
270    }                                                                    \
271 } while (0)
272
273 /* A C statement (sans semicolon) to output to the stdio stream
274    FILE the assembler definition of uninitialized global DECL named
275    NAME whose size is SIZE bytes and alignment is ALIGN bytes.
276    Try to use asm_output_aligned_bss to implement this macro.  */
277
278 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
279 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
280
281 #undef ESCAPES
282 #define ESCAPES \
283 "\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\
284 \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\
285 \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\
286 \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\
287 \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\
288 \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\
289 \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\
290 \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"
291
292 #undef STRING_LIMIT
293 #define STRING_LIMIT    ((unsigned) 256)
294
295 #undef ASM_OUTPUT_LIMITED_STRING
296 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR)                            \
297   do                                                                    \
298     {                                                                   \
299       register const unsigned char *_limited_str =                      \
300         (const unsigned char *) (STR);                                  \
301       register unsigned ch;                                             \
302       fprintf ((FILE), "%s\"", STRING_ASM_OP);                          \
303       for (; (ch = *_limited_str); _limited_str++)                      \
304         {                                                               \
305           register int escape;                                          \
306           switch (escape = ESCAPES[ch])                                 \
307             {                                                           \
308             case 0:                                                     \
309               putc (ch, (FILE));                                        \
310               break;                                                    \
311             case 1:                                                     \
312               fprintf ((FILE), "\\%03o", ch);                           \
313               break;                                                    \
314             default:                                                    \
315               putc ('\\', (FILE));                                      \
316               putc (escape, (FILE));                                    \
317               break;                                                    \
318             }                                                           \
319         }                                                               \
320       fprintf ((FILE), "\"\n");                                         \
321     }                                                                   \
322   while (0)
323
324
325 #undef ASM_OUTPUT_ASCII
326 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                             \
327 do {                                                                    \
328       register const unsigned char *_ascii_bytes =                      \
329         (const unsigned char *) (STR);                                  \
330       register const unsigned char *limit = _ascii_bytes + (LENGTH);    \
331       register unsigned bytes_in_chunk = 0;                             \
332       for (; _ascii_bytes < limit; _ascii_bytes++)                      \
333         {                                                               \
334           register unsigned const char *p;                              \
335           if (bytes_in_chunk >= 64)                                     \
336             {                                                           \
337               fputc ('\n', (FILE));                                     \
338               bytes_in_chunk = 0;                                       \
339             }                                                           \
340           for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
341             continue;                                                   \
342           if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT)          \
343             {                                                           \
344               if (bytes_in_chunk > 0)                                   \
345                 {                                                       \
346                   fputc ('\n', (FILE));                                 \
347                   bytes_in_chunk = 0;                                   \
348                 }                                                       \
349               ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
350               _ascii_bytes = p;                                         \
351             }                                                           \
352           else                                                          \
353             {                                                           \
354               if (bytes_in_chunk == 0)                                  \
355                 fprintf ((FILE), "%s", ASM_BYTE_OP);                    \
356               else                                                      \
357                 fputc (',', (FILE));                                    \
358               fprintf ((FILE), "0x%02x", *_ascii_bytes);                \
359               bytes_in_chunk += 5;                                      \
360             }                                                           \
361         }                                                               \
362       if (bytes_in_chunk > 0)                                           \
363         fprintf ((FILE), "\n");                                         \
364 } while (0) 
365
366 /* Must use data section for relocatable constants when pic.  */
367 #undef SELECT_RTX_SECTION
368 #define SELECT_RTX_SECTION(MODE,RTX,ALIGN)                              \
369 {                                                                       \
370   if (TARGET_ELF) {                                                     \
371     if (flag_pic && symbolic_operand (RTX, VOIDmode))                   \
372       data_section ();                                                  \
373     else                                                                \
374       const_section ();                                                 \
375   } else                                                                \
376     readonly_data_section();                                            \
377 }
378
379 #undef ASM_OUTPUT_CASE_LABEL
380 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE)                \
381 do {                                                                    \
382   if (TARGET_ELF)                                                       \
383     ASM_OUTPUT_ALIGN ((FILE), 2);                                       \
384   ASM_OUTPUT_INTERNAL_LABEL((FILE),(PREFIX),(NUM));                     \
385 } while (0)
386
387 #undef TARGET_ASM_CONSTRUCTOR
388 #define TARGET_ASM_CONSTRUCTOR sco_asm_out_constructor
389
390 #undef ASM_OUTPUT_IDENT
391 #define ASM_OUTPUT_IDENT(FILE, NAME) \
392   fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME);
393
394 #undef ASM_GLOBALIZE_LABEL
395 #define ASM_GLOBALIZE_LABEL(FILE,NAME)  \
396   (fprintf ((FILE), "%s", GLOBAL_ASM_OP), assemble_name (FILE, NAME), fputs ("\n", FILE))
397
398 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
399 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)                          \
400   if (TARGET_ELF) ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
401
402 #undef ASM_OUTPUT_INTERNAL_LABEL
403 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)                      \
404   fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
405
406 /* The prefix to add to user-visible assembler symbols. */
407
408 #undef USER_LABEL_PREFIX
409 #define USER_LABEL_PREFIX ""
410
411 /* 
412  * We rename 'gcc_except_table' to the shorter name in preparation
413  * for the day when we're ready to do DWARF2 eh unwinding under COFF.
414  */
415 #define EXCEPTION_SECTION()             named_section (NULL, ".gccexc", 1)
416
417 /* Switch into a generic section.  */
418 #undef TARGET_ASM_NAMED_SECTION
419 #define TARGET_ASM_NAMED_SECTION  sco_asm_named_section
420
421 #undef ASM_OUTPUT_SKIP
422 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
423 do {                                                                    \
424   if (TARGET_ELF)                                                       \
425     fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (SIZE));                      \
426   else                                                                  \
427     fprintf ((FILE), "%s.,.+%u\n", SET_ASM_OP, (SIZE));         \
428 } while (0)
429
430
431 #undef CTOR_LIST_BEGIN
432 #define CTOR_LIST_BEGIN                                                 \
433 do {                                                                    \
434   asm (CTORS_SECTION_ASM_OP);                                           \
435   if (TARGET_ELF)                                                       \
436     STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) };             \
437   else                                                                  \
438     asm ("pushl $0");                                                   \
439 } while (0)
440
441 #undef CTOR_LIST_END
442 #define CTOR_LIST_END                                                   \
443 do {                                                                    \
444   if (TARGET_ELF) {                                                     \
445     asm (CTORS_SECTION_ASM_OP);                                         \
446     STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (0) };              \
447   } else {                                                              \
448     CTOR_LIST_BEGIN;                                                    \
449   }                                                                     \
450 } while (0)
451
452 #undef DBX_BLOCKS_FUNCTION_RELATIVE
453 #define DBX_BLOCKS_FUNCTION_RELATIVE 1
454
455 #undef DBX_FUNCTION_FIRST
456 #define DBX_FUNCTION_FIRST 1
457
458 #undef DBX_REGISTER_NUMBER
459 #define DBX_REGISTER_NUMBER(n) \
460   ((TARGET_ELF) ? svr4_dbx_register_map[n] : dbx_register_map[n])
461
462 #undef DWARF2_DEBUGGING_INFO
463 #undef DWARF_DEBUGGING_INFO
464 #undef SDB_DEBUGGING_INFO
465 #undef DBX_DEBUGGING_INFO
466 #undef PREFERRED_DEBUGGING_TYPE
467
468 #define DWARF2_DEBUGGING_INFO 1
469 #define DWARF_DEBUGGING_INFO 1
470 #define SDB_DEBUGGING_INFO   1
471 #define DBX_DEBUGGING_INFO   1
472 #define PREFERRED_DEBUGGING_TYPE                                        \
473   ((TARGET_ELF) ? DWARF2_DEBUG: SDB_DEBUG)
474
475 #undef EXTRA_SECTIONS
476 #define EXTRA_SECTIONS in_const, in_init, in_fini
477
478 #undef EXTRA_SECTION_FUNCTIONS
479 #define EXTRA_SECTION_FUNCTIONS                                         \
480   CONST_SECTION_FUNCTION                                                \
481   INIT_SECTION_FUNCTION                                                 \
482   FINI_SECTION_FUNCTION
483
484 #undef CONST_SECTION_FUNCTION
485 #define CONST_SECTION_FUNCTION                                          \
486 void                                                                    \
487 const_section ()                                                        \
488 {                                                                       \
489   if (!USE_CONST_SECTION)                                               \
490     text_section();                                                     \
491   else if (in_section != in_const)                                      \
492     {                                                                   \
493       fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP);             \
494       in_section = in_const;                                            \
495     }                                                                   \
496 }
497
498 #undef FINI_SECTION_FUNCTION
499 #define FINI_SECTION_FUNCTION                                           \
500 void                                                                    \
501 fini_section ()                                                         \
502 {                                                                       \
503   if ((!TARGET_ELF) && in_section != in_fini)                           \
504     {                                                                   \
505       fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP);              \
506       in_section = in_fini;                                             \
507     }                                                                   \
508 }
509
510 #undef INIT_SECTION_FUNCTION
511 #define INIT_SECTION_FUNCTION                                           \
512 void                                                                    \
513 init_section ()                                                         \
514 {                                                                       \
515   if ((!TARGET_ELF) && in_section != in_init)                           \
516     {                                                                   \
517       fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP);              \
518       in_section = in_init;                                             \
519     }                                                                   \
520 }
521
522 #undef SUBTARGET_FRAME_POINTER_REQUIRED
523 #define SUBTARGET_FRAME_POINTER_REQUIRED                                \
524   ((TARGET_ELF) ? 0 :                                                   \
525    (current_function_calls_setjmp || current_function_calls_longjmp))
526
527 #undef LOCAL_LABEL_PREFIX
528 #define LOCAL_LABEL_PREFIX                                              \
529  ((TARGET_ELF) ? "" : ".")
530
531 #undef MD_EXEC_PREFIX
532 #undef MD_STARTFILE_PREFIX
533 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
534 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
535
536 #undef NON_SAVING_SETJMP
537 #define NON_SAVING_SETJMP                                               \
538   ((TARGET_ELF) ? 0 :                                                   \
539    (current_function_calls_setjmp && current_function_calls_longjmp))
540
541 #undef NO_IMPLICIT_EXTERN_C
542 #define NO_IMPLICIT_EXTERN_C 1
543
544 /* JKJ FIXME - examine the ramifications of RETURN_IN_MEMORY and
545    RETURN_POPS_ARGS */
546
547 #undef RETURN_POPS_ARGS
548 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE)                          \
549  ((TARGET_ELF) ?                                                        \
550   (ix86_return_pops_args (FUNDECL, FUNTYPE, SIZE)) :                    \
551   (((FUNDECL) && (TREE_CODE (FUNDECL) == IDENTIFIER_NODE)) ? 0          \
552    : (TARGET_RTD                                                        \
553       && (TYPE_ARG_TYPES (FUNTYPE) == 0                                 \
554           || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE)))         \
555               == void_type_node))) ? (SIZE)                             \
556    : 0))
557
558 #undef SELECT_SECTION
559 #define SELECT_SECTION(DECL,RELOC,ALIGN)                                \
560 {                                                                       \
561   if (TARGET_ELF && flag_pic && RELOC)                                  \
562      data_section ();                                                   \
563   else if (TREE_CODE (DECL) == STRING_CST)                              \
564     {                                                                   \
565       if (! flag_writable_strings)                                      \
566         const_section ();                                               \
567       else                                                              \
568         data_section ();                                                \
569     }                                                                   \
570   else if (TREE_CODE (DECL) == VAR_DECL)                                \
571     {                                                                   \
572       if (! DECL_READONLY_SECTION (DECL, RELOC))                        \
573         data_section ();                                                \
574       else                                                              \
575         const_section ();                                               \
576     }                                                                   \
577   else                                                                  \
578     const_section ();                                                   \
579 }
580
581 #undef SWITCH_TAKES_ARG
582 #define SWITCH_TAKES_ARG(CHAR)                                          \
583   (DEFAULT_SWITCH_TAKES_ARG(CHAR)                                       \
584    || (CHAR) == 'h'                                                     \
585    || (CHAR) == 'R'                                                     \
586    || (CHAR) == 'Y'                                                     \
587    || (CHAR) == 'z')
588
589 #undef WORD_SWITCH_TAKES_ARG
590 #define WORD_SWITCH_TAKES_ARG(STR)                                      \
591  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                                   \
592   && strcmp (STR, "Tdata") && strcmp (STR, "Ttext")                     \
593   && strcmp (STR, "Tbss"))
594
595 #undef TARGET_SUBTARGET_DEFAULT
596 #define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
597
598 #undef HANDLE_SYSV_PRAGMA
599 #define HANDLE_SYSV_PRAGMA 1
600
601 /* Though OpenServer supports .weak in COFF, we don't use it.
602  * G++ will frequently emit a symol as .weak and then (in the same .s 
603  * file) declare it global.   The COFF assembler finds this unamusing.
604  */
605 #define SUPPORTS_WEAK (TARGET_ELF)
606 #define ASM_WEAKEN_LABEL(FILE,NAME) \
607   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME);           \
608         fputc ('\n', FILE); } while (0)
609
610 #undef SCCS_DIRECTIVE
611 #define SCCS_DIRECTIVE 1
612
613 /*
614  * Define sizes and types
615  */
616 #undef SIZE_TYPE
617 #undef PTRDIFF_TYPE
618 #undef WCHAR_TYPE
619 #undef WCHAR_TYPE_SIZE
620 #undef LONG_DOUBLE_TYPE_SIZE
621 #define LONG_DOUBLE_TYPE_SIZE   96
622 #define SIZE_TYPE               "unsigned int"
623 #define PTRDIFF_TYPE            "int"
624 #define WCHAR_TYPE              "long int"
625 #define WCHAR_TYPE_SIZE         BITS_PER_WORD
626
627 /*
628  * New for multilib support. Set the default switches for multilib,
629  * which is -melf.
630  */
631 #define MULTILIB_DEFAULTS { "melf" }
632
633 \f
634 /* Please note that these specs may look messy but they are required in
635    order to emulate the SCO Development system as closely as possible.
636    With SCO Open Server 5.0, you now get the linker and assembler free,
637    so that is what these specs are targeted for. These utilities are
638    very argument sensitive: a space in the wrong place breaks everything.
639    So RMS, please forgive this mess. It works.
640
641    Parameters which can be passed to gcc, and their SCO equivalents:
642    GCC Parameter                SCO Equivalent
643    -ansi                        -a ansi
644    -posix                       -a posix
645    -Xpg4                        -a xpg4
646    -Xpg4plus                    -a xpg4plus
647    -Xods30                      -a ods30
648
649    As with SCO, the default is XPG4 plus mode. SCO also allows you to
650    specify a C dialect with -Xt, -Xa, -Xc, -Xk and -Xm. These are passed
651    on to the assembler and linker in the same way that the SCO compiler
652    does.
653
654    SCO also allows you to compile, link and generate either ELF or COFF
655    binaries. With gcc, unlike the SCO compiler, the default is ELF.
656    Specify -mcoff to gcc to produce COFF binaries. -fpic will get the
657    assembler and linker to produce PIC code.
658 */
659
660 /* Set up assembler flags for PIC and ELF compilations */
661 #undef ASM_SPEC
662
663 #if USE_GAS
664   /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c 
665    * Undef MD_EXEC_PREFIX becuase we don't know where GAS is, but it's not
666    * likely in /usr/ccs/bin/ 
667    */
668 #undef MD_EXEC_PREFIX 
669 #else
670
671 #define ASM_SPEC \
672    "-b %{!mcoff:elf}%{mcoff:coff \
673      %{static:%e-static not valid with -mcoff} \
674      %{shared:%e-shared not valid with -mcoff} \
675      %{symbolic:%e-symbolic not valid with -mcoff}} \
676     %{Ym,*} %{Yd,*} %{Wa,*:%*} \
677     %{!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}}"
678 #endif
679
680 /* Use crt1.o as a startup file and crtn.o as a closing file.  */
681
682 #undef STARTFILE_SPEC
683 #define STARTFILE_SPEC \
684  "%{shared: %{!mcoff: crti.o%s}} \
685   %{!shared:\
686    %{!symbolic: \
687     %{pg:gcrt.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}} \
688   %{ansi:values-Xc.o%s} \
689   %{!ansi: \
690    %{traditional:values-Xt.o%s} \
691     %{!traditional: \
692      %{Xa:values-Xa.o%s} \
693       %{!Xa:%{Xc:values-Xc.o%s} \
694        %{!Xc:%{Xk:values-Xk.o%s} \
695         %{!Xk:%{Xt:values-Xt.o%s} \
696          %{!Xt:values-Xa.o%s}}}}}} \
697   %{mcoff:crtbeginS.o%s} %{!mcoff:crtbegin.o%s}"
698
699 #undef ENDFILE_SPEC
700 #define ENDFILE_SPEC \
701  "%{!mcoff:crtend.o%s} \
702   %{mcoff:crtendS.o%s} \
703   %{pg:gcrtn.o%s}%{!pg:crtn.o%s}"
704
705 #undef CPP_PREDEFINES
706 #define CPP_PREDEFINES \
707  "-Asystem=svr3"
708
709 /* You are in a maze of GCC specs ... all alike */
710
711 #undef CPP_SPEC
712 #define CPP_SPEC "%(cpp_cpu) \
713   %{fpic:%{mcoff:%e-fpic is not valid with -mcoff}} \
714   %{fPIC:%{mcoff:%e-fPIC is not valid with -mcoff}} \
715   -D__i386 -D__unix -D_SCO_DS=1 -D_M_I386 -D_M_XENIX -D_M_UNIX \
716   %{!Xods30:-D_STRICT_NAMES} \
717   %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \
718   %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi -D_STRICT_ANSI} \
719   %{!ansi: \
720    %{posix:-isystem include/posix%s -isystem /usr/include/posix \
721            -D_POSIX_C_SOURCE=2 -D_POSIX_SOURCE=1} \
722     %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \
723                     -D_XOPEN_SOURCE=1} \
724      %{!Xpg4:-D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT \
725              -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII \
726              -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX \
727              %{Xods30:-isystem include/ods_30_compat%s \
728                       -isystem /usr/include/ods_30_compat \
729                       -D_SCO_ODS_30 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \
730                       -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \
731                       -DM_WORDSWAP}}}} \
732   %{scointl:-DM_INTERNAT -D_M_INTERNAT} \
733   %{traditional:-D_KR -D_SVID -D_NO_PROTOTYPE} \
734   %{!mcoff:-D_SCO_ELF} \
735   %{mcoff:-D_M_COFF -D_SCO_COFF} \
736   %{!mcoff:%{fpic:-D__PIC__ -D__pic__} \
737          %{fPIC:%{!fpic:-D__PIC__ -D__pic__}}} \
738   %{Xa:-D_SCO_C_DIALECT=1} \
739   %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \
740    %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \
741     %{!Xk:%{Xt:-D_SCO_C_DIALECT=2} \
742      %{!Xt:-D_SCO_C_DIALECT=1}}}} \
743   %{traditional:-traditional -D_KR -D_NO_PROTOTYPE}"
744
745 #undef LINK_SPEC
746 #define LINK_SPEC \
747  "-b %{!mcoff:elf}%{mcoff:coff \
748    %{static:%e-static not valid with -mcoff} \
749    %{shared:%e-shared not valid with -mcoff} \
750    %{symbolic:%e-symbolic not valid with -mcoff} \
751    %{fpic:%e-fpic not valid with -mcoff} \
752    %{fPIC:%e-fPIC not valid with -mcoff}} \
753   -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} \
754   %{Wl,*%*} %{YP,*} %{YL,*} %{YU,*} \
755   %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \
756    %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \
757   %{h*} %{static:-dn -Bstatic} %{shared:-G -dy %{!z*:-z text}} \
758   %{symbolic:-Bsymbolic -G -dy %{!z*:-z text}} %{z*} %{R*} %{Y*} \
759   %{G:-G} %{!mcoff:%{Qn:} %{!Qy:-Qn}}"
760
761 /* The SCO COFF linker gets confused on the difference between "-ofoo"
762    and "-o foo".   So we just always force a single space. */
763
764 #define SWITCHES_NEED_SPACES "o"
765
766 /* Library spec. If we are not building a shared library, provide the
767    standard libraries, as per the SCO compiler.  */
768
769 #undef LIB_SPEC
770 #define LIB_SPEC \
771  "%{shared:pic/libgcc.a%s}%{!shared:%{!symbolic:-lcrypt -lgen -lc}}"
772
773 #undef LIBGCC_SPEC
774 #define LIBGCC_SPEC \
775  "%{!shared:-lgcc}"
776
777 #define MASK_COFF               010000000000    /* Mask for elf generation */
778 #define TARGET_COFF             (target_flags & MASK_COFF)
779 #define TARGET_ELF              (1) /* (!(target_flags & MASK_COFF)) */
780
781 #undef SUBTARGET_SWITCHES
782 #define SUBTARGET_SWITCHES                                      \
783         { "elf", -MASK_COFF, N_("Generate ELF output")  },
784
785 #define NO_DOLLAR_IN_LABEL
786
787 /* Implicit library calls should use memcpy, not bcopy, etc.  They are 
788    faster on OpenServer libraries. */
789
790 #define TARGET_MEM_FUNCTIONS
791
792 /* Biggest alignment supported by the object file format of this
793    machine.  Use this macro to limit the alignment which can be
794    specified using the `__attribute__ ((aligned (N)))' construct.  If
795    not defined, the default value is `BIGGEST_ALIGNMENT'.  */
796
797 #define MAX_OFILE_ALIGNMENT (32768*8)
798
799 /* Define the `__builtin_va_list' type for the ABI.  On OpenServer, this
800    type is `char *'.  */
801 #undef BUILD_VA_LIST_TYPE
802 #define BUILD_VA_LIST_TYPE(VALIST) \
803   (VALIST) = build_pointer_type (char_type_node)
804
805
806 /*
807 Here comes some major hackery to get the crt stuff to compile properly.
808 Since we can (and do) compile for both COFF and ELF environments, we
809 set things up accordingly, based on the pre-processor defines for ELF
810 and COFF. This is insane, but then I guess having one compiler with a
811 single back-end supporting two vastly different file format types is
812 a little insane too. But it is not impossible and we get a useful
813 compiler at the end of the day. Onward we go ...
814 */
815
816 #if defined(CRT_BEGIN) || defined(CRT_END) || defined(IN_LIBGCC2)
817 # undef OBJECT_FORMAT_ELF
818 # undef INIT_SECTION_ASM_OP
819 # undef FINI_SECTION_ASM_OP
820 # undef CTORS_SECTION_ASM_OP
821 # undef DTORS_SECTION_ASM_OP
822 # undef EH_FRAME_SECTION_NAME
823 # undef CTOR_LIST_BEGIN
824 # undef CTOR_LIST_END
825 # undef DO_GLOBAL_CTORS_BODY
826
827 # if defined (_SCO_ELF)
828 #  define OBJECT_FORMAT_ELF
829 #  define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_ELF
830 #  define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_ELF
831 #  define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_ELF
832 #  define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_ELF
833 #  define EH_FRAME_SECTION_NAME EH_FRAME_SECTION_NAME_ELF
834 # else /* ! _SCO_ELF */
835 #  define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_COFF
836 #  define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_COFF
837 #  define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_COFF
838 #  define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_COFF
839 #  define EH_FRAME_SECTION_NAME EH_FRAME_SECTION_NAME_COFF
840 #  define CTOR_LIST_BEGIN asm (INIT_SECTION_ASM_OP); asm ("pushl $0")
841 #  define CTOR_LIST_END CTOR_LIST_BEGIN
842 #  define DO_GLOBAL_CTORS_BODY                                          \
843 do {                                                                    \
844      func_ptr *p, *beg = alloca(0);                                     \
845      for (p = beg; *p;)                                                 \
846       (*p++) ();                                                        \
847 } while (0)
848 # endif /* ! _SCO_ELF */
849 #endif /* CRT_BEGIN !! CRT_END */
850
851 /* Handle special EH pointer encodings.  Absolute, pc-relative, and
852    indirect are handled automatically.  */
853 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
854   do {                                                                  \
855     if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel)         \
856       {                                                                 \
857         fputs (UNALIGNED_INT_ASM_OP, FILE);                             \
858         assemble_name (FILE, XSTR (ADDR, 0));                           \
859         fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
860         goto DONE;                                                      \
861       }                                                                 \
862   } while (0)
863
864 /* Used by crtstuff.c to initialize the base of data-relative relocations.
865    These are GOT relative on x86, so return the pic register.  */
866 #ifdef __PIC__
867 #define CRT_GET_RFIB_DATA(BASE)                 \
868   {                                             \
869     register void *ebx_ __asm__("ebx");         \
870     BASE = ebx_;                                \
871   }
872 #else
873 #define CRT_GET_RFIB_DATA(BASE)                                         \
874   __asm__ ("call\t.LPR%=\n"                                             \
875            ".LPR%=:\n\t"                                                \
876            "popl\t%0\n\t"                                               \
877            /* Due to a GAS bug, this cannot use EAX.  That encodes      \
878               smaller than the traditional EBX, which results in the    \
879               offset being off by one.  */                              \
880            "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0"                 \
881            : "=d"(BASE))
882 #endif
883
884 /* Select a format to encode pointers in exception handling data.  CODE
885    is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
886    true if the symbol may be affected by dynamic relocations.  */
887 #undef ASM_PREFERRED_EH_DATA_FORMAT
888 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)                       \
889   (flag_pic ? (GLOBAL ? DW_EH_PE_indirect : 0) | DW_EH_PE_datarel       \
890    : DW_EH_PE_absptr)