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)
6 This file is part of GNU CC.
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)
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.
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. */
23 #include "i386/i386.h" /* Base i386 target definitions */
24 #include "i386/att.h" /* Use AT&T i386 assembler syntax */
27 #define TARGET_VERSION fprintf (stderr, " (i386, SCO OpenServer 5 Syntax)");
33 #define ALIGN_ASM_OP "\t.align\t"
35 #undef ASCII_DATA_ASM_OP
36 #define ASCII_DATA_ASM_OP "\t.ascii\t"
39 #define ASM_BYTE_OP "\t.byte\t"
42 #define IDENT_ASM_OP "\t.ident\t"
45 #define COMMON_ASM_OP "\t.comm\t"
48 #define SET_ASM_OP "\t.set\t"
51 #define LOCAL_ASM_OP "\t.local\t"
54 #define INT_ASM_OP "\t.long\t"
57 #define ASM_SHORT "\t.value"
60 #define ASM_LONG "\t.long"
63 #define ASM_DOUBLE "\t.double"
66 #define TYPE_ASM_OP "\t.type\t"
69 #define SIZE_ASM_OP "\t.size\t"
72 #define STRING_ASM_OP "\t.string\t"
75 #define SKIP_ASM_OP "\t.zero\t"
78 #define GLOBAL_ASM_OP "\t.globl\t"
80 #undef EH_FRAME_SECTION_ASM_OP
81 #define EH_FRAME_SECTION_ASM_OP_COFF "\t.section\t.ehfram, \"x\""
82 #define EH_FRAME_SECTION_ASM_OP_ELF "\t.section\t.eh_frame, \"aw\""
83 #define EH_FRAME_SECTION_ASM_OP \
84 ((TARGET_ELF) ? EH_FRAME_SECTION_ASM_OP_ELF : EH_FRAME_SECTION_ASM_OP_COFF)
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 )
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)
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)
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)
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)
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)
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)
128 #undef BSS_SECTION_ASM_OP
129 #define BSS_SECTION_ASM_OP "\t.data"
131 #undef TEXT_SECTION_ASM_OP
132 #define TEXT_SECTION_ASM_OP "\t.text"
134 #undef DATA_SECTION_ASM_OP
135 #define DATA_SECTION_ASM_OP "\t.data"
137 #undef TYPE_OPERAND_FMT
138 #define TYPE_OPERAND_FMT "@%s"
140 #undef APPLY_RESULT_SIZE
141 #define APPLY_RESULT_SIZE \
142 (TARGET_ELF) ? size : 116
144 #ifndef ASM_DECLARE_RESULT
145 #define ASM_DECLARE_RESULT(FILE, RESULT)
148 #define SCO_DEFAULT_ASM_COFF(FILE,NAME) \
150 ASM_OUTPUT_LABEL (FILE, NAME); \
153 #undef ASM_DECLARE_FUNCTION_NAME
154 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
157 fprintf (FILE, "%s", TYPE_ASM_OP); \
158 assemble_name (FILE, NAME); \
160 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
162 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
163 ASM_OUTPUT_LABEL(FILE, NAME); \
165 SCO_DEFAULT_ASM_COFF(FILE, NAME); \
168 #undef ASM_DECLARE_FUNCTION_SIZE
169 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
171 if (TARGET_ELF) { if (!flag_inhibit_size_directive) \
173 fprintf (FILE, "%s", SIZE_ASM_OP); \
174 assemble_name (FILE, (FNAME)); \
175 fprintf (FILE, ",.-"); \
176 assemble_name (FILE, (FNAME)); \
181 #undef ASM_DECLARE_OBJECT_NAME
182 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
185 fprintf (FILE, "%s", TYPE_ASM_OP); \
186 assemble_name (FILE, NAME); \
188 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
190 size_directive_output = 0; \
191 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
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))); \
198 ASM_OUTPUT_LABEL(FILE, NAME); \
200 SCO_DEFAULT_ASM_COFF(FILE, NAME); \
203 #undef ASM_FILE_START_1
204 #define ASM_FILE_START_1(FILE)
206 #undef ASM_FILE_START
207 #define ASM_FILE_START(FILE) \
209 output_file_directive((FILE),main_input_filename); \
210 fprintf ((FILE), "\t.version\t\"01.01\"\n"); \
213 #undef ASM_FINISH_DECLARE_OBJECT
214 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
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) \
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))); \
231 #undef ASM_GENERATE_INTERNAL_LABEL
232 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
235 sprintf (LABEL, "*.%s%d", (PREFIX), (NUM)); \
237 sprintf (LABEL, ".%s%d", (PREFIX), (NUM)); \
240 #undef ASM_OUTPUT_ADDR_DIFF_ELT
241 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
244 fprintf (FILE, "%s _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", ASM_LONG, LPREFIX, VALUE); \
246 fprintf (FILE, "\t.word %s%d-%s%d\n", LPREFIX,VALUE,LPREFIX,REL); \
249 #undef ASM_OUTPUT_ALIGNED_COMMON
250 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
252 fprintf ((FILE), "%s", COMMON_ASM_OP); \
253 assemble_name ((FILE), (NAME)); \
255 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
257 fprintf ((FILE), ",%u\n", (SIZE)); \
260 #undef ASM_OUTPUT_ALIGNED_LOCAL
261 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
264 fprintf ((FILE), "%s", LOCAL_ASM_OP); \
265 assemble_name ((FILE), (NAME)); \
266 fprintf ((FILE), "\n"); \
267 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
269 int align = exact_log2 (ALIGN); \
270 if (align > 2) align = 2; \
271 if (TARGET_SVR3_SHLIB) \
275 ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \
276 fprintf ((FILE), "%s\t", "\t.lcomm"); \
277 assemble_name ((FILE), (NAME)); \
278 fprintf ((FILE), ",%u\n", (SIZE)); \
282 /* A C statement (sans semicolon) to output to the stdio stream
283 FILE the assembler definition of uninitialized global DECL named
284 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
285 Try to use asm_output_aligned_bss to implement this macro. */
287 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
288 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
292 "\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
293 \0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
294 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\
295 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\
296 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
297 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
298 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
299 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1"
302 #define STRING_LIMIT ((unsigned) 256)
304 #undef ASM_OUTPUT_LIMITED_STRING
305 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
308 register const unsigned char *_limited_str = \
309 (const unsigned char *) (STR); \
310 register unsigned ch; \
311 fprintf ((FILE), "%s\"", STRING_ASM_OP); \
312 for (; (ch = *_limited_str); _limited_str++) \
314 register int escape; \
315 switch (escape = ESCAPES[ch]) \
321 fprintf ((FILE), "\\%03o", ch); \
324 putc ('\\', (FILE)); \
325 putc (escape, (FILE)); \
329 fprintf ((FILE), "\"\n"); \
334 #undef ASM_OUTPUT_ASCII
335 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
337 register const unsigned char *_ascii_bytes = \
338 (const unsigned char *) (STR); \
339 register const unsigned char *limit = _ascii_bytes + (LENGTH); \
340 register unsigned bytes_in_chunk = 0; \
341 for (; _ascii_bytes < limit; _ascii_bytes++) \
343 register unsigned const char *p; \
344 if (bytes_in_chunk >= 64) \
346 fputc ('\n', (FILE)); \
347 bytes_in_chunk = 0; \
349 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
351 if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \
353 if (bytes_in_chunk > 0) \
355 fputc ('\n', (FILE)); \
356 bytes_in_chunk = 0; \
358 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
363 if (bytes_in_chunk == 0) \
364 fprintf ((FILE), "%s", ASM_BYTE_OP); \
366 fputc (',', (FILE)); \
367 fprintf ((FILE), "0x%02x", *_ascii_bytes); \
368 bytes_in_chunk += 5; \
371 if (bytes_in_chunk > 0) \
372 fprintf ((FILE), "\n"); \
375 /* Must use data section for relocatable constants when pic. */
376 #undef SELECT_RTX_SECTION
377 #define SELECT_RTX_SECTION(MODE,RTX) \
380 if (flag_pic && symbolic_operand (RTX, VOIDmode)) \
385 readonly_data_section(); \
388 #undef ASM_OUTPUT_CASE_LABEL
389 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \
392 ASM_OUTPUT_ALIGN ((FILE), 2); \
393 ASM_OUTPUT_INTERNAL_LABEL((FILE),(PREFIX),(NUM)); \
397 #undef ASM_OUTPUT_CONSTRUCTOR
398 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
402 fprintf (FILE, "%s", INT_ASM_OP); \
403 assemble_name (FILE, NAME); \
404 fprintf (FILE, "\n"); \
407 fprintf (FILE, "\tpushl $"); \
408 assemble_name (FILE, NAME); \
409 fprintf (FILE, "\n"); } \
412 #undef ASM_OUTPUT_DESTRUCTOR
413 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
417 fprintf (FILE, "%s", INT_ASM_OP); \
418 assemble_name (FILE, NAME); \
419 fprintf (FILE, "\n"); \
422 fprintf (FILE, "%s\t ", ASM_LONG); \
423 assemble_name (FILE, NAME); \
424 fprintf (FILE, "\n"); } \
428 #undef ASM_OUTPUT_IDENT
429 #define ASM_OUTPUT_IDENT(FILE, NAME) \
430 fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME);
432 #undef ASM_GLOBALIZE_LABEL
433 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
434 (fprintf ((FILE), "%s", GLOBAL_ASM_OP), assemble_name (FILE, NAME), fputs ("\n", FILE))
436 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
437 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
438 if (TARGET_ELF) ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
440 #undef ASM_OUTPUT_INTERNAL_LABEL
441 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
442 fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
444 /* The prefix to add to user-visible assembler symbols. */
446 #undef USER_LABEL_PREFIX
447 #define USER_LABEL_PREFIX ""
450 * Compensate for the difference between ELF and COFF assembler syntax.
451 * Otherwise, this is cribbed from ../svr4.h.
452 * We rename 'gcc_except_table' to the shorter name in preparation
453 * for the day when we're ready to do DWARF2 eh unwinding under COFF
455 #undef ASM_OUTPUT_SECTION_NAME
456 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
458 static struct section_info \
460 struct section_info *next; \
462 enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
464 struct section_info *s; \
466 enum sect_enum type; \
467 const char *sname = NAME ; \
468 if (strcmp(NAME, ".gcc_except_table") == 0) sname = ".gccexc" ; \
470 for (s = sections; s; s = s->next) \
471 if (!strcmp (NAME, s->name)) \
474 if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
475 type = SECT_EXEC, mode = (TARGET_ELF) ? "ax" : "x" ; \
476 else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
477 type = SECT_RO, mode = "a"; \
479 type = SECT_RW, mode = (TARGET_ELF) ? "aw" : "w" ; \
483 s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
484 s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
485 strcpy (s->name, NAME); \
487 s->next = sections; \
489 fprintf (FILE, ".section\t%s,\"%s\"%s\n", sname, mode, \
490 (TARGET_ELF) ? ",@progbits" : "" ); \
494 if (DECL && s->type != type) \
495 error_with_decl (DECL, "%s causes a section type conflict"); \
497 fprintf (FILE, ".section\t%s\n", sname); \
501 #undef ASM_OUTPUT_SKIP
502 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
505 fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (SIZE)); \
507 fprintf ((FILE), "%s.,.+%u\n", SET_ASM_OP, (SIZE)); \
511 #undef CTOR_LIST_BEGIN
512 #define CTOR_LIST_BEGIN \
514 asm (CTORS_SECTION_ASM_OP); \
516 STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }; \
522 #define CTOR_LIST_END \
525 asm (CTORS_SECTION_ASM_OP); \
526 STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (0) }; \
532 #undef DBX_BLOCKS_FUNCTION_RELATIVE
533 #define DBX_BLOCKS_FUNCTION_RELATIVE 1
535 #undef DBX_FUNCTION_FIRST
536 #define DBX_FUNCTION_FIRST 1
538 #undef DBX_REGISTER_NUMBER
539 #define DBX_REGISTER_NUMBER(n) \
540 ((TARGET_ELF) ? svr4_dbx_register_map[n] : dbx_register_map[n])
542 #undef DWARF_DEBUGGING_INFO
543 #undef SDB_DEBUGGING_INFO
544 #undef DBX_DEBUGGING_INFO
545 #undef PREFERRED_DEBUGGING_TYPE
547 #define DWARF_DEBUGGING_INFO 1
548 #define SDB_DEBUGGING_INFO 1
549 #define DBX_DEBUGGING_INFO 1
550 #define PREFERRED_DEBUGGING_TYPE \
551 ((TARGET_ELF) ? DWARF2_DEBUG: SDB_DEBUG)
553 #undef EXTRA_SECTIONS
554 #define EXTRA_SECTIONS in_const, in_init, in_fini, in_ctors, in_dtors
556 #undef EXTRA_SECTION_FUNCTIONS
557 #define EXTRA_SECTION_FUNCTIONS \
558 CONST_SECTION_FUNCTION \
559 INIT_SECTION_FUNCTION \
560 FINI_SECTION_FUNCTION \
561 CTORS_SECTION_FUNCTION \
562 DTORS_SECTION_FUNCTION
564 #undef CONST_SECTION_FUNCTION
565 #define CONST_SECTION_FUNCTION \
569 if (!USE_CONST_SECTION) \
571 else if (in_section != in_const) \
573 fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
574 in_section = in_const; \
578 #undef FINI_SECTION_FUNCTION
579 #define FINI_SECTION_FUNCTION \
583 if ((!TARGET_ELF) && in_section != in_fini) \
585 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
586 in_section = in_fini; \
590 #undef INIT_SECTION_FUNCTION
591 #define INIT_SECTION_FUNCTION \
595 if ((!TARGET_ELF) && in_section != in_init) \
597 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
598 in_section = in_init; \
602 #undef CTORS_SECTION_FUNCTION
603 #define CTORS_SECTION_FUNCTION \
607 if (in_section != in_ctors) \
609 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
610 in_section = in_ctors; \
614 #undef DTORS_SECTION_FUNCTION
615 #define DTORS_SECTION_FUNCTION \
619 if (in_section != in_dtors) \
621 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
622 in_section = in_dtors; \
626 #undef SUBTARGET_FRAME_POINTER_REQUIRED
627 #define SUBTARGET_FRAME_POINTER_REQUIRED \
628 ((TARGET_ELF) ? 0 : \
629 (current_function_calls_setjmp || current_function_calls_longjmp))
631 #undef JUMP_TABLES_IN_TEXT_SECTION
632 #define JUMP_TABLES_IN_TEXT_SECTION (TARGET_ELF && flag_pic)
634 #undef LOCAL_LABEL_PREFIX
635 #define LOCAL_LABEL_PREFIX \
636 ((TARGET_ELF) ? "" : ".")
638 #undef MD_EXEC_PREFIX
639 #undef MD_STARTFILE_PREFIX
640 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
641 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
643 #undef NON_SAVING_SETJMP
644 #define NON_SAVING_SETJMP \
645 ((TARGET_ELF) ? 0 : \
646 (current_function_calls_setjmp && current_function_calls_longjmp))
648 #undef NO_IMPLICIT_EXTERN_C
649 #define NO_IMPLICIT_EXTERN_C 1
651 /* JKJ FIXME - examine the ramifications of RETURN_IN_MEMORY and
654 #undef RETURN_POPS_ARGS
655 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
657 (ix86_return_pops_args (FUNDECL, FUNTYPE, SIZE)) : \
658 (((FUNDECL) && (TREE_CODE (FUNDECL) == IDENTIFIER_NODE)) ? 0 \
660 && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
661 || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
662 == void_type_node))) ? (SIZE) \
665 #undef SELECT_SECTION
666 #define SELECT_SECTION(DECL,RELOC) \
668 if (TARGET_ELF && flag_pic && RELOC) \
670 else if (TREE_CODE (DECL) == STRING_CST) \
672 if (! flag_writable_strings) \
677 else if (TREE_CODE (DECL) == VAR_DECL) \
679 if (! DECL_READONLY_SECTION (DECL, RELOC)) \
688 #undef SWITCH_TAKES_ARG
689 #define SWITCH_TAKES_ARG(CHAR) \
690 (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
696 #undef WORD_SWITCH_TAKES_ARG
697 #define WORD_SWITCH_TAKES_ARG(STR) \
698 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
699 && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \
700 && strcmp (STR, "Tbss"))
702 #undef TARGET_SUBTARGET_DEFAULT
703 #define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
705 #undef HANDLE_SYSV_PRAGMA
706 #define HANDLE_SYSV_PRAGMA 1
708 /* Though OpenServer supports .weak in COFF, we don't use it.
709 * G++ will frequently emit a symol as .weak and then (in the same .s
710 * file) declare it global. The COFF assembler finds this unamusing.
712 #define SUPPORTS_WEAK (TARGET_ELF)
713 #define ASM_WEAKEN_LABEL(FILE,NAME) \
714 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
715 fputc ('\n', FILE); } while (0)
717 #undef SCCS_DIRECTIVE
718 #define SCCS_DIRECTIVE 1
721 * Define sizes and types
726 #undef WCHAR_TYPE_SIZE
727 #undef LONG_DOUBLE_TYPE_SIZE
728 #define LONG_DOUBLE_TYPE_SIZE 96
729 #define SIZE_TYPE "unsigned int"
730 #define PTRDIFF_TYPE "int"
731 #define WCHAR_TYPE "long int"
732 #define WCHAR_TYPE_SIZE BITS_PER_WORD
735 * New for multilib support. Set the default switches for multilib,
738 #define MULTILIB_DEFAULTS { "melf" }
741 /* Please note that these specs may look messy but they are required in
742 order to emulate the SCO Development system as closely as possible.
743 With SCO Open Server 5.0, you now get the linker and assembler free,
744 so that is what these specs are targeted for. These utilities are
745 very argument sensitive: a space in the wrong place breaks everything.
746 So RMS, please forgive this mess. It works.
748 Parameters which can be passed to gcc, and their SCO equivalents:
749 GCC Parameter SCO Equivalent
753 -Xpg4plus -a xpg4plus
756 As with SCO, the default is XPG4 plus mode. SCO also allows you to
757 specify a C dialect with -Xt, -Xa, -Xc, -Xk and -Xm. These are passed
758 on to the assembler and linker in the same way that the SCO compiler
761 SCO also allows you to compile, link and generate either ELF or COFF
762 binaries. With gcc, unlike the SCO compiler, the default is ELF.
763 Specify -mcoff to gcc to produce COFF binaries. -fpic will get the
764 assembler and linker to produce PIC code.
767 /* Set up assembler flags for PIC and ELF compilations */
771 /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c
772 * Undef MD_EXEC_PREFIX becuase we don't know where GAS is, but it's not
773 * likely in /usr/ccs/bin/
775 #undef MD_EXEC_PREFIX
779 "-b %{!mcoff:elf}%{mcoff:coff \
780 %{static:%e-static not valid with -mcoff} \
781 %{shared:%e-shared not valid with -mcoff} \
782 %{symbolic:%e-symbolic not valid with -mcoff}} \
783 %{Ym,*} %{Yd,*} %{Wa,*:%*} \
784 %{!mcoff:-E%{Xa:a}%{!Xa:%{Xc:c}%{!Xc:%{Xk:k}%{!Xk:%{Xt:t}%{!Xt:a}}}},%{ansi:ansi}%{!ansi:%{posix:posix}%{!posix:%{Xpg4:xpg4}%{!Xpg4:%{Xpg4plus:XPG4PLUS}%{!Xpg4plus:%{Xods30:ods30}%{!Xods30:XPG4PLUS}}}}},ELF %{Qn:} %{!Qy:-Qn}}"
787 /* Use crt1.o as a startup file and crtn.o as a closing file. */
789 #undef STARTFILE_SPEC
790 #define STARTFILE_SPEC \
791 "%{shared: %{!mcoff: crti.o%s}} \
794 %{pg:gcrt.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}} \
795 %{ansi:values-Xc.o%s} \
797 %{traditional:values-Xt.o%s} \
799 %{Xa:values-Xa.o%s} \
800 %{!Xa:%{Xc:values-Xc.o%s} \
801 %{!Xc:%{Xk:values-Xk.o%s} \
802 %{!Xk:%{Xt:values-Xt.o%s} \
803 %{!Xt:values-Xa.o%s}}}}}} \
804 %{mcoff:crtbeginS.o%s} %{!mcoff:crtbegin.o%s}"
807 #define ENDFILE_SPEC \
808 "%{!mcoff:crtend.o%s} \
809 %{mcoff:crtendS.o%s} \
810 %{pg:gcrtn.o%s}%{!pg:crtn.o%s}"
812 #undef CPP_PREDEFINES
813 #define CPP_PREDEFINES \
816 /* You are in a maze of GCC specs ... all alike */
819 #define CPP_SPEC "%(cpp_cpu) \
820 %{fpic:%{mcoff:%e-fpic is not valid with -mcoff}} \
821 %{fPIC:%{mcoff:%e-fPIC is not valid with -mcoff}} \
822 -D__i386 -D__unix -D_SCO_DS=1 -D_M_I386 -D_M_XENIX -D_M_UNIX \
823 %{!Xods30:-D_STRICT_NAMES} \
824 %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \
825 %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi -D_STRICT_ANSI} \
827 %{posix:-isystem include/posix%s -isystem /usr/include/posix \
828 -D_POSIX_C_SOURCE=2 -D_POSIX_SOURCE=1} \
829 %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \
831 %{!Xpg4:-D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT \
832 -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII \
833 -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX \
834 %{Xods30:-isystem include/ods_30_compat%s \
835 -isystem /usr/include/ods_30_compat \
836 -D_SCO_ODS_30 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \
837 -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \
839 %{scointl:-DM_INTERNAT -D_M_INTERNAT} \
840 %{traditional:-D_KR -D_SVID -D_NO_PROTOTYPE} \
841 %{!mcoff:-D_SCO_ELF} \
842 %{mcoff:-D_M_COFF -D_SCO_COFF} \
843 %{!mcoff:%{fpic:-D__PIC__ -D__pic__} \
844 %{fPIC:%{!fpic:-D__PIC__ -D__pic__}}} \
845 %{Xa:-D_SCO_C_DIALECT=1} \
846 %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \
847 %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \
848 %{!Xk:%{Xt:-D_SCO_C_DIALECT=2} \
849 %{!Xt:-D_SCO_C_DIALECT=1}}}} \
850 %{traditional:-traditional -D_KR -D_NO_PROTOTYPE}"
854 "-b %{!mcoff:elf}%{mcoff:coff \
855 %{static:%e-static not valid with -mcoff} \
856 %{shared:%e-shared not valid with -mcoff} \
857 %{symbolic:%e-symbolic not valid with -mcoff} \
858 %{fpic:%e-fpic not valid with -mcoff} \
859 %{fPIC:%e-fPIC not valid with -mcoff}} \
860 -R%{Xa:a}%{!Xa:%{Xc:c}%{!Xc:%{Xk:k}%{!Xk:%{Xt:t}%{!Xt:a}}}},%{ansi:ansi}%{!ansi:%{posix:posix}%{!posix:%{Xpg4:xpg4}%{!Xpg4:%{Xpg4plus:XPG4PLUS}%{!Xpg4plus:%{Xods30:ods30}%{!Xods30:XPG4PLUS}}}}},%{mcoff:COFF}%{!mcoff:ELF} \
861 %{Wl,*%*} %{YP,*} %{YL,*} %{YU,*} \
862 %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \
863 %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \
864 %{h*} %{static:-dn -Bstatic} %{shared:-G -dy %{!z*:-z text}} \
865 %{symbolic:-Bsymbolic -G -dy %{!z*:-z text}} %{z*} %{R*} %{Y*} \
866 %{G:-G} %{!mcoff:%{Qn:} %{!Qy:-Qn}}"
868 /* The SCO COFF linker gets confused on the difference between "-ofoo"
869 and "-o foo". So we just always force a single space. */
871 #define SWITCHES_NEED_SPACES "o"
873 /* Library spec. If we are not building a shared library, provide the
874 standard libraries, as per the SCO compiler. */
878 "%{shared:pic/libgcc.a%s}%{!shared:%{!symbolic:-lcrypt -lgen -lc}}"
881 #define LIBGCC_SPEC \
884 #define MASK_COFF 010000000000 /* Mask for elf generation */
885 #define TARGET_COFF (target_flags & MASK_COFF)
886 #define TARGET_ELF (1) /* (!(target_flags & MASK_COFF)) */
888 #undef SUBTARGET_SWITCHES
889 #define SUBTARGET_SWITCHES \
890 { "elf", -MASK_COFF, N_("Generate ELF output") },
892 #define NO_DOLLAR_IN_LABEL
894 /* Implicit library calls should use memcpy, not bcopy, etc. They are
895 faster on OpenServer libraries. */
897 #define TARGET_MEM_FUNCTIONS
899 /* Biggest alignment supported by the object file format of this
900 machine. Use this macro to limit the alignment which can be
901 specified using the `__attribute__ ((aligned (N)))' construct. If
902 not defined, the default value is `BIGGEST_ALIGNMENT'. */
904 #define MAX_OFILE_ALIGNMENT (32768*8)
906 /* Define the `__builtin_va_list' type for the ABI. On OpenServer, this
908 #undef BUILD_VA_LIST_TYPE
909 #define BUILD_VA_LIST_TYPE(VALIST) \
910 (VALIST) = build_pointer_type (char_type_node)
914 Here comes some major hackery to get the crt stuff to compile properly.
915 Since we can (and do) compile for both COFF and ELF environments, we
916 set things up accordingly, based on the pre-processor defines for ELF
917 and COFF. This is insane, but then I guess having one compiler with a
918 single back-end supporting two vastly different file format types is
919 a little insane too. But it is not impossible and we get a useful
920 compiler at the end of the day. Onward we go ...
923 #if defined(CRT_BEGIN) || defined(CRT_END) || defined(IN_LIBGCC2)
924 # undef OBJECT_FORMAT_ELF
925 # undef INIT_SECTION_ASM_OP
926 # undef FINI_SECTION_ASM_OP
927 # undef CTORS_SECTION_ASM_OP
928 # undef DTORS_SECTION_ASM_OP
929 # undef EH_FRAME_SECTION_ASM_OP
930 # undef CTOR_LIST_BEGIN
931 # undef CTOR_LIST_END
932 # undef DO_GLOBAL_CTORS_BODY
934 # if defined (_SCO_ELF)
935 # define OBJECT_FORMAT_ELF
936 # define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_ELF
937 # define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_ELF
938 # define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_ELF
939 # define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_ELF
940 # define EH_FRAME_SECTION_ASM_OP EH_FRAME_SECTION_ASM_OP_ELF
941 # else /* ! _SCO_ELF */
942 # define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_COFF
943 # define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_COFF
944 # define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_COFF
945 # define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_COFF
946 # define EH_FRAME_SECTION_ASM_OP EH_FRAME_SECTION_ASM_OP_COFF
947 # define CTOR_LIST_BEGIN asm (INIT_SECTION_ASM_OP); asm ("pushl $0")
948 # define CTOR_LIST_END CTOR_LIST_BEGIN
949 # define DO_GLOBAL_CTORS_BODY \
951 func_ptr *p, *beg = alloca(0); \
955 # endif /* ! _SCO_ELF */
956 #endif /* CRT_BEGIN !! CRT_END */