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\t"
60 #define ASM_LONG "\t.long\t"
63 #define TYPE_ASM_OP "\t.type\t"
66 #define SIZE_ASM_OP "\t.size\t"
69 #define STRING_ASM_OP "\t.string\t"
72 #define SKIP_ASM_OP "\t.zero\t"
75 #define GLOBAL_ASM_OP "\t.globl\t"
77 #undef EH_FRAME_SECTION_ASM_OP
78 #define EH_FRAME_SECTION_ASM_OP_COFF "\t.section\t.ehfram, \"x\""
79 #define EH_FRAME_SECTION_ASM_OP_ELF "\t.section\t.eh_frame, \"aw\""
80 #define EH_FRAME_SECTION_ASM_OP \
81 ((TARGET_ELF) ? EH_FRAME_SECTION_ASM_OP_ELF : EH_FRAME_SECTION_ASM_OP_COFF)
83 /* Avoid problems (long sectino names, forward assembler refs) with DWARF
84 exception unwinding when we're generating COFF */
85 #define DWARF2_UNWIND_INFO \
86 ((TARGET_ELF) ? 1 : 0 )
88 #undef CONST_SECTION_ASM_OP
89 #define CONST_SECTION_ASM_OP_COFF "\t.section\t.rodata, \"x\""
90 #define CONST_SECTION_ASM_OP_ELF "\t.section\t.rodata"
91 #define CONST_SECTION_ASM_OP \
92 ((TARGET_ELF) ? CONST_SECTION_ASM_OP_ELF : CONST_SECTION_ASM_OP_COFF)
94 #undef USE_CONST_SECTION
95 #define USE_CONST_SECTION_ELF 1
96 #define USE_CONST_SECTION_COFF 0
97 #define USE_CONST_SECTION \
98 ((TARGET_ELF) ? USE_CONST_SECTION_ELF : USE_CONST_SECTION_COFF)
100 #undef INIT_SECTION_ASM_OP
101 #define INIT_SECTION_ASM_OP_ELF "\t.section\t.init"
102 /* Rename these for COFF becuase crt1.o will try to run them. */
103 #define INIT_SECTION_ASM_OP_COFF "\t.section\t.ctor ,\"x\""
104 #define INIT_SECTION_ASM_OP \
105 ((TARGET_ELF) ? INIT_SECTION_ASM_OP_ELF : INIT_SECTION_ASM_OP_COFF)
107 #undef CTORS_SECTION_ASM_OP
108 #define CTORS_SECTION_ASM_OP_ELF "\t.section\t.ctors,\"aw\""
109 #define CTORS_SECTION_ASM_OP_COFF INIT_SECTION_ASM_OP_COFF
110 #define CTORS_SECTION_ASM_OP \
111 ((TARGET_ELF) ? CTORS_SECTION_ASM_OP_ELF : CTORS_SECTION_ASM_OP_COFF)
113 #undef DTORS_SECTION_ASM_OP
114 #define DTORS_SECTION_ASM_OP_ELF "\t.section\t.dtors, \"aw\""
115 #define DTORS_SECTION_ASM_OP_COFF FINI_SECTION_ASM_OP_COFF
116 #define DTORS_SECTION_ASM_OP \
117 ((TARGET_ELF) ? DTORS_SECTION_ASM_OP_ELF : DTORS_SECTION_ASM_OP_COFF)
119 #undef FINI_SECTION_ASM_OP
120 #define FINI_SECTION_ASM_OP_ELF "\t.section\t.fini"
121 #define FINI_SECTION_ASM_OP_COFF "\t.section\t.dtor, \"x\""
122 #define FINI_SECTION_ASM_OP \
123 ((TARGET_ELF) ? FINI_SECTION_ASM_OP_ELF : FINI_SECTION_ASM_OP_COFF)
125 #undef BSS_SECTION_ASM_OP
126 #define BSS_SECTION_ASM_OP "\t.data"
128 #undef TEXT_SECTION_ASM_OP
129 #define TEXT_SECTION_ASM_OP "\t.text"
131 #undef DATA_SECTION_ASM_OP
132 #define DATA_SECTION_ASM_OP "\t.data"
134 #undef TYPE_OPERAND_FMT
135 #define TYPE_OPERAND_FMT "@%s"
137 #undef APPLY_RESULT_SIZE
138 #define APPLY_RESULT_SIZE \
139 (TARGET_ELF) ? size : 116
141 #ifndef ASM_DECLARE_RESULT
142 #define ASM_DECLARE_RESULT(FILE, RESULT)
145 #define SCO_DEFAULT_ASM_COFF(FILE,NAME) \
147 ASM_OUTPUT_LABEL (FILE, NAME); \
150 #undef ASM_DECLARE_FUNCTION_NAME
151 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
154 fprintf (FILE, "%s", TYPE_ASM_OP); \
155 assemble_name (FILE, NAME); \
157 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
159 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
160 ASM_OUTPUT_LABEL(FILE, NAME); \
162 SCO_DEFAULT_ASM_COFF(FILE, NAME); \
165 #undef ASM_DECLARE_FUNCTION_SIZE
166 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
168 if (TARGET_ELF) { if (!flag_inhibit_size_directive) \
170 fprintf (FILE, "%s", SIZE_ASM_OP); \
171 assemble_name (FILE, (FNAME)); \
172 fprintf (FILE, ",.-"); \
173 assemble_name (FILE, (FNAME)); \
178 #undef ASM_DECLARE_OBJECT_NAME
179 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
182 fprintf (FILE, "%s", TYPE_ASM_OP); \
183 assemble_name (FILE, NAME); \
185 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
187 size_directive_output = 0; \
188 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
190 size_directive_output = 1; \
191 fprintf (FILE, "%s", SIZE_ASM_OP); \
192 assemble_name (FILE, NAME); \
193 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
195 ASM_OUTPUT_LABEL(FILE, NAME); \
197 SCO_DEFAULT_ASM_COFF(FILE, NAME); \
200 #undef ASM_FILE_START_1
201 #define ASM_FILE_START_1(FILE)
203 #undef ASM_FILE_START
204 #define ASM_FILE_START(FILE) \
206 output_file_directive((FILE),main_input_filename); \
207 fprintf ((FILE), "\t.version\t\"01.01\"\n"); \
210 #undef ASM_FINISH_DECLARE_OBJECT
211 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
214 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
215 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
216 && ! AT_END && TOP_LEVEL \
217 && DECL_INITIAL (DECL) == error_mark_node \
218 && !size_directive_output) \
220 size_directive_output = 1; \
221 fprintf (FILE, "%s", SIZE_ASM_OP); \
222 assemble_name (FILE, name); \
223 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
228 #undef ASM_GENERATE_INTERNAL_LABEL
229 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
232 sprintf (LABEL, "*.%s%d", (PREFIX), (NUM)); \
234 sprintf (LABEL, ".%s%d", (PREFIX), (NUM)); \
237 #undef ASM_OUTPUT_ADDR_DIFF_ELT
238 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
241 fprintf (FILE, "%s_GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", ASM_LONG, LPREFIX, VALUE); \
243 fprintf (FILE, "%s%s%d-%s%d\n", ASM_LONG, LPREFIX,VALUE,LPREFIX,REL); \
246 #undef ASM_OUTPUT_ALIGNED_COMMON
247 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
249 fprintf ((FILE), "%s", COMMON_ASM_OP); \
250 assemble_name ((FILE), (NAME)); \
252 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
254 fprintf ((FILE), ",%u\n", (SIZE)); \
257 #undef ASM_OUTPUT_ALIGNED_LOCAL
258 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
261 fprintf ((FILE), "%s", LOCAL_ASM_OP); \
262 assemble_name ((FILE), (NAME)); \
263 fprintf ((FILE), "\n"); \
264 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
266 int align = exact_log2 (ALIGN); \
267 if (align > 2) align = 2; \
268 if (TARGET_SVR3_SHLIB) \
272 ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \
273 fprintf ((FILE), "%s\t", "\t.lcomm"); \
274 assemble_name ((FILE), (NAME)); \
275 fprintf ((FILE), ",%u\n", (SIZE)); \
279 /* A C statement (sans semicolon) to output to the stdio stream
280 FILE the assembler definition of uninitialized global DECL named
281 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
282 Try to use asm_output_aligned_bss to implement this macro. */
284 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
285 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
289 "\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\
290 \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\
291 \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\
292 \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\
293 \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\
294 \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\
295 \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\
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"
299 #define STRING_LIMIT ((unsigned) 256)
301 #undef ASM_OUTPUT_LIMITED_STRING
302 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
305 register const unsigned char *_limited_str = \
306 (const unsigned char *) (STR); \
307 register unsigned ch; \
308 fprintf ((FILE), "%s\"", STRING_ASM_OP); \
309 for (; (ch = *_limited_str); _limited_str++) \
311 register int escape; \
312 switch (escape = ESCAPES[ch]) \
318 fprintf ((FILE), "\\%03o", ch); \
321 putc ('\\', (FILE)); \
322 putc (escape, (FILE)); \
326 fprintf ((FILE), "\"\n"); \
331 #undef ASM_OUTPUT_ASCII
332 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
334 register const unsigned char *_ascii_bytes = \
335 (const unsigned char *) (STR); \
336 register const unsigned char *limit = _ascii_bytes + (LENGTH); \
337 register unsigned bytes_in_chunk = 0; \
338 for (; _ascii_bytes < limit; _ascii_bytes++) \
340 register unsigned const char *p; \
341 if (bytes_in_chunk >= 64) \
343 fputc ('\n', (FILE)); \
344 bytes_in_chunk = 0; \
346 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
348 if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \
350 if (bytes_in_chunk > 0) \
352 fputc ('\n', (FILE)); \
353 bytes_in_chunk = 0; \
355 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
360 if (bytes_in_chunk == 0) \
361 fprintf ((FILE), "%s", ASM_BYTE_OP); \
363 fputc (',', (FILE)); \
364 fprintf ((FILE), "0x%02x", *_ascii_bytes); \
365 bytes_in_chunk += 5; \
368 if (bytes_in_chunk > 0) \
369 fprintf ((FILE), "\n"); \
372 /* Must use data section for relocatable constants when pic. */
373 #undef SELECT_RTX_SECTION
374 #define SELECT_RTX_SECTION(MODE,RTX) \
377 if (flag_pic && symbolic_operand (RTX, VOIDmode)) \
382 readonly_data_section(); \
385 #undef ASM_OUTPUT_CASE_LABEL
386 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \
389 ASM_OUTPUT_ALIGN ((FILE), 2); \
390 ASM_OUTPUT_INTERNAL_LABEL((FILE),(PREFIX),(NUM)); \
394 #undef ASM_OUTPUT_CONSTRUCTOR
395 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
399 fprintf (FILE, "%s", INT_ASM_OP); \
400 assemble_name (FILE, NAME); \
401 fprintf (FILE, "\n"); \
404 fprintf (FILE, "\tpushl $"); \
405 assemble_name (FILE, NAME); \
406 fprintf (FILE, "\n"); } \
409 #undef ASM_OUTPUT_DESTRUCTOR
410 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
414 fprintf (FILE, "%s", INT_ASM_OP); \
415 assemble_name (FILE, NAME); \
416 fprintf (FILE, "\n"); \
419 fprintf (FILE, "%s", INT_ASM_OP); \
420 assemble_name (FILE, NAME); \
421 fprintf (FILE, "\n"); } \
425 #undef ASM_OUTPUT_IDENT
426 #define ASM_OUTPUT_IDENT(FILE, NAME) \
427 fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME);
429 #undef ASM_GLOBALIZE_LABEL
430 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
431 (fprintf ((FILE), "%s", GLOBAL_ASM_OP), assemble_name (FILE, NAME), fputs ("\n", FILE))
433 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
434 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
435 if (TARGET_ELF) ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
437 #undef ASM_OUTPUT_INTERNAL_LABEL
438 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
439 fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
441 /* The prefix to add to user-visible assembler symbols. */
443 #undef USER_LABEL_PREFIX
444 #define USER_LABEL_PREFIX ""
447 * Compensate for the difference between ELF and COFF assembler syntax.
448 * Otherwise, this is cribbed from ../svr4.h.
449 * We rename 'gcc_except_table' to the shorter name in preparation
450 * for the day when we're ready to do DWARF2 eh unwinding under COFF
452 #undef ASM_OUTPUT_SECTION_NAME
453 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
455 static struct section_info \
457 struct section_info *next; \
459 enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
461 struct section_info *s; \
463 enum sect_enum type; \
464 const char *sname = NAME ; \
465 if (strcmp(NAME, ".gcc_except_table") == 0) sname = ".gccexc" ; \
467 for (s = sections; s; s = s->next) \
468 if (!strcmp (NAME, s->name)) \
471 if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
472 type = SECT_EXEC, mode = (TARGET_ELF) ? "ax" : "x" ; \
473 else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
474 type = SECT_RO, mode = "a"; \
476 type = SECT_RW, mode = (TARGET_ELF) ? "aw" : "w" ; \
480 s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
481 s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
482 strcpy (s->name, NAME); \
484 s->next = sections; \
486 fprintf (FILE, ".section\t%s,\"%s\"%s\n", sname, mode, \
487 (TARGET_ELF) ? ",@progbits" : "" ); \
491 if (DECL && s->type != type) \
492 error_with_decl (DECL, "%s causes a section type conflict"); \
494 fprintf (FILE, ".section\t%s\n", sname); \
498 #undef ASM_OUTPUT_SKIP
499 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
502 fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (SIZE)); \
504 fprintf ((FILE), "%s.,.+%u\n", SET_ASM_OP, (SIZE)); \
508 #undef CTOR_LIST_BEGIN
509 #define CTOR_LIST_BEGIN \
511 asm (CTORS_SECTION_ASM_OP); \
513 STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }; \
519 #define CTOR_LIST_END \
522 asm (CTORS_SECTION_ASM_OP); \
523 STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (0) }; \
529 #undef DBX_BLOCKS_FUNCTION_RELATIVE
530 #define DBX_BLOCKS_FUNCTION_RELATIVE 1
532 #undef DBX_FUNCTION_FIRST
533 #define DBX_FUNCTION_FIRST 1
535 #undef DBX_REGISTER_NUMBER
536 #define DBX_REGISTER_NUMBER(n) \
537 ((TARGET_ELF) ? svr4_dbx_register_map[n] : dbx_register_map[n])
539 #undef DWARF_DEBUGGING_INFO
540 #undef SDB_DEBUGGING_INFO
541 #undef DBX_DEBUGGING_INFO
542 #undef PREFERRED_DEBUGGING_TYPE
544 #define DWARF_DEBUGGING_INFO 1
545 #define SDB_DEBUGGING_INFO 1
546 #define DBX_DEBUGGING_INFO 1
547 #define PREFERRED_DEBUGGING_TYPE \
548 ((TARGET_ELF) ? DWARF2_DEBUG: SDB_DEBUG)
550 #undef EXTRA_SECTIONS
551 #define EXTRA_SECTIONS in_const, in_init, in_fini, in_ctors, in_dtors
553 #undef EXTRA_SECTION_FUNCTIONS
554 #define EXTRA_SECTION_FUNCTIONS \
555 CONST_SECTION_FUNCTION \
556 INIT_SECTION_FUNCTION \
557 FINI_SECTION_FUNCTION \
558 CTORS_SECTION_FUNCTION \
559 DTORS_SECTION_FUNCTION
561 #undef CONST_SECTION_FUNCTION
562 #define CONST_SECTION_FUNCTION \
566 if (!USE_CONST_SECTION) \
568 else if (in_section != in_const) \
570 fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
571 in_section = in_const; \
575 #undef FINI_SECTION_FUNCTION
576 #define FINI_SECTION_FUNCTION \
580 if ((!TARGET_ELF) && in_section != in_fini) \
582 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
583 in_section = in_fini; \
587 #undef INIT_SECTION_FUNCTION
588 #define INIT_SECTION_FUNCTION \
592 if ((!TARGET_ELF) && in_section != in_init) \
594 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
595 in_section = in_init; \
599 #undef CTORS_SECTION_FUNCTION
600 #define CTORS_SECTION_FUNCTION \
604 if (in_section != in_ctors) \
606 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
607 in_section = in_ctors; \
611 #undef DTORS_SECTION_FUNCTION
612 #define DTORS_SECTION_FUNCTION \
616 if (in_section != in_dtors) \
618 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
619 in_section = in_dtors; \
623 #undef SUBTARGET_FRAME_POINTER_REQUIRED
624 #define SUBTARGET_FRAME_POINTER_REQUIRED \
625 ((TARGET_ELF) ? 0 : \
626 (current_function_calls_setjmp || current_function_calls_longjmp))
628 #undef JUMP_TABLES_IN_TEXT_SECTION
629 #define JUMP_TABLES_IN_TEXT_SECTION (TARGET_ELF && flag_pic)
631 #undef LOCAL_LABEL_PREFIX
632 #define LOCAL_LABEL_PREFIX \
633 ((TARGET_ELF) ? "" : ".")
635 #undef MD_EXEC_PREFIX
636 #undef MD_STARTFILE_PREFIX
637 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
638 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
640 #undef NON_SAVING_SETJMP
641 #define NON_SAVING_SETJMP \
642 ((TARGET_ELF) ? 0 : \
643 (current_function_calls_setjmp && current_function_calls_longjmp))
645 #undef NO_IMPLICIT_EXTERN_C
646 #define NO_IMPLICIT_EXTERN_C 1
648 /* JKJ FIXME - examine the ramifications of RETURN_IN_MEMORY and
651 #undef RETURN_POPS_ARGS
652 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
654 (ix86_return_pops_args (FUNDECL, FUNTYPE, SIZE)) : \
655 (((FUNDECL) && (TREE_CODE (FUNDECL) == IDENTIFIER_NODE)) ? 0 \
657 && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
658 || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
659 == void_type_node))) ? (SIZE) \
662 #undef SELECT_SECTION
663 #define SELECT_SECTION(DECL,RELOC) \
665 if (TARGET_ELF && flag_pic && RELOC) \
667 else if (TREE_CODE (DECL) == STRING_CST) \
669 if (! flag_writable_strings) \
674 else if (TREE_CODE (DECL) == VAR_DECL) \
676 if (! DECL_READONLY_SECTION (DECL, RELOC)) \
685 #undef SWITCH_TAKES_ARG
686 #define SWITCH_TAKES_ARG(CHAR) \
687 (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
693 #undef WORD_SWITCH_TAKES_ARG
694 #define WORD_SWITCH_TAKES_ARG(STR) \
695 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
696 && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \
697 && strcmp (STR, "Tbss"))
699 #undef TARGET_SUBTARGET_DEFAULT
700 #define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
702 #undef HANDLE_SYSV_PRAGMA
703 #define HANDLE_SYSV_PRAGMA 1
705 /* Though OpenServer supports .weak in COFF, we don't use it.
706 * G++ will frequently emit a symol as .weak and then (in the same .s
707 * file) declare it global. The COFF assembler finds this unamusing.
709 #define SUPPORTS_WEAK (TARGET_ELF)
710 #define ASM_WEAKEN_LABEL(FILE,NAME) \
711 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
712 fputc ('\n', FILE); } while (0)
714 #undef SCCS_DIRECTIVE
715 #define SCCS_DIRECTIVE 1
718 * Define sizes and types
723 #undef WCHAR_TYPE_SIZE
724 #undef LONG_DOUBLE_TYPE_SIZE
725 #define LONG_DOUBLE_TYPE_SIZE 96
726 #define SIZE_TYPE "unsigned int"
727 #define PTRDIFF_TYPE "int"
728 #define WCHAR_TYPE "long int"
729 #define WCHAR_TYPE_SIZE BITS_PER_WORD
732 * New for multilib support. Set the default switches for multilib,
735 #define MULTILIB_DEFAULTS { "melf" }
738 /* Please note that these specs may look messy but they are required in
739 order to emulate the SCO Development system as closely as possible.
740 With SCO Open Server 5.0, you now get the linker and assembler free,
741 so that is what these specs are targeted for. These utilities are
742 very argument sensitive: a space in the wrong place breaks everything.
743 So RMS, please forgive this mess. It works.
745 Parameters which can be passed to gcc, and their SCO equivalents:
746 GCC Parameter SCO Equivalent
750 -Xpg4plus -a xpg4plus
753 As with SCO, the default is XPG4 plus mode. SCO also allows you to
754 specify a C dialect with -Xt, -Xa, -Xc, -Xk and -Xm. These are passed
755 on to the assembler and linker in the same way that the SCO compiler
758 SCO also allows you to compile, link and generate either ELF or COFF
759 binaries. With gcc, unlike the SCO compiler, the default is ELF.
760 Specify -mcoff to gcc to produce COFF binaries. -fpic will get the
761 assembler and linker to produce PIC code.
764 /* Set up assembler flags for PIC and ELF compilations */
768 /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c
769 * Undef MD_EXEC_PREFIX becuase we don't know where GAS is, but it's not
770 * likely in /usr/ccs/bin/
772 #undef MD_EXEC_PREFIX
776 "-b %{!mcoff:elf}%{mcoff:coff \
777 %{static:%e-static not valid with -mcoff} \
778 %{shared:%e-shared not valid with -mcoff} \
779 %{symbolic:%e-symbolic not valid with -mcoff}} \
780 %{Ym,*} %{Yd,*} %{Wa,*:%*} \
781 %{!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}}"
784 /* Use crt1.o as a startup file and crtn.o as a closing file. */
786 #undef STARTFILE_SPEC
787 #define STARTFILE_SPEC \
788 "%{shared: %{!mcoff: crti.o%s}} \
791 %{pg:gcrt.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}} \
792 %{ansi:values-Xc.o%s} \
794 %{traditional:values-Xt.o%s} \
796 %{Xa:values-Xa.o%s} \
797 %{!Xa:%{Xc:values-Xc.o%s} \
798 %{!Xc:%{Xk:values-Xk.o%s} \
799 %{!Xk:%{Xt:values-Xt.o%s} \
800 %{!Xt:values-Xa.o%s}}}}}} \
801 %{mcoff:crtbeginS.o%s} %{!mcoff:crtbegin.o%s}"
804 #define ENDFILE_SPEC \
805 "%{!mcoff:crtend.o%s} \
806 %{mcoff:crtendS.o%s} \
807 %{pg:gcrtn.o%s}%{!pg:crtn.o%s}"
809 #undef CPP_PREDEFINES
810 #define CPP_PREDEFINES \
813 /* You are in a maze of GCC specs ... all alike */
816 #define CPP_SPEC "%(cpp_cpu) \
817 %{fpic:%{mcoff:%e-fpic is not valid with -mcoff}} \
818 %{fPIC:%{mcoff:%e-fPIC is not valid with -mcoff}} \
819 -D__i386 -D__unix -D_SCO_DS=1 -D_M_I386 -D_M_XENIX -D_M_UNIX \
820 %{!Xods30:-D_STRICT_NAMES} \
821 %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \
822 %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi -D_STRICT_ANSI} \
824 %{posix:-isystem include/posix%s -isystem /usr/include/posix \
825 -D_POSIX_C_SOURCE=2 -D_POSIX_SOURCE=1} \
826 %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \
828 %{!Xpg4:-D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT \
829 -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII \
830 -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX \
831 %{Xods30:-isystem include/ods_30_compat%s \
832 -isystem /usr/include/ods_30_compat \
833 -D_SCO_ODS_30 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \
834 -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \
836 %{scointl:-DM_INTERNAT -D_M_INTERNAT} \
837 %{traditional:-D_KR -D_SVID -D_NO_PROTOTYPE} \
838 %{!mcoff:-D_SCO_ELF} \
839 %{mcoff:-D_M_COFF -D_SCO_COFF} \
840 %{!mcoff:%{fpic:-D__PIC__ -D__pic__} \
841 %{fPIC:%{!fpic:-D__PIC__ -D__pic__}}} \
842 %{Xa:-D_SCO_C_DIALECT=1} \
843 %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \
844 %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \
845 %{!Xk:%{Xt:-D_SCO_C_DIALECT=2} \
846 %{!Xt:-D_SCO_C_DIALECT=1}}}} \
847 %{traditional:-traditional -D_KR -D_NO_PROTOTYPE}"
851 "-b %{!mcoff:elf}%{mcoff:coff \
852 %{static:%e-static not valid with -mcoff} \
853 %{shared:%e-shared not valid with -mcoff} \
854 %{symbolic:%e-symbolic not valid with -mcoff} \
855 %{fpic:%e-fpic not valid with -mcoff} \
856 %{fPIC:%e-fPIC not valid with -mcoff}} \
857 -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} \
858 %{Wl,*%*} %{YP,*} %{YL,*} %{YU,*} \
859 %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \
860 %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \
861 %{h*} %{static:-dn -Bstatic} %{shared:-G -dy %{!z*:-z text}} \
862 %{symbolic:-Bsymbolic -G -dy %{!z*:-z text}} %{z*} %{R*} %{Y*} \
863 %{G:-G} %{!mcoff:%{Qn:} %{!Qy:-Qn}}"
865 /* The SCO COFF linker gets confused on the difference between "-ofoo"
866 and "-o foo". So we just always force a single space. */
868 #define SWITCHES_NEED_SPACES "o"
870 /* Library spec. If we are not building a shared library, provide the
871 standard libraries, as per the SCO compiler. */
875 "%{shared:pic/libgcc.a%s}%{!shared:%{!symbolic:-lcrypt -lgen -lc}}"
878 #define LIBGCC_SPEC \
881 #define MASK_COFF 010000000000 /* Mask for elf generation */
882 #define TARGET_COFF (target_flags & MASK_COFF)
883 #define TARGET_ELF (1) /* (!(target_flags & MASK_COFF)) */
885 #undef SUBTARGET_SWITCHES
886 #define SUBTARGET_SWITCHES \
887 { "elf", -MASK_COFF, N_("Generate ELF output") },
889 #define NO_DOLLAR_IN_LABEL
891 /* Implicit library calls should use memcpy, not bcopy, etc. They are
892 faster on OpenServer libraries. */
894 #define TARGET_MEM_FUNCTIONS
896 /* Biggest alignment supported by the object file format of this
897 machine. Use this macro to limit the alignment which can be
898 specified using the `__attribute__ ((aligned (N)))' construct. If
899 not defined, the default value is `BIGGEST_ALIGNMENT'. */
901 #define MAX_OFILE_ALIGNMENT (32768*8)
903 /* Define the `__builtin_va_list' type for the ABI. On OpenServer, this
905 #undef BUILD_VA_LIST_TYPE
906 #define BUILD_VA_LIST_TYPE(VALIST) \
907 (VALIST) = build_pointer_type (char_type_node)
911 Here comes some major hackery to get the crt stuff to compile properly.
912 Since we can (and do) compile for both COFF and ELF environments, we
913 set things up accordingly, based on the pre-processor defines for ELF
914 and COFF. This is insane, but then I guess having one compiler with a
915 single back-end supporting two vastly different file format types is
916 a little insane too. But it is not impossible and we get a useful
917 compiler at the end of the day. Onward we go ...
920 #if defined(CRT_BEGIN) || defined(CRT_END) || defined(IN_LIBGCC2)
921 # undef OBJECT_FORMAT_ELF
922 # undef INIT_SECTION_ASM_OP
923 # undef FINI_SECTION_ASM_OP
924 # undef CTORS_SECTION_ASM_OP
925 # undef DTORS_SECTION_ASM_OP
926 # undef EH_FRAME_SECTION_ASM_OP
927 # undef CTOR_LIST_BEGIN
928 # undef CTOR_LIST_END
929 # undef DO_GLOBAL_CTORS_BODY
931 # if defined (_SCO_ELF)
932 # define OBJECT_FORMAT_ELF
933 # define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_ELF
934 # define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_ELF
935 # define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_ELF
936 # define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_ELF
937 # define EH_FRAME_SECTION_ASM_OP EH_FRAME_SECTION_ASM_OP_ELF
938 # else /* ! _SCO_ELF */
939 # define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_COFF
940 # define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_COFF
941 # define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_COFF
942 # define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_COFF
943 # define EH_FRAME_SECTION_ASM_OP EH_FRAME_SECTION_ASM_OP_COFF
944 # define CTOR_LIST_BEGIN asm (INIT_SECTION_ASM_OP); asm ("pushl $0")
945 # define CTOR_LIST_END CTOR_LIST_BEGIN
946 # define DO_GLOBAL_CTORS_BODY \
948 func_ptr *p, *beg = alloca(0); \
952 # endif /* ! _SCO_ELF */
953 #endif /* CRT_BEGIN !! CRT_END */