OSDN Git Service

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