OSDN Git Service

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