* rtl.h (rtunion_def): Constify member `rtstr'.
[official-gcc.git] / gcc / config / i386 / sco5.h
blobdf40cb25914c55b1421d72ba0822e4c535892fe8
1 /* Definitions for Intel 386 running SCO Unix System V 3.2 Version 5.
2 Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999
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)
11 any later version.
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 */
26 #undef TARGET_VERSION
27 #define TARGET_VERSION fprintf (stderr, " (i386, SCO OpenServer 5 Syntax)");
29 #undef LPREFIX
30 #define LPREFIX ".L"
32 #undef ALIGN_ASM_OP
33 #define ALIGN_ASM_OP "\t.align"
35 #undef ASCII_DATA_ASM_OP
36 #define ASCII_DATA_ASM_OP "\t.ascii"
38 #undef ASM_BYTE_OP
39 #define ASM_BYTE_OP "\t.byte"
41 #undef IDENT_ASM_OP
42 #define IDENT_ASM_OP "\t.ident"
44 #undef COMMON_ASM_OP
45 #define COMMON_ASM_OP "\t.comm"
47 #undef SET_ASM_OP
48 #define SET_ASM_OP "\t.set"
50 #undef LOCAL_ASM_OP
51 #define LOCAL_ASM_OP "\t.local"
53 #undef INT_ASM_OP
54 #define INT_ASM_OP "\t.long"
56 #undef ASM_SHORT
57 #define ASM_SHORT "\t.value"
59 #undef ASM_LONG
60 #define ASM_LONG "\t.long"
62 #undef ASM_DOUBLE
63 #define ASM_DOUBLE "\t.double"
65 #undef TYPE_ASM_OP
66 #define TYPE_ASM_OP "\t.type"
68 #undef SIZE_ASM_OP
69 #define SIZE_ASM_OP "\t.size"
71 #undef STRING_ASM_OP
72 #define STRING_ASM_OP "\t.string"
74 #undef SKIP_ASM_OP
75 #define SKIP_ASM_OP "\t.zero"
77 #undef GLOBAL_ASM_OP
78 #define GLOBAL_ASM_OP "\t.globl"
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)
146 #endif
148 #define SCO_DEFAULT_ASM_COFF(FILE,NAME) \
149 do { \
150 ASM_OUTPUT_LABEL (FILE, NAME); \
151 } while (0)
153 #undef ASM_DECLARE_FUNCTION_NAME
154 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
155 do { \
156 if (TARGET_ELF) { \
157 fprintf (FILE, "%s\t ", TYPE_ASM_OP); \
158 assemble_name (FILE, NAME); \
159 putc (',', FILE); \
160 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
161 putc ('\n', FILE); \
162 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
163 ASM_OUTPUT_LABEL(FILE, NAME); \
164 } else \
165 SCO_DEFAULT_ASM_COFF(FILE, NAME); \
166 } while (0)
168 #undef ASM_DECLARE_FUNCTION_SIZE
169 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
170 do { \
171 if (TARGET_ELF) { if (!flag_inhibit_size_directive) \
173 fprintf (FILE, "%s\t ", SIZE_ASM_OP); \
174 assemble_name (FILE, (FNAME)); \
175 fprintf (FILE, ",.-"); \
176 assemble_name (FILE, (FNAME)); \
177 putc ('\n', FILE); \
178 } } \
179 } while (0)
181 #undef ASM_DECLARE_OBJECT_NAME
182 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
183 do { \
184 if (TARGET_ELF) { \
185 fprintf (FILE, "%s\t ", TYPE_ASM_OP); \
186 assemble_name (FILE, NAME); \
187 putc (',', FILE); \
188 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
189 putc ('\n', FILE); \
190 size_directive_output = 0; \
191 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
193 size_directive_output = 1; \
194 fprintf (FILE, "%s\t ", 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); \
199 } else \
200 SCO_DEFAULT_ASM_COFF(FILE, NAME); \
201 } while (0)
203 #undef ASM_FILE_START_1
204 #define ASM_FILE_START_1(FILE)
206 #undef ASM_FILE_START
207 #define ASM_FILE_START(FILE) \
208 do { \
209 output_file_directive((FILE),main_input_filename); \
210 fprintf ((FILE), "\t.version\t\"01.01\"\n"); \
211 } while (0)
213 #undef ASM_FILE_END
214 #define ASM_FILE_END(FILE) \
215 do { \
216 if (!flag_no_ident) \
217 fprintf ((FILE), "%s\t\"GCC: (GNU) %s\"\n", \
218 IDENT_ASM_OP, version_string); \
219 } while (0)
221 #undef ASM_FINISH_DECLARE_OBJECT
222 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
223 do { \
224 if (TARGET_ELF) { \
225 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
226 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
227 && ! AT_END && TOP_LEVEL \
228 && DECL_INITIAL (DECL) == error_mark_node \
229 && !size_directive_output) \
231 size_directive_output = 1; \
232 fprintf (FILE, "%s\t ", SIZE_ASM_OP); \
233 assemble_name (FILE, name); \
234 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
237 } while (0)
239 #undef ASM_GENERATE_INTERNAL_LABEL
240 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
241 do { \
242 if (TARGET_ELF) \
243 sprintf (LABEL, "*.%s%d", (PREFIX), (NUM)); \
244 else \
245 sprintf (LABEL, ".%s%d", (PREFIX), (NUM)); \
246 } while (0)
248 #undef ASM_OUTPUT_ADDR_DIFF_ELT
249 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
250 do { \
251 if (TARGET_ELF) \
252 fprintf (FILE, "%s _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", ASM_LONG, LPREFIX, VALUE); \
253 else \
254 fprintf (FILE, "\t.word %s%d-%s%d\n", LPREFIX,VALUE,LPREFIX,REL); \
255 } while (0)
257 #undef ASM_OUTPUT_ALIGNED_COMMON
258 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
259 do { \
260 fprintf ((FILE), "%s\t", COMMON_ASM_OP); \
261 assemble_name ((FILE), (NAME)); \
262 if (TARGET_ELF) \
263 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
264 else \
265 fprintf ((FILE), ",%u\n", (SIZE)); \
266 } while (0)
268 #undef ASM_OUTPUT_ALIGNED_LOCAL
269 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
270 do { \
271 if (TARGET_ELF) { \
272 fprintf ((FILE), "%s\t", LOCAL_ASM_OP); \
273 assemble_name ((FILE), (NAME)); \
274 fprintf ((FILE), "\n"); \
275 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
276 } else { \
277 int align = exact_log2 (ALIGN); \
278 if (align > 2) align = 2; \
279 if (TARGET_SVR3_SHLIB) \
280 data_section (); \
281 else \
282 bss_section (); \
283 ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \
284 fprintf ((FILE), "%s\t", "\t.lcomm"); \
285 assemble_name ((FILE), (NAME)); \
286 fprintf ((FILE), ",%u\n", (SIZE)); \
288 } while (0)
290 /* A C statement (sans semicolon) to output to the stdio stream
291 FILE the assembler definition of uninitialized global DECL named
292 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
293 Try to use asm_output_aligned_bss to implement this macro. */
295 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
296 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
298 #undef ESCAPES
299 #define ESCAPES \
300 "\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\
301 \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\
302 \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\
303 \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\
304 \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\
305 \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\
306 \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\
307 \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"
309 #undef STRING_LIMIT
310 #define STRING_LIMIT ((unsigned) 256)
312 #undef ASM_OUTPUT_LIMITED_STRING
313 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
314 do \
316 register const unsigned char *_limited_str = \
317 (const unsigned char *) (STR); \
318 register unsigned ch; \
319 fprintf ((FILE), "%s\t\"", STRING_ASM_OP); \
320 for (; (ch = *_limited_str); _limited_str++) \
322 register int escape; \
323 switch (escape = ESCAPES[ch]) \
325 case 0: \
326 putc (ch, (FILE)); \
327 break; \
328 case 1: \
329 fprintf ((FILE), "\\%03o", ch); \
330 break; \
331 default: \
332 putc ('\\', (FILE)); \
333 putc (escape, (FILE)); \
334 break; \
337 fprintf ((FILE), "\"\n"); \
339 while (0)
342 #undef ASM_OUTPUT_ASCII
343 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
344 do { \
345 register const unsigned char *_ascii_bytes = \
346 (const unsigned char *) (STR); \
347 register const unsigned char *limit = _ascii_bytes + (LENGTH); \
348 register unsigned bytes_in_chunk = 0; \
349 for (; _ascii_bytes < limit; _ascii_bytes++) \
351 register unsigned const char *p; \
352 if (bytes_in_chunk >= 64) \
354 fputc ('\n', (FILE)); \
355 bytes_in_chunk = 0; \
357 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
358 continue; \
359 if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \
361 if (bytes_in_chunk > 0) \
363 fputc ('\n', (FILE)); \
364 bytes_in_chunk = 0; \
366 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
367 _ascii_bytes = p; \
369 else \
371 if (bytes_in_chunk == 0) \
372 fprintf ((FILE), "%s\t", ASM_BYTE_OP); \
373 else \
374 fputc (',', (FILE)); \
375 fprintf ((FILE), "0x%02x", *_ascii_bytes); \
376 bytes_in_chunk += 5; \
379 if (bytes_in_chunk > 0) \
380 fprintf ((FILE), "\n"); \
381 } while (0)
383 /* Must use data section for relocatable constants when pic. */
384 #undef SELECT_RTX_SECTION
385 #define SELECT_RTX_SECTION(MODE,RTX) \
387 if (TARGET_ELF) { \
388 if (flag_pic && symbolic_operand (RTX, VOIDmode)) \
389 data_section (); \
390 else \
391 const_section (); \
392 } else \
393 readonly_data_section(); \
396 #undef ASM_OUTPUT_CASE_LABEL
397 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \
398 do { \
399 if (TARGET_ELF) \
400 ASM_OUTPUT_ALIGN ((FILE), 2); \
401 ASM_OUTPUT_INTERNAL_LABEL((FILE),(PREFIX),(NUM)); \
402 } while (0)
405 #undef ASM_OUTPUT_CONSTRUCTOR
406 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
407 do { \
408 if (TARGET_ELF) { \
409 ctors_section (); \
410 fprintf (FILE, "%s\t ", INT_ASM_OP); \
411 assemble_name (FILE, NAME); \
412 fprintf (FILE, "\n"); \
413 } else { \
414 init_section (); \
415 fprintf (FILE, "\tpushl $"); \
416 assemble_name (FILE, NAME); \
417 fprintf (FILE, "\n"); } \
418 } while (0)
420 #undef ASM_OUTPUT_DESTRUCTOR
421 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
422 do { \
423 if (TARGET_ELF) { \
424 dtors_section (); \
425 fprintf (FILE, "%s\t ", INT_ASM_OP); \
426 assemble_name (FILE, NAME); \
427 fprintf (FILE, "\n"); \
428 } else { \
429 fini_section (); \
430 fprintf (FILE, "%s\t ", ASM_LONG); \
431 assemble_name (FILE, NAME); \
432 fprintf (FILE, "\n"); } \
433 } while (0)
436 #undef ASM_OUTPUT_IDENT
437 #define ASM_OUTPUT_IDENT(FILE, NAME) \
438 fprintf (FILE, "%s\t\"%s\"\n", IDENT_ASM_OP, NAME);
440 #undef ASM_GLOBALIZE_LABEL
441 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
442 (fprintf ((FILE), "%s ", GLOBAL_ASM_OP), assemble_name (FILE, NAME), fputs ("\n", FILE))
444 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
445 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
446 if (TARGET_ELF) ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
448 #undef ASM_OUTPUT_INTERNAL_LABEL
449 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
450 fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
452 /* The prefix to add to user-visible assembler symbols. */
454 #undef USER_LABEL_PREFIX
455 #define USER_LABEL_PREFIX ""
458 * Compensate for the difference between ELF and COFF assembler syntax.
459 * Otherwise, this is cribbed from ../svr4.h.
460 * We rename 'gcc_except_table' to the shorter name in preparation
461 * for the day when we're ready to do DWARF2 eh unwinding under COFF
463 #undef ASM_OUTPUT_SECTION_NAME
464 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
465 do { \
466 static struct section_info \
468 struct section_info *next; \
469 char *name; \
470 enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
471 } *sections; \
472 struct section_info *s; \
473 const char *mode; \
474 enum sect_enum type; \
475 const char *sname = NAME ; \
476 if (strcmp(NAME, ".gcc_except_table") == 0) sname = ".gccexc" ; \
478 for (s = sections; s; s = s->next) \
479 if (!strcmp (NAME, s->name)) \
480 break; \
482 if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
483 type = SECT_EXEC, mode = (TARGET_ELF) ? "ax" : "x" ; \
484 else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
485 type = SECT_RO, mode = "a"; \
486 else \
487 type = SECT_RW, mode = (TARGET_ELF) ? "aw" : "w" ; \
489 if (s == 0) \
491 s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
492 s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
493 strcpy (s->name, NAME); \
494 s->type = type; \
495 s->next = sections; \
496 sections = s; \
497 fprintf (FILE, ".section\t%s,\"%s\"%s\n", sname, mode, \
498 (TARGET_ELF) ? ",@progbits" : "" ); \
500 else \
502 if (DECL && s->type != type) \
503 error_with_decl (DECL, "%s causes a section type conflict"); \
505 fprintf (FILE, ".section\t%s\n", sname); \
507 } while (0)
509 #undef ASM_OUTPUT_SKIP
510 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
511 do { \
512 if (TARGET_ELF) \
513 fprintf (FILE, "%s\t%u\n", SKIP_ASM_OP, (SIZE)); \
514 else \
515 fprintf ((FILE), "%s\t.,.+%u\n", SET_ASM_OP, (SIZE)); \
516 } while (0)
519 #undef CTOR_LIST_BEGIN
520 #define CTOR_LIST_BEGIN \
521 do { \
522 asm (CTORS_SECTION_ASM_OP); \
523 if (TARGET_ELF) \
524 STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }; \
525 else \
526 asm ("pushl $0"); \
527 } while (0)
529 #undef CTOR_LIST_END
530 #define CTOR_LIST_END \
531 do { \
532 if (TARGET_ELF) { \
533 asm (CTORS_SECTION_ASM_OP); \
534 STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (0) }; \
535 } else { \
536 CTOR_LIST_BEGIN; \
538 } while (0)
540 #undef DBX_BLOCKS_FUNCTION_RELATIVE
541 #define DBX_BLOCKS_FUNCTION_RELATIVE 1
543 #undef DBX_FUNCTION_FIRST
544 #define DBX_FUNCTION_FIRST 1
546 #undef DBX_REGISTER_NUMBER
547 #define DBX_REGISTER_NUMBER(n) \
548 ((TARGET_ELF) ? svr4_dbx_register_map[n] : dbx_register_map[n])
550 #undef DWARF_DEBUGGING_INFO
551 #undef SDB_DEBUGGING_INFO
552 #undef DBX_DEBUGGING_INFO
553 #undef PREFERRED_DEBUGGING_TYPE
555 #define DWARF_DEBUGGING_INFO 1
556 #define SDB_DEBUGGING_INFO 1
557 #define DBX_DEBUGGING_INFO 1
558 #define PREFERRED_DEBUGGING_TYPE \
559 ((TARGET_ELF) ? DWARF_DEBUG: SDB_DEBUG)
561 #undef EXTRA_SECTIONS
562 #define EXTRA_SECTIONS in_const, in_init, in_fini, in_ctors, in_dtors
564 #undef EXTRA_SECTION_FUNCTIONS
565 #define EXTRA_SECTION_FUNCTIONS \
566 CONST_SECTION_FUNCTION \
567 INIT_SECTION_FUNCTION \
568 FINI_SECTION_FUNCTION \
569 CTORS_SECTION_FUNCTION \
570 DTORS_SECTION_FUNCTION
572 #undef CONST_SECTION_FUNCTION
573 #define CONST_SECTION_FUNCTION \
574 void \
575 const_section () \
577 if (!USE_CONST_SECTION) \
578 text_section(); \
579 else if (in_section != in_const) \
581 fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
582 in_section = in_const; \
586 #undef FINI_SECTION_FUNCTION
587 #define FINI_SECTION_FUNCTION \
588 void \
589 fini_section () \
591 if ((!TARGET_ELF) && in_section != in_fini) \
593 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
594 in_section = in_fini; \
598 #undef INIT_SECTION_FUNCTION
599 #define INIT_SECTION_FUNCTION \
600 void \
601 init_section () \
603 if ((!TARGET_ELF) && in_section != in_init) \
605 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
606 in_section = in_init; \
610 #undef CTORS_SECTION_FUNCTION
611 #define CTORS_SECTION_FUNCTION \
612 void \
613 ctors_section () \
615 if (in_section != in_ctors) \
617 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
618 in_section = in_ctors; \
622 #undef DTORS_SECTION_FUNCTION
623 #define DTORS_SECTION_FUNCTION \
624 void \
625 dtors_section () \
627 if (in_section != in_dtors) \
629 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
630 in_section = in_dtors; \
634 #undef FRAME_POINTER_REQUIRED
635 #define FRAME_POINTER_REQUIRED \
636 ((TARGET_ELF) ? 0 : \
637 (current_function_calls_setjmp || current_function_calls_longjmp))
639 #undef JUMP_TABLES_IN_TEXT_SECTION
640 #define JUMP_TABLES_IN_TEXT_SECTION (TARGET_ELF && flag_pic)
642 #undef LOCAL_LABEL_PREFIX
643 #define LOCAL_LABEL_PREFIX \
644 ((TARGET_ELF) ? "" : ".")
646 #undef MD_EXEC_PREFIX
647 #undef MD_STARTFILE_PREFIX
648 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
649 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
651 #undef NON_SAVING_SETJMP
652 #define NON_SAVING_SETJMP \
653 ((TARGET_ELF) ? 0 : \
654 (current_function_calls_setjmp && current_function_calls_longjmp))
656 #undef NO_IMPLICIT_EXTERN_C
657 #define NO_IMPLICIT_EXTERN_C 1
659 /* JKJ FIXME - examine the ramifications of RETURN_IN_MEMORY and
660 RETURN_POPS_ARGS */
662 #undef RETURN_POPS_ARGS
663 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
664 ((TARGET_ELF) ? \
665 (ix86_return_pops_args (FUNDECL, FUNTYPE, SIZE)) : \
666 (((FUNDECL) && (TREE_CODE (FUNDECL) == IDENTIFIER_NODE)) ? 0 \
667 : (TARGET_RTD \
668 && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
669 || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
670 == void_type_node))) ? (SIZE) \
671 : 0))
673 #undef SELECT_SECTION
674 #define SELECT_SECTION(DECL,RELOC) \
676 if (TARGET_ELF && flag_pic && RELOC) \
677 data_section (); \
678 else if (TREE_CODE (DECL) == STRING_CST) \
680 if (! flag_writable_strings) \
681 const_section (); \
682 else \
683 data_section (); \
685 else if (TREE_CODE (DECL) == VAR_DECL) \
687 if (! DECL_READONLY_SECTION (DECL, RELOC)) \
688 data_section (); \
689 else \
690 const_section (); \
692 else \
693 const_section (); \
696 #undef SWITCH_TAKES_ARG
697 #define SWITCH_TAKES_ARG(CHAR) \
698 (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
699 || (CHAR) == 'h' \
700 || (CHAR) == 'R' \
701 || (CHAR) == 'Y' \
702 || (CHAR) == 'z')
704 #undef WORD_SWITCH_TAKES_ARG
705 #define WORD_SWITCH_TAKES_ARG(STR) \
706 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
707 && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \
708 && strcmp (STR, "Tbss"))
710 #undef TARGET_DEFAULT
711 #define TARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
713 #undef HANDLE_SYSV_PRAGMA
714 #define HANDLE_SYSV_PRAGMA 1
716 /* Though OpenServer supports .weak in COFF, we don't use it.
717 * G++ will frequently emit a symol as .weak and then (in the same .s
718 * file) declare it global. The COFF assembler finds this unamusing.
720 #define SUPPORTS_WEAK (TARGET_ELF)
721 #define ASM_WEAKEN_LABEL(FILE,NAME) \
722 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
723 fputc ('\n', FILE); } while (0)
725 #undef SCCS_DIRECTIVE
726 #define SCCS_DIRECTIVE 1
729 * Define sizes and types
731 #undef SIZE_TYPE
732 #undef PTRDIFF_TYPE
733 #undef WCHAR_TYPE
734 #undef WCHAR_TYPE_SIZE
735 #undef LONG_DOUBLE_TYPE_SIZE
736 #define LONG_DOUBLE_TYPE_SIZE 96
737 #define SIZE_TYPE "unsigned int"
738 #define PTRDIFF_TYPE "int"
739 #define WCHAR_TYPE "long int"
740 #define WCHAR_TYPE_SIZE BITS_PER_WORD
743 * New for multilib support. Set the default switches for multilib,
744 * which is -melf.
746 #define MULTILIB_DEFAULTS { "melf" }
749 /* Please note that these specs may look messy but they are required in
750 order to emulate the SCO Development system as closely as possible.
751 With SCO Open Server 5.0, you now get the linker and assembler free,
752 so that is what these specs are targeted for. These utilities are
753 very argument sensitive: a space in the wrong place breaks everything.
754 So RMS, please forgive this mess. It works.
756 Parameters which can be passed to gcc, and their SCO equivalents:
757 GCC Parameter SCO Equivalent
758 -ansi -a ansi
759 -posix -a posix
760 -Xpg4 -a xpg4
761 -Xpg4plus -a xpg4plus
762 -Xods30 -a ods30
764 As with SCO, the default is XPG4 plus mode. SCO also allows you to
765 specify a C dialect with -Xt, -Xa, -Xc, -Xk and -Xm. These are passed
766 on to the assembler and linker in the same way that the SCO compiler
767 does.
769 SCO also allows you to compile, link and generate either ELF or COFF
770 binaries. With gcc, unlike the SCO compiler, the default is ELF.
771 Specify -mcoff to gcc to produce COFF binaries. -fpic will get the
772 assembler and linker to produce PIC code.
775 /* Set up assembler flags for PIC and ELF compilations */
776 #undef ASM_SPEC
778 #if USE_GAS
779 /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c
780 * Undef MD_EXEC_PREFIX becuase we don't know where GAS is, but it's not
781 * likely in /usr/ccs/bin/
783 #undef MD_EXEC_PREFIX
784 #else
786 #define ASM_SPEC \
787 "-b %{!mcoff:elf}%{mcoff:coff \
788 %{static:%e-static not valid with -mcoff} \
789 %{shared:%e-shared not valid with -mcoff} \
790 %{symbolic:%e-symbolic not valid with -mcoff}} \
791 %{Ym,*} %{Yd,*} %{Wa,*:%*} \
792 %{!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}}"
793 #endif
795 /* Use crt1.o as a startup file and crtn.o as a closing file. */
797 #undef STARTFILE_SPEC
798 #define STARTFILE_SPEC \
799 "%{shared: %{!mcoff: crti.o%s}} \
800 %{!shared:\
801 %{!symbolic: \
802 %{pg:gcrt.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}} \
803 %{ansi:values-Xc.o%s} \
804 %{!ansi: \
805 %{traditional:values-Xt.o%s} \
806 %{!traditional: \
807 %{Xa:values-Xa.o%s} \
808 %{!Xa:%{Xc:values-Xc.o%s} \
809 %{!Xc:%{Xk:values-Xk.o%s} \
810 %{!Xk:%{Xt:values-Xt.o%s} \
811 %{!Xt:values-Xa.o%s}}}}}} \
812 %{mcoff:crtbeginS.o%s} %{!mcoff:crtbegin.o%s}"
814 #undef ENDFILE_SPEC
815 #define ENDFILE_SPEC \
816 "%{!mcoff:crtend.o%s} \
817 %{mcoff:crtendS.o%s} \
818 %{pg:gcrtn.o%s}%{!pg:crtn.o%s}"
820 #undef CPP_PREDEFINES
821 #define CPP_PREDEFINES \
822 "-Asystem(svr3)"
824 /* You are in a maze of GCC specs ... all alike */
826 #undef CPP_SPEC
827 #define CPP_SPEC "%(cpp_cpu) \
828 %{fpic:%{mcoff:%e-fpic is not valid with -mcoff}} \
829 %{fPIC:%{mcoff:%e-fPIC is not valid with -mcoff}} \
830 -D__i386 -D__unix -D_SCO_DS=1 -D_M_I386 -D_M_XENIX -D_M_UNIX \
831 %{!Xods30:-D_STRICT_NAMES} \
832 %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \
833 %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi -D_STRICT_ANSI} \
834 %{!ansi: \
835 %{posix:-isystem include/posix%s -isystem /usr/include/posix \
836 -D_POSIX_C_SOURCE=2 -D_POSIX_SOURCE=1} \
837 %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \
838 -D_XOPEN_SOURCE=1} \
839 %{!Xpg4:-D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT \
840 -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII \
841 -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX \
842 %{Xods30:-isystem include/ods_30_compat%s \
843 -isystem /usr/include/ods_30_compat \
844 -D_SCO_ODS_30 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \
845 -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \
846 -DM_WORDSWAP}}}} \
847 %{scointl:-DM_INTERNAT -D_M_INTERNAT} \
848 %{traditional:-D_KR -D_SVID -D_NO_PROTOTYPE} \
849 %{!mcoff:-D_SCO_ELF} \
850 %{mcoff:-D_M_COFF -D_SCO_COFF} \
851 %{!mcoff:%{fpic:-D__PIC__ -D__pic__} \
852 %{fPIC:%{!fpic:-D__PIC__ -D__pic__}}} \
853 %{Xa:-D_SCO_C_DIALECT=1} \
854 %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \
855 %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \
856 %{!Xk:%{Xt:-D_SCO_C_DIALECT=2} \
857 %{!Xt:-D_SCO_C_DIALECT=1}}}} \
858 %{traditional:-traditional -D_KR -D_NO_PROTOTYPE}"
860 #undef LINK_SPEC
861 #define LINK_SPEC \
862 "-b %{!mcoff:elf}%{mcoff:coff \
863 %{static:%e-static not valid with -mcoff} \
864 %{shared:%e-shared not valid with -mcoff} \
865 %{symbolic:%e-symbolic not valid with -mcoff} \
866 %{fpic:%e-fpic not valid with -mcoff} \
867 %{fPIC:%e-fPIC not valid with -mcoff}} \
868 -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} \
869 %{Wl,*%*} %{YP,*} %{YL,*} %{YU,*} \
870 %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \
871 %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \
872 %{h*} %{static:-dn -Bstatic} %{shared:-G -dy %{!z*:-z text}} \
873 %{symbolic:-Bsymbolic -G -dy %{!z*:-z text}} %{z*} %{R*} %{Y*} \
874 %{G:-G} %{!mcoff:%{Qn:} %{!Qy:-Qn}}"
876 /* The SCO COFF linker gets confused on the difference between "-ofoo"
877 and "-o foo". So we just always force a single space. */
879 #define SWITCHES_NEED_SPACES "o"
881 /* Library spec. If we are not building a shared library, provide the
882 standard libraries, as per the SCO compiler. */
884 #undef LIB_SPEC
885 #define LIB_SPEC \
886 "%{shared:pic/libgcc.a%s}%{!shared:%{!symbolic:-lcrypt -lgen -lc}}"
888 #undef LIBGCC_SPEC
889 #define LIBGCC_SPEC \
890 "%{!shared:-lgcc}"
892 #define MASK_COFF 010000000000 /* Mask for elf generation */
893 #define TARGET_COFF (target_flags & MASK_COFF)
894 #define TARGET_ELF (!(target_flags & MASK_COFF))
896 #undef SUBTARGET_SWITCHES
897 #define SUBTARGET_SWITCHES \
898 { "coff", MASK_COFF, "Generate COFF output" }, \
899 { "elf", -MASK_COFF, "Generate ELF output" },
901 #define NO_DOLLAR_IN_LABEL
903 /* Implicit library calls should use memcpy, not bcopy, etc. They are
904 faster on OpenServer libraries. */
906 #define TARGET_MEM_FUNCTIONS
908 /* Biggest alignment supported by the object file format of this
909 machine. Use this macro to limit the alignment which can be
910 specified using the `__attribute__ ((aligned (N)))' construct. If
911 not defined, the default value is `BIGGEST_ALIGNMENT'. */
913 #define MAX_OFILE_ALIGNMENT (32768*8)
915 /* Define the `__builtin_va_list' type for the ABI. On OpenServer, this
916 type is `char *'. */
917 #undef BUILD_VA_LIST_TYPE
918 #define BUILD_VA_LIST_TYPE(VALIST) \
919 (VALIST) = build_pointer_type (char_type_node)
923 Here comes some major hackery to get the crt stuff to compile properly.
924 Since we can (and do) compile for both COFF and ELF environments, we
925 set things up accordingly, based on the pre-processor defines for ELF
926 and COFF. This is insane, but then I guess having one compiler with a
927 single back-end supporting two vastly different file format types is
928 a little insane too. But it is not impossible and we get a useful
929 compiler at the end of the day. Onward we go ...
932 #if defined(CRT_BEGIN) || defined(CRT_END) || defined(IN_LIBGCC2)
933 # undef OBJECT_FORMAT_ELF
934 # undef INIT_SECTION_ASM_OP
935 # undef FINI_SECTION_ASM_OP
936 # undef CTORS_SECTION_ASM_OP
937 # undef DTORS_SECTION_ASM_OP
938 # undef EH_FRAME_SECTION_ASM_OP
939 # undef CTOR_LIST_BEGIN
940 # undef CTOR_LIST_END
941 # undef DO_GLOBAL_CTORS_BODY
943 # if defined (_SCO_ELF)
944 # define OBJECT_FORMAT_ELF
945 # define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_ELF
946 # define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_ELF
947 # define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_ELF
948 # define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_ELF
949 # define EH_FRAME_SECTION_ASM_OP EH_FRAME_SECTION_ASM_OP_ELF
950 # else /* ! _SCO_ELF */
951 # define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_COFF
952 # define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_COFF
953 # define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_COFF
954 # define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_COFF
955 # define EH_FRAME_SECTION_ASM_OP EH_FRAME_SECTION_ASM_OP_COFF
956 # define CTOR_LIST_BEGIN asm (INIT_SECTION_ASM_OP); asm ("pushl $0")
957 # define CTOR_LIST_END CTOR_LIST_BEGIN
958 # define DO_GLOBAL_CTORS_BODY \
959 do { \
960 func_ptr *p, *beg = alloca(0); \
961 for (p = beg; *p;) \
962 (*p++) (); \
963 } while (0)
964 # endif /* ! _SCO_ELF */
965 #endif /* CRT_BEGIN !! CRT_END */