]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/i386/sco5.h
configure.in: Check whether assembler supports section merging.
[thirdparty/gcc.git] / gcc / config / i386 / sco5.h
1 /* Definitions for Intel 386 running SCO Unix System V 3.2 Version 5.
2 Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000
3 Free Software Foundation, Inc.
4 Contributed by Kean Johnston (hug@netcom.com)
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
22
23 #include "i386/i386.h" /* Base i386 target definitions */
24 #include "i386/att.h" /* Use AT&T i386 assembler syntax */
25
26 #undef TARGET_VERSION
27 #define TARGET_VERSION fprintf (stderr, " (i386, SCO OpenServer 5 Syntax)");
28
29 #undef LPREFIX
30 #define LPREFIX ".L"
31
32 #undef ALIGN_ASM_OP
33 #define ALIGN_ASM_OP "\t.align\t"
34
35 #undef ASCII_DATA_ASM_OP
36 #define ASCII_DATA_ASM_OP "\t.ascii\t"
37
38 #undef ASM_BYTE_OP
39 #define ASM_BYTE_OP "\t.byte\t"
40
41 #undef IDENT_ASM_OP
42 #define IDENT_ASM_OP "\t.ident\t"
43
44 #undef COMMON_ASM_OP
45 #define COMMON_ASM_OP "\t.comm\t"
46
47 #undef SET_ASM_OP
48 #define SET_ASM_OP "\t.set\t"
49
50 #undef LOCAL_ASM_OP
51 #define LOCAL_ASM_OP "\t.local\t"
52
53 #undef INT_ASM_OP
54 #define INT_ASM_OP "\t.long\t"
55
56 #undef ASM_SHORT
57 #define ASM_SHORT "\t.value\t"
58
59 #undef ASM_LONG
60 #define ASM_LONG "\t.long\t"
61
62 #undef TYPE_ASM_OP
63 #define TYPE_ASM_OP "\t.type\t"
64
65 #undef SIZE_ASM_OP
66 #define SIZE_ASM_OP "\t.size\t"
67
68 #undef STRING_ASM_OP
69 #define STRING_ASM_OP "\t.string\t"
70
71 #undef SKIP_ASM_OP
72 #define SKIP_ASM_OP "\t.zero\t"
73
74 #undef GLOBAL_ASM_OP
75 #define GLOBAL_ASM_OP "\t.globl\t"
76
77 #undef EH_FRAME_SECTION_ASM_OP
78 #define EH_FRAME_SECTION_NAME_COFF ".ehfram"
79 #define EH_FRAME_SECTION_NAME_ELF ".eh_frame"
80 #define EH_FRAME_SECTION_NAME \
81 ((TARGET_ELF) ? EH_FRAME_SECTION_NAME_ELF : EH_FRAME_SECTION_NAME_COFF)
82
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 )
87
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)
93
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)
99
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)
106
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)
112
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)
118
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)
124
125 #undef BSS_SECTION_ASM_OP
126 #define BSS_SECTION_ASM_OP "\t.data"
127
128 #undef TEXT_SECTION_ASM_OP
129 #define TEXT_SECTION_ASM_OP "\t.text"
130
131 #undef DATA_SECTION_ASM_OP
132 #define DATA_SECTION_ASM_OP "\t.data"
133
134 #undef TYPE_OPERAND_FMT
135 #define TYPE_OPERAND_FMT "@%s"
136
137 #undef APPLY_RESULT_SIZE
138 #define APPLY_RESULT_SIZE \
139 (TARGET_ELF) ? size : 116
140
141 #ifndef ASM_DECLARE_RESULT
142 #define ASM_DECLARE_RESULT(FILE, RESULT)
143 #endif
144
145 #define SCO_DEFAULT_ASM_COFF(FILE,NAME) \
146 do { \
147 ASM_OUTPUT_LABEL (FILE, NAME); \
148 } while (0)
149
150 #undef ASM_DECLARE_FUNCTION_NAME
151 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
152 do { \
153 if (TARGET_ELF) { \
154 fprintf (FILE, "%s", TYPE_ASM_OP); \
155 assemble_name (FILE, NAME); \
156 putc (',', FILE); \
157 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
158 putc ('\n', FILE); \
159 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
160 ASM_OUTPUT_LABEL(FILE, NAME); \
161 } else \
162 SCO_DEFAULT_ASM_COFF(FILE, NAME); \
163 } while (0)
164
165 #undef ASM_DECLARE_FUNCTION_SIZE
166 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
167 do { \
168 if (TARGET_ELF) { if (!flag_inhibit_size_directive) \
169 { \
170 fprintf (FILE, "%s", SIZE_ASM_OP); \
171 assemble_name (FILE, (FNAME)); \
172 fprintf (FILE, ",.-"); \
173 assemble_name (FILE, (FNAME)); \
174 putc ('\n', FILE); \
175 } } \
176 } while (0)
177
178 #undef ASM_DECLARE_OBJECT_NAME
179 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
180 do { \
181 if (TARGET_ELF) { \
182 fprintf (FILE, "%s", TYPE_ASM_OP); \
183 assemble_name (FILE, NAME); \
184 putc (',', FILE); \
185 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
186 putc ('\n', FILE); \
187 size_directive_output = 0; \
188 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
189 { \
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))); \
194 } \
195 ASM_OUTPUT_LABEL(FILE, NAME); \
196 } else \
197 SCO_DEFAULT_ASM_COFF(FILE, NAME); \
198 } while (0)
199
200 #undef ASM_FILE_START_1
201 #define ASM_FILE_START_1(FILE)
202
203 #undef ASM_FILE_START
204 #define ASM_FILE_START(FILE) \
205 do { \
206 output_file_directive((FILE),main_input_filename); \
207 fprintf ((FILE), "\t.version\t\"01.01\"\n"); \
208 } while (0)
209
210 #undef ASM_FINISH_DECLARE_OBJECT
211 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
212 do { \
213 if (TARGET_ELF) { \
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) \
219 { \
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))); \
224 } \
225 } \
226 } while (0)
227
228 #undef ASM_GENERATE_INTERNAL_LABEL
229 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
230 do { \
231 if (TARGET_ELF) \
232 sprintf (LABEL, "*.%s%d", (PREFIX), (NUM)); \
233 else \
234 sprintf (LABEL, ".%s%d", (PREFIX), (NUM)); \
235 } while (0)
236
237 #undef ASM_OUTPUT_ADDR_DIFF_ELT
238 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
239 do { \
240 if (TARGET_ELF) \
241 fprintf (FILE, "%s_GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", ASM_LONG, LPREFIX, VALUE); \
242 else \
243 fprintf (FILE, "%s%s%d-%s%d\n", ASM_LONG, LPREFIX,VALUE,LPREFIX,REL); \
244 } while (0)
245
246 #undef ASM_OUTPUT_ALIGNED_COMMON
247 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
248 do { \
249 fprintf ((FILE), "%s", COMMON_ASM_OP); \
250 assemble_name ((FILE), (NAME)); \
251 if (TARGET_ELF) \
252 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
253 else \
254 fprintf ((FILE), ",%u\n", (SIZE)); \
255 } while (0)
256
257 #undef ASM_OUTPUT_ALIGNED_LOCAL
258 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
259 do { \
260 if (TARGET_ELF) { \
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); \
265 } else { \
266 int align = exact_log2 (ALIGN); \
267 if (align > 2) align = 2; \
268 if (TARGET_SVR3_SHLIB) \
269 data_section (); \
270 else \
271 bss_section (); \
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)); \
276 } \
277 } while (0)
278
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. */
283
284 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
285 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
286
287 #undef ESCAPES
288 #define ESCAPES \
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"
297
298 #undef STRING_LIMIT
299 #define STRING_LIMIT ((unsigned) 256)
300
301 #undef ASM_OUTPUT_LIMITED_STRING
302 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
303 do \
304 { \
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++) \
310 { \
311 register int escape; \
312 switch (escape = ESCAPES[ch]) \
313 { \
314 case 0: \
315 putc (ch, (FILE)); \
316 break; \
317 case 1: \
318 fprintf ((FILE), "\\%03o", ch); \
319 break; \
320 default: \
321 putc ('\\', (FILE)); \
322 putc (escape, (FILE)); \
323 break; \
324 } \
325 } \
326 fprintf ((FILE), "\"\n"); \
327 } \
328 while (0)
329
330
331 #undef ASM_OUTPUT_ASCII
332 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
333 do { \
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++) \
339 { \
340 register unsigned const char *p; \
341 if (bytes_in_chunk >= 64) \
342 { \
343 fputc ('\n', (FILE)); \
344 bytes_in_chunk = 0; \
345 } \
346 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
347 continue; \
348 if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \
349 { \
350 if (bytes_in_chunk > 0) \
351 { \
352 fputc ('\n', (FILE)); \
353 bytes_in_chunk = 0; \
354 } \
355 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
356 _ascii_bytes = p; \
357 } \
358 else \
359 { \
360 if (bytes_in_chunk == 0) \
361 fprintf ((FILE), "%s", ASM_BYTE_OP); \
362 else \
363 fputc (',', (FILE)); \
364 fprintf ((FILE), "0x%02x", *_ascii_bytes); \
365 bytes_in_chunk += 5; \
366 } \
367 } \
368 if (bytes_in_chunk > 0) \
369 fprintf ((FILE), "\n"); \
370 } while (0)
371
372 /* Must use data section for relocatable constants when pic. */
373 #undef SELECT_RTX_SECTION
374 #define SELECT_RTX_SECTION(MODE,RTX,ALIGN) \
375 { \
376 if (TARGET_ELF) { \
377 if (flag_pic && symbolic_operand (RTX, VOIDmode)) \
378 data_section (); \
379 else \
380 const_section (); \
381 } else \
382 readonly_data_section(); \
383 }
384
385 #undef ASM_OUTPUT_CASE_LABEL
386 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \
387 do { \
388 if (TARGET_ELF) \
389 ASM_OUTPUT_ALIGN ((FILE), 2); \
390 ASM_OUTPUT_INTERNAL_LABEL((FILE),(PREFIX),(NUM)); \
391 } while (0)
392
393 #undef TARGET_ASM_CONSTRUCTOR
394 #define TARGET_ASM_CONSTRUCTOR sco_asm_out_constructor
395
396 #undef ASM_OUTPUT_IDENT
397 #define ASM_OUTPUT_IDENT(FILE, NAME) \
398 fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME);
399
400 #undef ASM_GLOBALIZE_LABEL
401 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
402 (fprintf ((FILE), "%s", GLOBAL_ASM_OP), assemble_name (FILE, NAME), fputs ("\n", FILE))
403
404 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
405 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
406 if (TARGET_ELF) ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
407
408 #undef ASM_OUTPUT_INTERNAL_LABEL
409 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
410 fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
411
412 /* The prefix to add to user-visible assembler symbols. */
413
414 #undef USER_LABEL_PREFIX
415 #define USER_LABEL_PREFIX ""
416
417 /*
418 * We rename 'gcc_except_table' to the shorter name in preparation
419 * for the day when we're ready to do DWARF2 eh unwinding under COFF.
420 */
421 #define EXCEPTION_SECTION() named_section (NULL, ".gccexc", 1)
422
423 /* Switch into a generic section. */
424 #undef TARGET_ASM_NAMED_SECTION
425 #define TARGET_ASM_NAMED_SECTION sco_asm_named_section
426
427 #undef ASM_OUTPUT_SKIP
428 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
429 do { \
430 if (TARGET_ELF) \
431 fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (SIZE)); \
432 else \
433 fprintf ((FILE), "%s.,.+%u\n", SET_ASM_OP, (SIZE)); \
434 } while (0)
435
436
437 #undef CTOR_LIST_BEGIN
438 #define CTOR_LIST_BEGIN \
439 do { \
440 asm (CTORS_SECTION_ASM_OP); \
441 if (TARGET_ELF) \
442 STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }; \
443 else \
444 asm ("pushl $0"); \
445 } while (0)
446
447 #undef CTOR_LIST_END
448 #define CTOR_LIST_END \
449 do { \
450 if (TARGET_ELF) { \
451 asm (CTORS_SECTION_ASM_OP); \
452 STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (0) }; \
453 } else { \
454 CTOR_LIST_BEGIN; \
455 } \
456 } while (0)
457
458 #undef DBX_BLOCKS_FUNCTION_RELATIVE
459 #define DBX_BLOCKS_FUNCTION_RELATIVE 1
460
461 #undef DBX_FUNCTION_FIRST
462 #define DBX_FUNCTION_FIRST 1
463
464 #undef DBX_REGISTER_NUMBER
465 #define DBX_REGISTER_NUMBER(n) \
466 ((TARGET_ELF) ? svr4_dbx_register_map[n] : dbx_register_map[n])
467
468 #undef DWARF2_DEBUGGING_INFO
469 #undef DWARF_DEBUGGING_INFO
470 #undef SDB_DEBUGGING_INFO
471 #undef DBX_DEBUGGING_INFO
472 #undef PREFERRED_DEBUGGING_TYPE
473
474 #define DWARF2_DEBUGGING_INFO 1
475 #define DWARF_DEBUGGING_INFO 1
476 #define SDB_DEBUGGING_INFO 1
477 #define DBX_DEBUGGING_INFO 1
478 #define PREFERRED_DEBUGGING_TYPE \
479 ((TARGET_ELF) ? DWARF2_DEBUG: SDB_DEBUG)
480
481 #undef EXTRA_SECTIONS
482 #define EXTRA_SECTIONS in_const, in_init, in_fini
483
484 #undef EXTRA_SECTION_FUNCTIONS
485 #define EXTRA_SECTION_FUNCTIONS \
486 CONST_SECTION_FUNCTION \
487 INIT_SECTION_FUNCTION \
488 FINI_SECTION_FUNCTION
489
490 #undef CONST_SECTION_FUNCTION
491 #define CONST_SECTION_FUNCTION \
492 void \
493 const_section () \
494 { \
495 if (!USE_CONST_SECTION) \
496 text_section(); \
497 else if (in_section != in_const) \
498 { \
499 fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
500 in_section = in_const; \
501 } \
502 }
503
504 #undef FINI_SECTION_FUNCTION
505 #define FINI_SECTION_FUNCTION \
506 void \
507 fini_section () \
508 { \
509 if ((!TARGET_ELF) && in_section != in_fini) \
510 { \
511 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
512 in_section = in_fini; \
513 } \
514 }
515
516 #undef INIT_SECTION_FUNCTION
517 #define INIT_SECTION_FUNCTION \
518 void \
519 init_section () \
520 { \
521 if ((!TARGET_ELF) && in_section != in_init) \
522 { \
523 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
524 in_section = in_init; \
525 } \
526 }
527
528 #undef SUBTARGET_FRAME_POINTER_REQUIRED
529 #define SUBTARGET_FRAME_POINTER_REQUIRED \
530 ((TARGET_ELF) ? 0 : \
531 (current_function_calls_setjmp || current_function_calls_longjmp))
532
533 #undef JUMP_TABLES_IN_TEXT_SECTION
534 #define JUMP_TABLES_IN_TEXT_SECTION (TARGET_ELF && flag_pic)
535
536 #undef LOCAL_LABEL_PREFIX
537 #define LOCAL_LABEL_PREFIX \
538 ((TARGET_ELF) ? "" : ".")
539
540 #undef MD_EXEC_PREFIX
541 #undef MD_STARTFILE_PREFIX
542 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
543 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
544
545 #undef NON_SAVING_SETJMP
546 #define NON_SAVING_SETJMP \
547 ((TARGET_ELF) ? 0 : \
548 (current_function_calls_setjmp && current_function_calls_longjmp))
549
550 #undef NO_IMPLICIT_EXTERN_C
551 #define NO_IMPLICIT_EXTERN_C 1
552
553 /* JKJ FIXME - examine the ramifications of RETURN_IN_MEMORY and
554 RETURN_POPS_ARGS */
555
556 #undef RETURN_POPS_ARGS
557 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
558 ((TARGET_ELF) ? \
559 (ix86_return_pops_args (FUNDECL, FUNTYPE, SIZE)) : \
560 (((FUNDECL) && (TREE_CODE (FUNDECL) == IDENTIFIER_NODE)) ? 0 \
561 : (TARGET_RTD \
562 && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
563 || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
564 == void_type_node))) ? (SIZE) \
565 : 0))
566
567 #undef SELECT_SECTION
568 #define SELECT_SECTION(DECL,RELOC,ALIGN) \
569 { \
570 if (TARGET_ELF && flag_pic && RELOC) \
571 data_section (); \
572 else if (TREE_CODE (DECL) == STRING_CST) \
573 { \
574 if (! flag_writable_strings) \
575 const_section (); \
576 else \
577 data_section (); \
578 } \
579 else if (TREE_CODE (DECL) == VAR_DECL) \
580 { \
581 if (! DECL_READONLY_SECTION (DECL, RELOC)) \
582 data_section (); \
583 else \
584 const_section (); \
585 } \
586 else \
587 const_section (); \
588 }
589
590 #undef SWITCH_TAKES_ARG
591 #define SWITCH_TAKES_ARG(CHAR) \
592 (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
593 || (CHAR) == 'h' \
594 || (CHAR) == 'R' \
595 || (CHAR) == 'Y' \
596 || (CHAR) == 'z')
597
598 #undef WORD_SWITCH_TAKES_ARG
599 #define WORD_SWITCH_TAKES_ARG(STR) \
600 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
601 && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \
602 && strcmp (STR, "Tbss"))
603
604 #undef TARGET_SUBTARGET_DEFAULT
605 #define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
606
607 #undef HANDLE_SYSV_PRAGMA
608 #define HANDLE_SYSV_PRAGMA 1
609
610 /* Though OpenServer supports .weak in COFF, we don't use it.
611 * G++ will frequently emit a symol as .weak and then (in the same .s
612 * file) declare it global. The COFF assembler finds this unamusing.
613 */
614 #define SUPPORTS_WEAK (TARGET_ELF)
615 #define ASM_WEAKEN_LABEL(FILE,NAME) \
616 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
617 fputc ('\n', FILE); } while (0)
618
619 #undef SCCS_DIRECTIVE
620 #define SCCS_DIRECTIVE 1
621
622 /*
623 * Define sizes and types
624 */
625 #undef SIZE_TYPE
626 #undef PTRDIFF_TYPE
627 #undef WCHAR_TYPE
628 #undef WCHAR_TYPE_SIZE
629 #undef LONG_DOUBLE_TYPE_SIZE
630 #define LONG_DOUBLE_TYPE_SIZE 96
631 #define SIZE_TYPE "unsigned int"
632 #define PTRDIFF_TYPE "int"
633 #define WCHAR_TYPE "long int"
634 #define WCHAR_TYPE_SIZE BITS_PER_WORD
635
636 /*
637 * New for multilib support. Set the default switches for multilib,
638 * which is -melf.
639 */
640 #define MULTILIB_DEFAULTS { "melf" }
641
642 \f
643 /* Please note that these specs may look messy but they are required in
644 order to emulate the SCO Development system as closely as possible.
645 With SCO Open Server 5.0, you now get the linker and assembler free,
646 so that is what these specs are targeted for. These utilities are
647 very argument sensitive: a space in the wrong place breaks everything.
648 So RMS, please forgive this mess. It works.
649
650 Parameters which can be passed to gcc, and their SCO equivalents:
651 GCC Parameter SCO Equivalent
652 -ansi -a ansi
653 -posix -a posix
654 -Xpg4 -a xpg4
655 -Xpg4plus -a xpg4plus
656 -Xods30 -a ods30
657
658 As with SCO, the default is XPG4 plus mode. SCO also allows you to
659 specify a C dialect with -Xt, -Xa, -Xc, -Xk and -Xm. These are passed
660 on to the assembler and linker in the same way that the SCO compiler
661 does.
662
663 SCO also allows you to compile, link and generate either ELF or COFF
664 binaries. With gcc, unlike the SCO compiler, the default is ELF.
665 Specify -mcoff to gcc to produce COFF binaries. -fpic will get the
666 assembler and linker to produce PIC code.
667 */
668
669 /* Set up assembler flags for PIC and ELF compilations */
670 #undef ASM_SPEC
671
672 #if USE_GAS
673 /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c
674 * Undef MD_EXEC_PREFIX becuase we don't know where GAS is, but it's not
675 * likely in /usr/ccs/bin/
676 */
677 #undef MD_EXEC_PREFIX
678 #else
679
680 #define ASM_SPEC \
681 "-b %{!mcoff:elf}%{mcoff:coff \
682 %{static:%e-static not valid with -mcoff} \
683 %{shared:%e-shared not valid with -mcoff} \
684 %{symbolic:%e-symbolic not valid with -mcoff}} \
685 %{Ym,*} %{Yd,*} %{Wa,*:%*} \
686 %{!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}}"
687 #endif
688
689 /* Use crt1.o as a startup file and crtn.o as a closing file. */
690
691 #undef STARTFILE_SPEC
692 #define STARTFILE_SPEC \
693 "%{shared: %{!mcoff: crti.o%s}} \
694 %{!shared:\
695 %{!symbolic: \
696 %{pg:gcrt.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}} \
697 %{ansi:values-Xc.o%s} \
698 %{!ansi: \
699 %{traditional:values-Xt.o%s} \
700 %{!traditional: \
701 %{Xa:values-Xa.o%s} \
702 %{!Xa:%{Xc:values-Xc.o%s} \
703 %{!Xc:%{Xk:values-Xk.o%s} \
704 %{!Xk:%{Xt:values-Xt.o%s} \
705 %{!Xt:values-Xa.o%s}}}}}} \
706 %{mcoff:crtbeginS.o%s} %{!mcoff:crtbegin.o%s}"
707
708 #undef ENDFILE_SPEC
709 #define ENDFILE_SPEC \
710 "%{!mcoff:crtend.o%s} \
711 %{mcoff:crtendS.o%s} \
712 %{pg:gcrtn.o%s}%{!pg:crtn.o%s}"
713
714 #undef CPP_PREDEFINES
715 #define CPP_PREDEFINES \
716 "-Asystem=svr3"
717
718 /* You are in a maze of GCC specs ... all alike */
719
720 #undef CPP_SPEC
721 #define CPP_SPEC "%(cpp_cpu) \
722 %{fpic:%{mcoff:%e-fpic is not valid with -mcoff}} \
723 %{fPIC:%{mcoff:%e-fPIC is not valid with -mcoff}} \
724 -D__i386 -D__unix -D_SCO_DS=1 -D_M_I386 -D_M_XENIX -D_M_UNIX \
725 %{!Xods30:-D_STRICT_NAMES} \
726 %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \
727 %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi -D_STRICT_ANSI} \
728 %{!ansi: \
729 %{posix:-isystem include/posix%s -isystem /usr/include/posix \
730 -D_POSIX_C_SOURCE=2 -D_POSIX_SOURCE=1} \
731 %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \
732 -D_XOPEN_SOURCE=1} \
733 %{!Xpg4:-D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT \
734 -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII \
735 -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX \
736 %{Xods30:-isystem include/ods_30_compat%s \
737 -isystem /usr/include/ods_30_compat \
738 -D_SCO_ODS_30 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \
739 -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \
740 -DM_WORDSWAP}}}} \
741 %{scointl:-DM_INTERNAT -D_M_INTERNAT} \
742 %{traditional:-D_KR -D_SVID -D_NO_PROTOTYPE} \
743 %{!mcoff:-D_SCO_ELF} \
744 %{mcoff:-D_M_COFF -D_SCO_COFF} \
745 %{!mcoff:%{fpic:-D__PIC__ -D__pic__} \
746 %{fPIC:%{!fpic:-D__PIC__ -D__pic__}}} \
747 %{Xa:-D_SCO_C_DIALECT=1} \
748 %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \
749 %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \
750 %{!Xk:%{Xt:-D_SCO_C_DIALECT=2} \
751 %{!Xt:-D_SCO_C_DIALECT=1}}}} \
752 %{traditional:-traditional -D_KR -D_NO_PROTOTYPE}"
753
754 #undef LINK_SPEC
755 #define LINK_SPEC \
756 "-b %{!mcoff:elf}%{mcoff:coff \
757 %{static:%e-static not valid with -mcoff} \
758 %{shared:%e-shared not valid with -mcoff} \
759 %{symbolic:%e-symbolic not valid with -mcoff} \
760 %{fpic:%e-fpic not valid with -mcoff} \
761 %{fPIC:%e-fPIC not valid with -mcoff}} \
762 -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} \
763 %{Wl,*%*} %{YP,*} %{YL,*} %{YU,*} \
764 %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \
765 %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \
766 %{h*} %{static:-dn -Bstatic} %{shared:-G -dy %{!z*:-z text}} \
767 %{symbolic:-Bsymbolic -G -dy %{!z*:-z text}} %{z*} %{R*} %{Y*} \
768 %{G:-G} %{!mcoff:%{Qn:} %{!Qy:-Qn}}"
769
770 /* The SCO COFF linker gets confused on the difference between "-ofoo"
771 and "-o foo". So we just always force a single space. */
772
773 #define SWITCHES_NEED_SPACES "o"
774
775 /* Library spec. If we are not building a shared library, provide the
776 standard libraries, as per the SCO compiler. */
777
778 #undef LIB_SPEC
779 #define LIB_SPEC \
780 "%{shared:pic/libgcc.a%s}%{!shared:%{!symbolic:-lcrypt -lgen -lc}}"
781
782 #undef LIBGCC_SPEC
783 #define LIBGCC_SPEC \
784 "%{!shared:-lgcc}"
785
786 #define MASK_COFF 010000000000 /* Mask for elf generation */
787 #define TARGET_COFF (target_flags & MASK_COFF)
788 #define TARGET_ELF (1) /* (!(target_flags & MASK_COFF)) */
789
790 #undef SUBTARGET_SWITCHES
791 #define SUBTARGET_SWITCHES \
792 { "elf", -MASK_COFF, N_("Generate ELF output") },
793
794 #define NO_DOLLAR_IN_LABEL
795
796 /* Implicit library calls should use memcpy, not bcopy, etc. They are
797 faster on OpenServer libraries. */
798
799 #define TARGET_MEM_FUNCTIONS
800
801 /* Biggest alignment supported by the object file format of this
802 machine. Use this macro to limit the alignment which can be
803 specified using the `__attribute__ ((aligned (N)))' construct. If
804 not defined, the default value is `BIGGEST_ALIGNMENT'. */
805
806 #define MAX_OFILE_ALIGNMENT (32768*8)
807
808 /* Define the `__builtin_va_list' type for the ABI. On OpenServer, this
809 type is `char *'. */
810 #undef BUILD_VA_LIST_TYPE
811 #define BUILD_VA_LIST_TYPE(VALIST) \
812 (VALIST) = build_pointer_type (char_type_node)
813
814
815 /*
816 Here comes some major hackery to get the crt stuff to compile properly.
817 Since we can (and do) compile for both COFF and ELF environments, we
818 set things up accordingly, based on the pre-processor defines for ELF
819 and COFF. This is insane, but then I guess having one compiler with a
820 single back-end supporting two vastly different file format types is
821 a little insane too. But it is not impossible and we get a useful
822 compiler at the end of the day. Onward we go ...
823 */
824
825 #if defined(CRT_BEGIN) || defined(CRT_END) || defined(IN_LIBGCC2)
826 # undef OBJECT_FORMAT_ELF
827 # undef INIT_SECTION_ASM_OP
828 # undef FINI_SECTION_ASM_OP
829 # undef CTORS_SECTION_ASM_OP
830 # undef DTORS_SECTION_ASM_OP
831 # undef EH_FRAME_SECTION_NAME
832 # undef CTOR_LIST_BEGIN
833 # undef CTOR_LIST_END
834 # undef DO_GLOBAL_CTORS_BODY
835
836 # if defined (_SCO_ELF)
837 # define OBJECT_FORMAT_ELF
838 # define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_ELF
839 # define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_ELF
840 # define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_ELF
841 # define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_ELF
842 # define EH_FRAME_SECTION_NAME EH_FRAME_SECTION_NAME_ELF
843 # else /* ! _SCO_ELF */
844 # define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_COFF
845 # define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_COFF
846 # define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_COFF
847 # define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_COFF
848 # define EH_FRAME_SECTION_NAME EH_FRAME_SECTION_NAME_COFF
849 # define CTOR_LIST_BEGIN asm (INIT_SECTION_ASM_OP); asm ("pushl $0")
850 # define CTOR_LIST_END CTOR_LIST_BEGIN
851 # define DO_GLOBAL_CTORS_BODY \
852 do { \
853 func_ptr *p, *beg = alloca(0); \
854 for (p = beg; *p;) \
855 (*p++) (); \
856 } while (0)
857 # endif /* ! _SCO_ELF */
858 #endif /* CRT_BEGIN !! CRT_END */
859
860 /* Handle special EH pointer encodings. Absolute, pc-relative, and
861 indirect are handled automatically. */
862 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
863 do { \
864 if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \
865 { \
866 fputs (UNALIGNED_INT_ASM_OP, FILE); \
867 assemble_name (FILE, XSTR (ADDR, 0)); \
868 fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
869 goto DONE; \
870 } \
871 } while (0)
872
873 /* Used by crtstuff.c to initialize the base of data-relative relocations.
874 These are GOT relative on x86, so return the pic register. */
875 #ifdef __PIC__
876 #define CRT_GET_RFIB_DATA(BASE) \
877 { \
878 register void *ebx_ __asm__("ebx"); \
879 BASE = ebx_; \
880 }
881 #else
882 #define CRT_GET_RFIB_DATA(BASE) \
883 __asm__ ("call\t.LPR%=\n" \
884 ".LPR%=:\n\t" \
885 "popl\t%0\n\t" \
886 /* Due to a GAS bug, this cannot use EAX. That encodes \
887 smaller than the traditional EBX, which results in the \
888 offset being off by one. */ \
889 "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \
890 : "=d"(BASE))
891 #endif
892
893 /* Select a format to encode pointers in exception handling data. CODE
894 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
895 true if the symbol may be affected by dynamic relocations. */
896 #undef ASM_PREFERRED_EH_DATA_FORMAT
897 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
898 (flag_pic ? (GLOBAL ? DW_EH_PE_indirect : 0) | DW_EH_PE_datarel \
899 : DW_EH_PE_absptr)