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)
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 #define TARGET_VERSION fprintf (stderr, " (i386, SCO OpenServer 5 Syntax)");
29 #define ALIGN_ASM_OP "\t.align\t"
31 #undef ASCII_DATA_ASM_OP
32 #define ASCII_DATA_ASM_OP "\t.ascii\t"
35 #define IDENT_ASM_OP "\t.ident\t"
38 #define COMMON_ASM_OP "\t.comm\t"
41 #define SET_ASM_OP "\t.set\t"
44 #define LOCAL_ASM_OP "\t.local\t"
47 #define ASM_SHORT "\t.value\t"
50 #define ASM_LONG "\t.long\t"
55 #define TYPE_ASM_OP "\t.type\t"
58 #define SIZE_ASM_OP "\t.size\t"
61 #define STRING_ASM_OP "\t.string\t"
64 #define SKIP_ASM_OP "\t.zero\t"
67 #define GLOBAL_ASM_OP "\t.globl\t"
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)
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 )
80 #undef CONST_SECTION_ASM_OP
81 #define CONST_SECTION_ASM_OP_COFF "\t.section\t.rodata, \"x\""
82 #define CONST_SECTION_ASM_OP_ELF "\t.section\t.rodata"
83 #define CONST_SECTION_ASM_OP \
84 ((TARGET_ELF) ? CONST_SECTION_ASM_OP_ELF : CONST_SECTION_ASM_OP_COFF)
86 #undef USE_CONST_SECTION
87 #define USE_CONST_SECTION_ELF 1
88 #define USE_CONST_SECTION_COFF 0
89 #define USE_CONST_SECTION \
90 ((TARGET_ELF) ? USE_CONST_SECTION_ELF : USE_CONST_SECTION_COFF)
92 #undef INIT_SECTION_ASM_OP
93 #define INIT_SECTION_ASM_OP_ELF "\t.section\t.init"
94 /* Rename these for COFF because crt1.o will try to run them. */
95 #define INIT_SECTION_ASM_OP_COFF "\t.section\t.ctor ,\"x\""
96 #define INIT_SECTION_ASM_OP \
97 ((TARGET_ELF) ? INIT_SECTION_ASM_OP_ELF : INIT_SECTION_ASM_OP_COFF)
99 #undef CTORS_SECTION_ASM_OP
100 #define CTORS_SECTION_ASM_OP_ELF "\t.section\t.ctors,\"aw\""
101 #define CTORS_SECTION_ASM_OP_COFF INIT_SECTION_ASM_OP_COFF
102 #define CTORS_SECTION_ASM_OP \
103 ((TARGET_ELF) ? CTORS_SECTION_ASM_OP_ELF : CTORS_SECTION_ASM_OP_COFF)
105 #undef DTORS_SECTION_ASM_OP
106 #define DTORS_SECTION_ASM_OP_ELF "\t.section\t.dtors, \"aw\""
107 #define DTORS_SECTION_ASM_OP_COFF FINI_SECTION_ASM_OP_COFF
108 #define DTORS_SECTION_ASM_OP \
109 ((TARGET_ELF) ? DTORS_SECTION_ASM_OP_ELF : DTORS_SECTION_ASM_OP_COFF)
111 #undef FINI_SECTION_ASM_OP
112 #define FINI_SECTION_ASM_OP_ELF "\t.section\t.fini"
113 #define FINI_SECTION_ASM_OP_COFF "\t.section\t.dtor, \"x\""
114 #define FINI_SECTION_ASM_OP \
115 ((TARGET_ELF) ? FINI_SECTION_ASM_OP_ELF : FINI_SECTION_ASM_OP_COFF)
117 #undef BSS_SECTION_ASM_OP
118 #define BSS_SECTION_ASM_OP "\t.data"
120 #undef TEXT_SECTION_ASM_OP
121 #define TEXT_SECTION_ASM_OP "\t.text"
123 #undef DATA_SECTION_ASM_OP
124 #define DATA_SECTION_ASM_OP "\t.data"
126 #undef TYPE_OPERAND_FMT
127 #define TYPE_OPERAND_FMT "@%s"
129 #undef APPLY_RESULT_SIZE
130 #define APPLY_RESULT_SIZE \
131 (TARGET_ELF) ? size : 116
133 #ifndef ASM_DECLARE_RESULT
134 #define ASM_DECLARE_RESULT(FILE, RESULT)
137 #define SCO_DEFAULT_ASM_COFF(FILE,NAME) \
139 ASM_OUTPUT_LABEL (FILE, NAME); \
142 #undef ASM_DECLARE_FUNCTION_NAME
143 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
146 fprintf (FILE, "%s", TYPE_ASM_OP); \
147 assemble_name (FILE, NAME); \
149 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
151 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
152 ASM_OUTPUT_LABEL(FILE, NAME); \
154 SCO_DEFAULT_ASM_COFF(FILE, NAME); \
157 #undef ASM_DECLARE_FUNCTION_SIZE
158 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
160 if (TARGET_ELF) { if (!flag_inhibit_size_directive) \
162 fprintf (FILE, "%s", SIZE_ASM_OP); \
163 assemble_name (FILE, (FNAME)); \
164 fprintf (FILE, ",.-"); \
165 assemble_name (FILE, (FNAME)); \
170 #undef ASM_DECLARE_OBJECT_NAME
171 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
174 fprintf (FILE, "%s", TYPE_ASM_OP); \
175 assemble_name (FILE, NAME); \
177 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
179 size_directive_output = 0; \
180 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
182 size_directive_output = 1; \
183 fprintf (FILE, "%s", SIZE_ASM_OP); \
184 assemble_name (FILE, NAME); \
185 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
187 ASM_OUTPUT_LABEL(FILE, NAME); \
189 SCO_DEFAULT_ASM_COFF(FILE, NAME); \
192 #undef ASM_FILE_START_1
193 #define ASM_FILE_START_1(FILE)
195 #undef ASM_FILE_START
196 #define ASM_FILE_START(FILE) \
198 output_file_directive((FILE),main_input_filename); \
199 fprintf ((FILE), "\t.version\t\"01.01\"\n"); \
202 #undef ASM_FINISH_DECLARE_OBJECT
203 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
206 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
207 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
208 && ! AT_END && TOP_LEVEL \
209 && DECL_INITIAL (DECL) == error_mark_node \
210 && !size_directive_output) \
212 size_directive_output = 1; \
213 fprintf (FILE, "%s", SIZE_ASM_OP); \
214 assemble_name (FILE, name); \
215 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
220 #undef ASM_GENERATE_INTERNAL_LABEL
221 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
224 sprintf (LABEL, "*.%s%ld", (PREFIX), (long)(NUM)); \
226 sprintf (LABEL, ".%s%ld", (PREFIX), (long)(NUM)); \
229 #undef ASM_OUTPUT_ALIGNED_COMMON
230 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
232 fprintf ((FILE), "%s", COMMON_ASM_OP); \
233 assemble_name ((FILE), (NAME)); \
235 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
237 fprintf ((FILE), ",%u\n", (SIZE)); \
240 #undef ASM_OUTPUT_ALIGNED_LOCAL
241 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
244 fprintf ((FILE), "%s", LOCAL_ASM_OP); \
245 assemble_name ((FILE), (NAME)); \
246 fprintf ((FILE), "\n"); \
247 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
249 int align = exact_log2 (ALIGN); \
250 if (align > 2) align = 2; \
251 if (TARGET_SVR3_SHLIB) \
255 ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \
256 fprintf ((FILE), "%s\t", "\t.lcomm"); \
257 assemble_name ((FILE), (NAME)); \
258 fprintf ((FILE), ",%u\n", (SIZE)); \
262 /* A C statement (sans semicolon) to output to the stdio stream
263 FILE the assembler definition of uninitialized global DECL named
264 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
265 Try to use asm_output_aligned_bss to implement this macro. */
267 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
268 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
272 "\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\
273 \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\
274 \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\
275 \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\
276 \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\
277 \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\
278 \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\
279 \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"
282 #define STRING_LIMIT ((unsigned) 256)
284 #undef ASM_OUTPUT_LIMITED_STRING
285 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
288 register const unsigned char *_limited_str = \
289 (const unsigned char *) (STR); \
290 register unsigned ch; \
291 fprintf ((FILE), "%s\"", STRING_ASM_OP); \
292 for (; (ch = *_limited_str); _limited_str++) \
294 register int escape; \
295 switch (escape = ESCAPES[ch]) \
301 fprintf ((FILE), "\\%03o", ch); \
304 putc ('\\', (FILE)); \
305 putc (escape, (FILE)); \
309 fprintf ((FILE), "\"\n"); \
314 #undef ASM_OUTPUT_ASCII
315 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
317 register const unsigned char *_ascii_bytes = \
318 (const unsigned char *) (STR); \
319 register const unsigned char *limit = _ascii_bytes + (LENGTH); \
320 register unsigned bytes_in_chunk = 0; \
321 for (; _ascii_bytes < limit; _ascii_bytes++) \
323 register unsigned const char *p; \
324 if (bytes_in_chunk >= 64) \
326 fputc ('\n', (FILE)); \
327 bytes_in_chunk = 0; \
329 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
331 if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT) \
333 if (bytes_in_chunk > 0) \
335 fputc ('\n', (FILE)); \
336 bytes_in_chunk = 0; \
338 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
343 if (bytes_in_chunk == 0) \
344 fputs ("\t.byte\t", (FILE)); \
346 fputc (',', (FILE)); \
347 fprintf ((FILE), "0x%02x", *_ascii_bytes); \
348 bytes_in_chunk += 5; \
351 if (bytes_in_chunk > 0) \
352 fprintf ((FILE), "\n"); \
355 /* Must use data section for relocatable constants when pic. */
356 #undef SELECT_RTX_SECTION
357 #define SELECT_RTX_SECTION(MODE,RTX,ALIGN) \
360 if (flag_pic && symbolic_operand (RTX, VOIDmode)) \
365 readonly_data_section(); \
368 #undef ASM_OUTPUT_CASE_LABEL
369 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \
372 ASM_OUTPUT_ALIGN ((FILE), 2); \
373 ASM_OUTPUT_INTERNAL_LABEL((FILE),(PREFIX),(NUM)); \
376 #undef ASM_OUTPUT_IDENT
377 #define ASM_OUTPUT_IDENT(FILE, NAME) \
378 fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME);
380 #undef ASM_GLOBALIZE_LABEL
381 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
382 (fprintf ((FILE), "%s", GLOBAL_ASM_OP), assemble_name (FILE, NAME), fputs ("\n", FILE))
384 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
385 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
386 if (TARGET_ELF) ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
388 #undef ASM_OUTPUT_INTERNAL_LABEL
389 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
390 fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
392 /* The prefix to add to user-visible assembler symbols. */
394 #undef USER_LABEL_PREFIX
395 #define USER_LABEL_PREFIX ""
398 * We rename 'gcc_except_table' to the shorter name in preparation
399 * for the day when we're ready to do DWARF2 eh unwinding under COFF.
401 /* #define EXCEPTION_SECTION() named_section (NULL, ".gccexc", 1) */
403 /* Switch into a generic section. */
404 #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
406 #undef ASM_OUTPUT_SKIP
407 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
410 fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (SIZE)); \
412 fprintf ((FILE), "%s.,.+%u\n", SET_ASM_OP, (SIZE)); \
416 #undef CTOR_LIST_BEGIN
417 #define CTOR_LIST_BEGIN \
419 asm (CTORS_SECTION_ASM_OP); \
421 STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }; \
427 #define CTOR_LIST_END \
430 asm (CTORS_SECTION_ASM_OP); \
431 STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (0) }; \
437 #undef DBX_BLOCKS_FUNCTION_RELATIVE
438 #define DBX_BLOCKS_FUNCTION_RELATIVE 1
440 #undef DBX_FUNCTION_FIRST
441 #define DBX_FUNCTION_FIRST 1
443 #undef DBX_REGISTER_NUMBER
444 #define DBX_REGISTER_NUMBER(n) \
445 ((TARGET_ELF) ? svr4_dbx_register_map[n] : dbx_register_map[n])
447 #undef DWARF2_DEBUGGING_INFO
448 #undef DWARF_DEBUGGING_INFO
449 #undef SDB_DEBUGGING_INFO
450 #undef DBX_DEBUGGING_INFO
451 #undef PREFERRED_DEBUGGING_TYPE
453 #define DWARF2_DEBUGGING_INFO 1
454 #define DWARF_DEBUGGING_INFO 1
455 #define SDB_DEBUGGING_INFO 1
456 #define DBX_DEBUGGING_INFO 1
457 #define PREFERRED_DEBUGGING_TYPE \
458 ((TARGET_ELF) ? DWARF2_DEBUG: SDB_DEBUG)
460 #undef EXTRA_SECTIONS
461 #define EXTRA_SECTIONS in_const, in_init, in_fini
463 #undef EXTRA_SECTION_FUNCTIONS
464 #define EXTRA_SECTION_FUNCTIONS \
465 CONST_SECTION_FUNCTION \
466 INIT_SECTION_FUNCTION \
467 FINI_SECTION_FUNCTION
469 #undef CONST_SECTION_FUNCTION
470 #define CONST_SECTION_FUNCTION \
474 if (!USE_CONST_SECTION) \
476 else if (in_section != in_const) \
478 fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
479 in_section = in_const; \
483 #undef FINI_SECTION_FUNCTION
484 #define FINI_SECTION_FUNCTION \
488 if ((!TARGET_ELF) && in_section != in_fini) \
490 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
491 in_section = in_fini; \
495 #undef INIT_SECTION_FUNCTION
496 #define INIT_SECTION_FUNCTION \
500 if ((!TARGET_ELF) && in_section != in_init) \
502 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
503 in_section = in_init; \
507 #undef SUBTARGET_FRAME_POINTER_REQUIRED
508 #define SUBTARGET_FRAME_POINTER_REQUIRED \
509 ((TARGET_ELF) ? 0 : \
510 (current_function_calls_setjmp || current_function_calls_longjmp))
512 #undef LOCAL_LABEL_PREFIX
513 #define LOCAL_LABEL_PREFIX \
514 ((TARGET_ELF) ? "" : ".")
516 #undef MD_EXEC_PREFIX
517 #undef MD_STARTFILE_PREFIX
518 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
519 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
521 #undef NON_SAVING_SETJMP
522 #define NON_SAVING_SETJMP \
523 ((TARGET_ELF) ? 0 : \
524 (current_function_calls_setjmp && current_function_calls_longjmp))
526 #undef NO_IMPLICIT_EXTERN_C
527 #define NO_IMPLICIT_EXTERN_C 1
529 /* JKJ FIXME - examine the ramifications of RETURN_IN_MEMORY and
532 #undef RETURN_POPS_ARGS
533 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
535 (ix86_return_pops_args (FUNDECL, FUNTYPE, SIZE)) : \
536 (((FUNDECL) && (TREE_CODE (FUNDECL) == IDENTIFIER_NODE)) ? 0 \
538 && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
539 || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
540 == void_type_node))) ? (SIZE) \
543 #undef SELECT_SECTION
544 #define SELECT_SECTION(DECL,RELOC,ALIGN) \
546 if (TARGET_ELF && flag_pic && RELOC) \
548 else if (TREE_CODE (DECL) == STRING_CST) \
550 if (! flag_writable_strings) \
555 else if (TREE_CODE (DECL) == VAR_DECL) \
557 if (! DECL_READONLY_SECTION (DECL, RELOC)) \
566 #undef SWITCH_TAKES_ARG
567 #define SWITCH_TAKES_ARG(CHAR) \
568 (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
574 #undef WORD_SWITCH_TAKES_ARG
575 #define WORD_SWITCH_TAKES_ARG(STR) \
576 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
577 && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \
578 && strcmp (STR, "Tbss"))
580 #undef TARGET_SUBTARGET_DEFAULT
581 #define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
583 #undef HANDLE_SYSV_PRAGMA
584 #define HANDLE_SYSV_PRAGMA 1
586 /* Though OpenServer supports .weak in COFF, we don't use it.
587 * G++ will frequently emit a symol as .weak and then (in the same .s
588 * file) declare it global. The COFF assembler finds this unamusing.
590 #define SUPPORTS_WEAK (TARGET_ELF)
591 #define ASM_WEAKEN_LABEL(FILE,NAME) \
592 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
593 fputc ('\n', FILE); } while (0)
595 #undef SCCS_DIRECTIVE
596 #define SCCS_DIRECTIVE 1
599 * Define sizes and types
604 #undef WCHAR_TYPE_SIZE
605 #undef LONG_DOUBLE_TYPE_SIZE
606 #define LONG_DOUBLE_TYPE_SIZE 96
607 #define SIZE_TYPE "unsigned int"
608 #define PTRDIFF_TYPE "int"
609 #define WCHAR_TYPE "long int"
610 #define WCHAR_TYPE_SIZE BITS_PER_WORD
613 * New for multilib support. Set the default switches for multilib,
616 #define MULTILIB_DEFAULTS { "melf" }
619 /* Please note that these specs may look messy but they are required in
620 order to emulate the SCO Development system as closely as possible.
621 With SCO Open Server 5.0, you now get the linker and assembler free,
622 so that is what these specs are targeted for. These utilities are
623 very argument sensitive: a space in the wrong place breaks everything.
624 So RMS, please forgive this mess. It works.
626 Parameters which can be passed to gcc, and their SCO equivalents:
627 GCC Parameter SCO Equivalent
631 -Xpg4plus -a xpg4plus
634 As with SCO, the default is XPG4 plus mode. SCO also allows you to
635 specify a C dialect with -Xt, -Xa, -Xc, -Xk and -Xm. These are passed
636 on to the assembler and linker in the same way that the SCO compiler
639 SCO also allows you to compile, link and generate either ELF or COFF
640 binaries. With gcc, unlike the SCO compiler, the default is ELF.
641 Specify -mcoff to gcc to produce COFF binaries. -fpic will get the
642 assembler and linker to produce PIC code.
645 /* Set up assembler flags for PIC and ELF compilations */
649 /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c
650 * Undef MD_EXEC_PREFIX because we don't know where GAS is, but it's not
651 * likely in /usr/ccs/bin/
653 #undef MD_EXEC_PREFIX
657 "-b %{!mcoff:elf}%{mcoff:coff \
658 %{static:%e-static not valid with -mcoff} \
659 %{shared:%e-shared not valid with -mcoff} \
660 %{symbolic:%e-symbolic not valid with -mcoff}} \
661 %{Ym,*} %{Yd,*} %{Wa,*:%*} \
662 %{!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}}"
665 /* Use crt1.o as a startup file and crtn.o as a closing file. */
667 #undef STARTFILE_SPEC
668 #define STARTFILE_SPEC \
669 "%{shared: %{!mcoff: crti.o%s}} \
672 %{pg:gcrt.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}} \
673 %{ansi:values-Xc.o%s} \
675 %{Xa:values-Xa.o%s} \
676 %{!Xa:%{Xc:values-Xc.o%s} \
677 %{!Xc:%{Xk:values-Xk.o%s} \
678 %{!Xk:%{Xt:values-Xt.o%s} \
679 %{!Xt:values-Xa.o%s}}}}} \
680 %{mcoff:crtbeginS.o%s} %{!mcoff:crtbegin.o%s}"
683 #define ENDFILE_SPEC \
684 "%{!mcoff:crtend.o%s} \
685 %{mcoff:crtendS.o%s} \
686 %{pg:gcrtn.o%s}%{!pg:crtn.o%s}"
688 #undef CPP_PREDEFINES
689 #define CPP_PREDEFINES \
692 /* You are in a maze of GCC specs ... all alike */
695 #define CPP_SPEC "%(cpp_cpu) \
696 %{fpic:%{mcoff:%e-fpic is not valid with -mcoff}} \
697 %{fPIC:%{mcoff:%e-fPIC is not valid with -mcoff}} \
698 -D__i386 -D__unix -D_SCO_DS=1 -D_M_I386 -D_M_XENIX -D_M_UNIX \
699 %{!Xods30:-D_STRICT_NAMES} \
700 %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \
701 %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi -D_STRICT_ANSI} \
703 %{posix:-isystem include/posix%s -isystem /usr/include/posix \
704 -D_POSIX_C_SOURCE=2 -D_POSIX_SOURCE=1} \
705 %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \
707 %{!Xpg4:-D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT \
708 -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII \
709 -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX \
710 %{Xods30:-isystem include/ods_30_compat%s \
711 -isystem /usr/include/ods_30_compat \
712 -D_SCO_ODS_30 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \
713 -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \
715 %{scointl:-DM_INTERNAT -D_M_INTERNAT} \
716 %{!mcoff:-D_SCO_ELF} \
717 %{mcoff:-D_M_COFF -D_SCO_COFF} \
718 %{!mcoff:%{fpic:-D__PIC__ -D__pic__} \
719 %{fPIC:%{!fpic:-D__PIC__ -D__pic__}}} \
720 %{Xa:-D_SCO_C_DIALECT=1} \
721 %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \
722 %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \
723 %{!Xk:%{Xt:-D_SCO_C_DIALECT=2} \
724 %{!Xt:-D_SCO_C_DIALECT=1}}}}"
728 "-b %{!mcoff:elf}%{mcoff:coff \
729 %{static:%e-static not valid with -mcoff} \
730 %{shared:%e-shared not valid with -mcoff} \
731 %{symbolic:%e-symbolic not valid with -mcoff} \
732 %{fpic:%e-fpic not valid with -mcoff} \
733 %{fPIC:%e-fPIC not valid with -mcoff}} \
734 -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} \
735 %{Wl,*%*} %{YP,*} %{YL,*} %{YU,*} \
736 %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \
737 %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \
738 %{h*} %{static:-dn -Bstatic} %{shared:-G -dy %{!z*:-z text}} \
739 %{symbolic:-Bsymbolic -G -dy %{!z*:-z text}} %{z*} %{R*} %{Y*} \
740 %{G:-G} %{!mcoff:%{Qn:} %{!Qy:-Qn}}"
742 /* The SCO COFF linker gets confused on the difference between "-ofoo"
743 and "-o foo". So we just always force a single space. */
745 #define SWITCHES_NEED_SPACES "o"
747 /* Library spec. If we are not building a shared library, provide the
748 standard libraries, as per the SCO compiler. */
752 "%{shared:pic/libgcc.a%s}%{!shared:%{!symbolic:-lcrypt -lgen -lc}}"
755 #define LIBGCC_SPEC \
758 #define MASK_COFF 010000000000 /* Mask for elf generation */
759 #define TARGET_ELF (1) /* (!(target_flags & MASK_COFF)) */
761 #undef SUBTARGET_SWITCHES
762 #define SUBTARGET_SWITCHES \
763 { "elf", -MASK_COFF, N_("Generate ELF output") },
765 #define NO_DOLLAR_IN_LABEL
767 /* Implicit library calls should use memcpy, not bcopy, etc. They are
768 faster on OpenServer libraries. */
770 #define TARGET_MEM_FUNCTIONS
772 /* Biggest alignment supported by the object file format of this
773 machine. Use this macro to limit the alignment which can be
774 specified using the `__attribute__ ((aligned (N)))' construct. If
775 not defined, the default value is `BIGGEST_ALIGNMENT'. */
777 #define MAX_OFILE_ALIGNMENT (32768*8)
779 /* Define the `__builtin_va_list' type for the ABI. On OpenServer, this
781 #undef BUILD_VA_LIST_TYPE
782 #define BUILD_VA_LIST_TYPE(VALIST) \
783 (VALIST) = build_pointer_type (char_type_node)
787 Here comes some major hackery to get the crt stuff to compile properly.
788 Since we can (and do) compile for both COFF and ELF environments, we
789 set things up accordingly, based on the pre-processor defines for ELF
790 and COFF. This is insane, but then I guess having one compiler with a
791 single back-end supporting two vastly different file format types is
792 a little insane too. But it is not impossible and we get a useful
793 compiler at the end of the day. Onward we go ...
796 #if defined(CRT_BEGIN) || defined(CRT_END) || defined(IN_LIBGCC2)
797 # undef OBJECT_FORMAT_ELF
798 # undef INIT_SECTION_ASM_OP
799 # undef FINI_SECTION_ASM_OP
800 # undef CTORS_SECTION_ASM_OP
801 # undef DTORS_SECTION_ASM_OP
802 # undef EH_FRAME_SECTION_NAME
803 # undef CTOR_LIST_BEGIN
804 # undef CTOR_LIST_END
805 # undef DO_GLOBAL_CTORS_BODY
807 # if defined (_SCO_ELF)
808 # define OBJECT_FORMAT_ELF
809 # define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_ELF
810 # define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_ELF
811 # define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_ELF
812 # define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_ELF
813 # define EH_FRAME_SECTION_NAME EH_FRAME_SECTION_NAME_ELF
814 # else /* ! _SCO_ELF */
815 # define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_COFF
816 # define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_COFF
817 # define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_COFF
818 # define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_COFF
819 # define EH_FRAME_SECTION_NAME EH_FRAME_SECTION_NAME_COFF
820 # define CTOR_LIST_BEGIN asm (INIT_SECTION_ASM_OP); asm ("pushl $0")
821 # define CTOR_LIST_END CTOR_LIST_BEGIN
822 # define DO_GLOBAL_CTORS_BODY \
824 func_ptr *p, *beg = alloca(0); \
828 # endif /* ! _SCO_ELF */
829 #endif /* CRT_BEGIN !! CRT_END */
831 /* Handle special EH pointer encodings. Absolute, pc-relative, and
832 indirect are handled automatically. */
833 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
835 if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \
837 fputs (ASM_LONG, FILE); \
838 assemble_name (FILE, XSTR (ADDR, 0)); \
839 fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
844 /* Used by crtstuff.c to initialize the base of data-relative relocations.
845 These are GOT relative on x86, so return the pic register. */
847 #define CRT_GET_RFIB_DATA(BASE) \
849 register void *ebx_ __asm__("ebx"); \
853 #define CRT_GET_RFIB_DATA(BASE) \
854 __asm__ ("call\t.LPR%=\n" \
857 /* Due to a GAS bug, this cannot use EAX. That encodes \
858 smaller than the traditional EBX, which results in the \
859 offset being off by one. */ \
860 "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \
864 /* Select a format to encode pointers in exception handling data. CODE
865 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
866 true if the symbol may be affected by dynamic relocations. */
867 #undef ASM_PREFERRED_EH_DATA_FORMAT
868 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
869 (flag_pic ? (GLOBAL ? DW_EH_PE_indirect : 0) | DW_EH_PE_datarel \