sco5.h revision 96263
1260684Skaiw/* Definitions for Intel 386 running SCO Unix System V 3.2 Version 5. 2260684Skaiw Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000 3260684Skaiw Free Software Foundation, Inc. 4260684Skaiw Contributed by Kean Johnston (hug@netcom.com) 5260684Skaiw 6260684SkaiwThis file is part of GNU CC. 7260684Skaiw 8260684SkaiwGNU CC is free software; you can redistribute it and/or modify 9260684Skaiwit under the terms of the GNU General Public License as published by 10260684Skaiwthe Free Software Foundation; either version 2, or (at your option) 11260684Skaiwany later version. 12260684Skaiw 13260684SkaiwGNU CC is distributed in the hope that it will be useful, 14260684Skaiwbut WITHOUT ANY WARRANTY; without even the implied warranty of 15260684SkaiwMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16260684SkaiwGNU General Public License for more details. 17260684Skaiw 18260684SkaiwYou should have received a copy of the GNU General Public License 19260684Skaiwalong with GNU CC; see the file COPYING. If not, write to 20260684Skaiwthe Free Software Foundation, 59 Temple Place - Suite 330, 21260684SkaiwBoston, MA 02111-1307, USA. */ 22260684Skaiw 23260684Skaiw#undef TARGET_VERSION 24260684Skaiw#define TARGET_VERSION fprintf (stderr, " (i386, SCO OpenServer 5 Syntax)"); 25260684Skaiw 26260684Skaiw#undef LPREFIX 27260684Skaiw#define LPREFIX ".L" 28260684Skaiw 29260684Skaiw#undef ALIGN_ASM_OP 30260684Skaiw#define ALIGN_ASM_OP "\t.align\t" 31260684Skaiw 32260684Skaiw#undef ASCII_DATA_ASM_OP 33260684Skaiw#define ASCII_DATA_ASM_OP "\t.ascii\t" 34260684Skaiw 35260684Skaiw#undef IDENT_ASM_OP 36260684Skaiw#define IDENT_ASM_OP "\t.ident\t" 37260684Skaiw 38260684Skaiw#undef COMMON_ASM_OP 39260684Skaiw#define COMMON_ASM_OP "\t.comm\t" 40260684Skaiw 41260684Skaiw#undef SET_ASM_OP 42260684Skaiw#define SET_ASM_OP "\t.set\t" 43260684Skaiw 44260684Skaiw#undef LOCAL_ASM_OP 45260684Skaiw#define LOCAL_ASM_OP "\t.local\t" 46260684Skaiw 47260684Skaiw#undef ASM_SHORT 48260684Skaiw#define ASM_SHORT "\t.value\t" 49260684Skaiw 50260684Skaiw#undef ASM_LONG 51260684Skaiw#define ASM_LONG "\t.long\t" 52260684Skaiw 53260684Skaiw#undef ASM_QUAD 54260684Skaiw 55260684Skaiw#undef TYPE_ASM_OP 56260684Skaiw#define TYPE_ASM_OP "\t.type\t" 57260684Skaiw 58260684Skaiw#undef SIZE_ASM_OP 59260684Skaiw#define SIZE_ASM_OP "\t.size\t" 60260684Skaiw 61260684Skaiw#undef STRING_ASM_OP 62260684Skaiw#define STRING_ASM_OP "\t.string\t" 63260684Skaiw 64260684Skaiw#undef SKIP_ASM_OP 65260684Skaiw#define SKIP_ASM_OP "\t.zero\t" 66260684Skaiw 67260684Skaiw#undef GLOBAL_ASM_OP 68260684Skaiw#define GLOBAL_ASM_OP "\t.globl\t" 69260684Skaiw 70260684Skaiw#undef EH_FRAME_SECTION_ASM_OP 71260684Skaiw#define EH_FRAME_SECTION_NAME_COFF ".ehfram" 72260684Skaiw#define EH_FRAME_SECTION_NAME_ELF ".eh_frame" 73260684Skaiw#define EH_FRAME_SECTION_NAME \ 74260684Skaiw ((TARGET_ELF) ? EH_FRAME_SECTION_NAME_ELF : EH_FRAME_SECTION_NAME_COFF) 75260684Skaiw 76260684Skaiw/* Avoid problems (long sectino names, forward assembler refs) with DWARF 77260684Skaiw exception unwinding when we're generating COFF */ 78260684Skaiw#define DWARF2_UNWIND_INFO \ 79260684Skaiw ((TARGET_ELF) ? 1 : 0 ) 80260684Skaiw 81260684Skaiw#undef CONST_SECTION_ASM_OP 82260684Skaiw#define CONST_SECTION_ASM_OP_COFF "\t.section\t.rodata, \"x\"" 83260684Skaiw#define CONST_SECTION_ASM_OP_ELF "\t.section\t.rodata" 84260684Skaiw#define CONST_SECTION_ASM_OP \ 85260684Skaiw ((TARGET_ELF) ? CONST_SECTION_ASM_OP_ELF : CONST_SECTION_ASM_OP_COFF) 86260684Skaiw 87260684Skaiw#undef USE_CONST_SECTION 88260684Skaiw#define USE_CONST_SECTION_ELF 1 89260684Skaiw#define USE_CONST_SECTION_COFF 0 90260684Skaiw#define USE_CONST_SECTION \ 91260684Skaiw ((TARGET_ELF) ? USE_CONST_SECTION_ELF : USE_CONST_SECTION_COFF) 92260684Skaiw 93260684Skaiw#undef INIT_SECTION_ASM_OP 94260684Skaiw#define INIT_SECTION_ASM_OP_ELF "\t.section\t.init" 95260684Skaiw/* Rename these for COFF because crt1.o will try to run them. */ 96260684Skaiw#define INIT_SECTION_ASM_OP_COFF "\t.section\t.ctor ,\"x\"" 97260684Skaiw#define INIT_SECTION_ASM_OP \ 98260684Skaiw ((TARGET_ELF) ? INIT_SECTION_ASM_OP_ELF : INIT_SECTION_ASM_OP_COFF) 99260684Skaiw 100260684Skaiw#undef CTORS_SECTION_ASM_OP 101260684Skaiw#define CTORS_SECTION_ASM_OP_ELF "\t.section\t.ctors,\"aw\"" 102260684Skaiw#define CTORS_SECTION_ASM_OP_COFF INIT_SECTION_ASM_OP_COFF 103260684Skaiw#define CTORS_SECTION_ASM_OP \ 104260684Skaiw ((TARGET_ELF) ? CTORS_SECTION_ASM_OP_ELF : CTORS_SECTION_ASM_OP_COFF) 105260684Skaiw 106260684Skaiw#undef DTORS_SECTION_ASM_OP 107260684Skaiw#define DTORS_SECTION_ASM_OP_ELF "\t.section\t.dtors, \"aw\"" 108260684Skaiw#define DTORS_SECTION_ASM_OP_COFF FINI_SECTION_ASM_OP_COFF 109260684Skaiw#define DTORS_SECTION_ASM_OP \ 110260684Skaiw ((TARGET_ELF) ? DTORS_SECTION_ASM_OP_ELF : DTORS_SECTION_ASM_OP_COFF) 111260684Skaiw 112260684Skaiw#undef FINI_SECTION_ASM_OP 113260684Skaiw#define FINI_SECTION_ASM_OP_ELF "\t.section\t.fini" 114260684Skaiw#define FINI_SECTION_ASM_OP_COFF "\t.section\t.dtor, \"x\"" 115260684Skaiw#define FINI_SECTION_ASM_OP \ 116260684Skaiw ((TARGET_ELF) ? FINI_SECTION_ASM_OP_ELF : FINI_SECTION_ASM_OP_COFF) 117260684Skaiw 118260684Skaiw#undef BSS_SECTION_ASM_OP 119260684Skaiw#define BSS_SECTION_ASM_OP "\t.data" 120260684Skaiw 121260684Skaiw#undef TEXT_SECTION_ASM_OP 122260684Skaiw#define TEXT_SECTION_ASM_OP "\t.text" 123260684Skaiw 124260684Skaiw#undef DATA_SECTION_ASM_OP 125260684Skaiw#define DATA_SECTION_ASM_OP "\t.data" 126260684Skaiw 127260684Skaiw#undef TYPE_OPERAND_FMT 128260684Skaiw#define TYPE_OPERAND_FMT "@%s" 129260684Skaiw 130260684Skaiw#undef APPLY_RESULT_SIZE 131260684Skaiw#define APPLY_RESULT_SIZE \ 132260684Skaiw(TARGET_ELF) ? size : 116 133260684Skaiw 134260684Skaiw#ifndef ASM_DECLARE_RESULT 135260684Skaiw#define ASM_DECLARE_RESULT(FILE, RESULT) 136260684Skaiw#endif 137260684Skaiw 138260684Skaiw#define SCO_DEFAULT_ASM_COFF(FILE,NAME) \ 139260684Skaiwdo { \ 140260684Skaiw ASM_OUTPUT_LABEL (FILE, NAME); \ 141260684Skaiw } while (0) 142260684Skaiw 143260684Skaiw#undef ASM_DECLARE_FUNCTION_NAME 144260684Skaiw#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ 145260684Skaiw do { \ 146260684Skaiw if (TARGET_ELF) { \ 147260684Skaiw fprintf (FILE, "%s", TYPE_ASM_OP); \ 148260684Skaiw assemble_name (FILE, NAME); \ 149260684Skaiw putc (',', FILE); \ 150260684Skaiw fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ 151260684Skaiw putc ('\n', FILE); \ 152260684Skaiw ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ 153260684Skaiw ASM_OUTPUT_LABEL(FILE, NAME); \ 154260684Skaiw } else \ 155260684Skaiw SCO_DEFAULT_ASM_COFF(FILE, NAME); \ 156260684Skaiw} while (0) 157260684Skaiw 158260684Skaiw#undef ASM_DECLARE_FUNCTION_SIZE 159260684Skaiw#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ 160260684Skaiw do { \ 161260684Skaiw if (TARGET_ELF) { if (!flag_inhibit_size_directive) \ 162260684Skaiw { \ 163260684Skaiw fprintf (FILE, "%s", SIZE_ASM_OP); \ 164260684Skaiw assemble_name (FILE, (FNAME)); \ 165260684Skaiw fprintf (FILE, ",.-"); \ 166260684Skaiw assemble_name (FILE, (FNAME)); \ 167260684Skaiw putc ('\n', FILE); \ 168260684Skaiw } } \ 169260684Skaiw } while (0) 170260684Skaiw 171260684Skaiw#undef ASM_DECLARE_OBJECT_NAME 172260684Skaiw#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ 173260684Skaiw do { \ 174260684Skaiw if (TARGET_ELF) { \ 175260684Skaiw fprintf (FILE, "%s", TYPE_ASM_OP); \ 176260684Skaiw assemble_name (FILE, NAME); \ 177260684Skaiw putc (',', FILE); \ 178260684Skaiw fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ 179260684Skaiw putc ('\n', FILE); \ 180260684Skaiw size_directive_output = 0; \ 181260684Skaiw if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ 182260684Skaiw { \ 183260684Skaiw size_directive_output = 1; \ 184260684Skaiw fprintf (FILE, "%s", SIZE_ASM_OP); \ 185260684Skaiw assemble_name (FILE, NAME); \ 186260684Skaiw fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ 187260684Skaiw } \ 188260684Skaiw ASM_OUTPUT_LABEL(FILE, NAME); \ 189260684Skaiw } else \ 190260684Skaiw SCO_DEFAULT_ASM_COFF(FILE, NAME); \ 191260684Skaiw } while (0) 192260684Skaiw 193260684Skaiw#undef ASM_FILE_START_1 194260684Skaiw#define ASM_FILE_START_1(FILE) 195260684Skaiw 196#undef ASM_FILE_START 197#define ASM_FILE_START(FILE) \ 198do { \ 199 output_file_directive((FILE),main_input_filename); \ 200 fprintf ((FILE), "\t.version\t\"01.01\"\n"); \ 201} while (0) 202 203#undef ASM_FINISH_DECLARE_OBJECT 204#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ 205do { \ 206 if (TARGET_ELF) { \ 207 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ 208 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ 209 && ! AT_END && TOP_LEVEL \ 210 && DECL_INITIAL (DECL) == error_mark_node \ 211 && !size_directive_output) \ 212 { \ 213 size_directive_output = 1; \ 214 fprintf (FILE, "%s", SIZE_ASM_OP); \ 215 assemble_name (FILE, name); \ 216 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ 217 } \ 218 } \ 219} while (0) 220 221#undef ASM_GENERATE_INTERNAL_LABEL 222#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ 223do { \ 224 if (TARGET_ELF) \ 225 sprintf (LABEL, "*.%s%ld", (PREFIX), (long)(NUM)); \ 226 else \ 227 sprintf (LABEL, ".%s%ld", (PREFIX), (long)(NUM)); \ 228} while (0) 229 230#undef ASM_OUTPUT_ALIGNED_COMMON 231#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ 232do { \ 233 fprintf ((FILE), "%s", COMMON_ASM_OP); \ 234 assemble_name ((FILE), (NAME)); \ 235 if (TARGET_ELF) \ 236 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ 237 else \ 238 fprintf ((FILE), ",%u\n", (SIZE)); \ 239} while (0) 240 241#undef ASM_OUTPUT_ALIGNED_LOCAL 242#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ 243do { \ 244 if (TARGET_ELF) { \ 245 fprintf ((FILE), "%s", LOCAL_ASM_OP); \ 246 assemble_name ((FILE), (NAME)); \ 247 fprintf ((FILE), "\n"); \ 248 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ 249 } else { \ 250 int align = exact_log2 (ALIGN); \ 251 if (align > 2) align = 2; \ 252 if (TARGET_SVR3_SHLIB) \ 253 data_section (); \ 254 else \ 255 bss_section (); \ 256 ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \ 257 fprintf ((FILE), "%s\t", "\t.lcomm"); \ 258 assemble_name ((FILE), (NAME)); \ 259 fprintf ((FILE), ",%u\n", (SIZE)); \ 260 } \ 261} while (0) 262 263/* A C statement (sans semicolon) to output to the stdio stream 264 FILE the assembler definition of uninitialized global DECL named 265 NAME whose size is SIZE bytes and alignment is ALIGN bytes. 266 Try to use asm_output_aligned_bss to implement this macro. */ 267 268#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ 269asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) 270 271#undef ESCAPES 272#define ESCAPES \ 273"\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\ 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\ 276\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\ 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\ 280\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" 281 282#undef STRING_LIMIT 283#define STRING_LIMIT ((unsigned) 256) 284 285#undef ASM_OUTPUT_LIMITED_STRING 286#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ 287 do \ 288 { \ 289 register const unsigned char *_limited_str = \ 290 (const unsigned char *) (STR); \ 291 register unsigned ch; \ 292 fprintf ((FILE), "%s\"", STRING_ASM_OP); \ 293 for (; (ch = *_limited_str); _limited_str++) \ 294 { \ 295 register int escape; \ 296 switch (escape = ESCAPES[ch]) \ 297 { \ 298 case 0: \ 299 putc (ch, (FILE)); \ 300 break; \ 301 case 1: \ 302 fprintf ((FILE), "\\%03o", ch); \ 303 break; \ 304 default: \ 305 putc ('\\', (FILE)); \ 306 putc (escape, (FILE)); \ 307 break; \ 308 } \ 309 } \ 310 fprintf ((FILE), "\"\n"); \ 311 } \ 312 while (0) 313 314 315#undef ASM_OUTPUT_ASCII 316#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ 317do { \ 318 register const unsigned char *_ascii_bytes = \ 319 (const unsigned char *) (STR); \ 320 register const unsigned char *limit = _ascii_bytes + (LENGTH); \ 321 register unsigned bytes_in_chunk = 0; \ 322 for (; _ascii_bytes < limit; _ascii_bytes++) \ 323 { \ 324 register unsigned const char *p; \ 325 if (bytes_in_chunk >= 64) \ 326 { \ 327 fputc ('\n', (FILE)); \ 328 bytes_in_chunk = 0; \ 329 } \ 330 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \ 331 continue; \ 332 if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT) \ 333 { \ 334 if (bytes_in_chunk > 0) \ 335 { \ 336 fputc ('\n', (FILE)); \ 337 bytes_in_chunk = 0; \ 338 } \ 339 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \ 340 _ascii_bytes = p; \ 341 } \ 342 else \ 343 { \ 344 if (bytes_in_chunk == 0) \ 345 fputs ("\t.byte\t", (FILE)); \ 346 else \ 347 fputc (',', (FILE)); \ 348 fprintf ((FILE), "0x%02x", *_ascii_bytes); \ 349 bytes_in_chunk += 5; \ 350 } \ 351 } \ 352 if (bytes_in_chunk > 0) \ 353 fprintf ((FILE), "\n"); \ 354} while (0) 355 356/* Must use data section for relocatable constants when pic. */ 357#undef SELECT_RTX_SECTION 358#define SELECT_RTX_SECTION(MODE,RTX,ALIGN) \ 359{ \ 360 if (TARGET_ELF) { \ 361 if (flag_pic && symbolic_operand (RTX, VOIDmode)) \ 362 data_section (); \ 363 else \ 364 const_section (); \ 365 } else \ 366 readonly_data_section(); \ 367} 368 369#undef ASM_OUTPUT_CASE_LABEL 370#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \ 371do { \ 372 if (TARGET_ELF) \ 373 ASM_OUTPUT_ALIGN ((FILE), 2); \ 374 ASM_OUTPUT_INTERNAL_LABEL((FILE),(PREFIX),(NUM)); \ 375} while (0) 376 377#undef ASM_OUTPUT_IDENT 378#define ASM_OUTPUT_IDENT(FILE, NAME) \ 379 fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME); 380 381#undef ASM_GLOBALIZE_LABEL 382#define ASM_GLOBALIZE_LABEL(FILE,NAME) \ 383 (fprintf ((FILE), "%s", GLOBAL_ASM_OP), assemble_name (FILE, NAME), fputs ("\n", FILE)) 384 385#undef ASM_OUTPUT_EXTERNAL_LIBCALL 386#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ 387 if (TARGET_ELF) ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0)) 388 389#undef ASM_OUTPUT_INTERNAL_LABEL 390#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ 391 fprintf (FILE, ".%s%d:\n", PREFIX, NUM) 392 393/* The prefix to add to user-visible assembler symbols. */ 394 395#undef USER_LABEL_PREFIX 396#define USER_LABEL_PREFIX "" 397 398/* 399 * We rename 'gcc_except_table' to the shorter name in preparation 400 * for the day when we're ready to do DWARF2 eh unwinding under COFF. 401 */ 402/* #define EXCEPTION_SECTION() named_section (NULL, ".gccexc", 1) */ 403 404/* Switch into a generic section. */ 405#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section 406 407#undef ASM_OUTPUT_SKIP 408#define ASM_OUTPUT_SKIP(FILE,SIZE) \ 409do { \ 410 if (TARGET_ELF) \ 411 fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (SIZE)); \ 412 else \ 413 fprintf ((FILE), "%s.,.+%u\n", SET_ASM_OP, (SIZE)); \ 414} while (0) 415 416 417#undef CTOR_LIST_BEGIN 418#define CTOR_LIST_BEGIN \ 419do { \ 420 asm (CTORS_SECTION_ASM_OP); \ 421 if (TARGET_ELF) \ 422 STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }; \ 423 else \ 424 asm ("pushl $0"); \ 425} while (0) 426 427#undef CTOR_LIST_END 428#define CTOR_LIST_END \ 429do { \ 430 if (TARGET_ELF) { \ 431 asm (CTORS_SECTION_ASM_OP); \ 432 STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (0) }; \ 433 } else { \ 434 CTOR_LIST_BEGIN; \ 435 } \ 436} while (0) 437 438#undef DBX_BLOCKS_FUNCTION_RELATIVE 439#define DBX_BLOCKS_FUNCTION_RELATIVE 1 440 441#undef DBX_FUNCTION_FIRST 442#define DBX_FUNCTION_FIRST 1 443 444#undef DBX_REGISTER_NUMBER 445#define DBX_REGISTER_NUMBER(n) \ 446 ((TARGET_ELF) ? svr4_dbx_register_map[n] : dbx_register_map[n]) 447 448#undef DWARF2_DEBUGGING_INFO 449#undef DWARF_DEBUGGING_INFO 450#undef SDB_DEBUGGING_INFO 451#undef DBX_DEBUGGING_INFO 452#undef PREFERRED_DEBUGGING_TYPE 453 454#define DWARF2_DEBUGGING_INFO 1 455#define DWARF_DEBUGGING_INFO 1 456#define SDB_DEBUGGING_INFO 1 457#define DBX_DEBUGGING_INFO 1 458#define PREFERRED_DEBUGGING_TYPE \ 459 ((TARGET_ELF) ? DWARF2_DEBUG: SDB_DEBUG) 460 461#undef EXTRA_SECTIONS 462#define EXTRA_SECTIONS in_const, in_init, in_fini 463 464#undef EXTRA_SECTION_FUNCTIONS 465#define EXTRA_SECTION_FUNCTIONS \ 466 CONST_SECTION_FUNCTION \ 467 INIT_SECTION_FUNCTION \ 468 FINI_SECTION_FUNCTION 469 470#undef CONST_SECTION_FUNCTION 471#define CONST_SECTION_FUNCTION \ 472void \ 473const_section () \ 474{ \ 475 if (!USE_CONST_SECTION) \ 476 text_section(); \ 477 else if (in_section != in_const) \ 478 { \ 479 fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ 480 in_section = in_const; \ 481 } \ 482} 483 484#undef FINI_SECTION_FUNCTION 485#define FINI_SECTION_FUNCTION \ 486void \ 487fini_section () \ 488{ \ 489 if ((!TARGET_ELF) && in_section != in_fini) \ 490 { \ 491 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \ 492 in_section = in_fini; \ 493 } \ 494} 495 496#undef INIT_SECTION_FUNCTION 497#define INIT_SECTION_FUNCTION \ 498void \ 499init_section () \ 500{ \ 501 if ((!TARGET_ELF) && in_section != in_init) \ 502 { \ 503 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \ 504 in_section = in_init; \ 505 } \ 506} 507 508#undef SUBTARGET_FRAME_POINTER_REQUIRED 509#define SUBTARGET_FRAME_POINTER_REQUIRED \ 510 ((TARGET_ELF) ? 0 : \ 511 (current_function_calls_setjmp || current_function_calls_longjmp)) 512 513#undef LOCAL_LABEL_PREFIX 514#define LOCAL_LABEL_PREFIX \ 515 ((TARGET_ELF) ? "" : ".") 516 517#undef MD_EXEC_PREFIX 518#undef MD_STARTFILE_PREFIX 519#define MD_EXEC_PREFIX "/usr/ccs/bin/" 520#define MD_STARTFILE_PREFIX "/usr/ccs/lib/" 521 522#undef NON_SAVING_SETJMP 523#define NON_SAVING_SETJMP \ 524 ((TARGET_ELF) ? 0 : \ 525 (current_function_calls_setjmp && current_function_calls_longjmp)) 526 527#undef NO_IMPLICIT_EXTERN_C 528#define NO_IMPLICIT_EXTERN_C 1 529 530/* JKJ FIXME - examine the ramifications of RETURN_IN_MEMORY and 531 RETURN_POPS_ARGS */ 532 533#undef RETURN_POPS_ARGS 534#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \ 535 ((TARGET_ELF) ? \ 536 (ix86_return_pops_args (FUNDECL, FUNTYPE, SIZE)) : \ 537 (((FUNDECL) && (TREE_CODE (FUNDECL) == IDENTIFIER_NODE)) ? 0 \ 538 : (TARGET_RTD \ 539 && (TYPE_ARG_TYPES (FUNTYPE) == 0 \ 540 || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \ 541 == void_type_node))) ? (SIZE) \ 542 : 0)) 543 544#undef SELECT_SECTION 545#define SELECT_SECTION(DECL,RELOC,ALIGN) \ 546{ \ 547 if (TARGET_ELF && flag_pic && RELOC) \ 548 data_section (); \ 549 else if (TREE_CODE (DECL) == STRING_CST) \ 550 { \ 551 if (! flag_writable_strings) \ 552 const_section (); \ 553 else \ 554 data_section (); \ 555 } \ 556 else if (TREE_CODE (DECL) == VAR_DECL) \ 557 { \ 558 if (! DECL_READONLY_SECTION (DECL, RELOC)) \ 559 data_section (); \ 560 else \ 561 const_section (); \ 562 } \ 563 else \ 564 const_section (); \ 565} 566 567#undef SWITCH_TAKES_ARG 568#define SWITCH_TAKES_ARG(CHAR) \ 569 (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ 570 || (CHAR) == 'h' \ 571 || (CHAR) == 'R' \ 572 || (CHAR) == 'Y' \ 573 || (CHAR) == 'z') 574 575#undef WORD_SWITCH_TAKES_ARG 576#define WORD_SWITCH_TAKES_ARG(STR) \ 577 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ 578 && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \ 579 && strcmp (STR, "Tbss")) 580 581#undef TARGET_SUBTARGET_DEFAULT 582#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS) 583 584#undef HANDLE_SYSV_PRAGMA 585#define HANDLE_SYSV_PRAGMA 1 586 587/* Though OpenServer supports .weak in COFF, we don't use it. 588 * G++ will frequently emit a symol as .weak and then (in the same .s 589 * file) declare it global. The COFF assembler finds this unamusing. 590 */ 591#define SUPPORTS_WEAK (TARGET_ELF) 592#define ASM_WEAKEN_LABEL(FILE,NAME) \ 593 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ 594 fputc ('\n', FILE); } while (0) 595 596#undef SCCS_DIRECTIVE 597#define SCCS_DIRECTIVE 1 598 599/* 600 * Define sizes and types 601 */ 602#undef SIZE_TYPE 603#undef PTRDIFF_TYPE 604#undef WCHAR_TYPE 605#undef WCHAR_TYPE_SIZE 606#undef LONG_DOUBLE_TYPE_SIZE 607#define LONG_DOUBLE_TYPE_SIZE 96 608#define SIZE_TYPE "unsigned int" 609#define PTRDIFF_TYPE "int" 610#define WCHAR_TYPE "long int" 611#define WCHAR_TYPE_SIZE BITS_PER_WORD 612 613/* 614 * New for multilib support. Set the default switches for multilib, 615 * which is -melf. 616 */ 617#define MULTILIB_DEFAULTS { "melf" } 618 619 620/* Please note that these specs may look messy but they are required in 621 order to emulate the SCO Development system as closely as possible. 622 With SCO Open Server 5.0, you now get the linker and assembler free, 623 so that is what these specs are targeted for. These utilities are 624 very argument sensitive: a space in the wrong place breaks everything. 625 So RMS, please forgive this mess. It works. 626 627 Parameters which can be passed to gcc, and their SCO equivalents: 628 GCC Parameter SCO Equivalent 629 -ansi -a ansi 630 -posix -a posix 631 -Xpg4 -a xpg4 632 -Xpg4plus -a xpg4plus 633 -Xods30 -a ods30 634 635 As with SCO, the default is XPG4 plus mode. SCO also allows you to 636 specify a C dialect with -Xt, -Xa, -Xc, -Xk and -Xm. These are passed 637 on to the assembler and linker in the same way that the SCO compiler 638 does. 639 640 SCO also allows you to compile, link and generate either ELF or COFF 641 binaries. With gcc, unlike the SCO compiler, the default is ELF. 642 Specify -mcoff to gcc to produce COFF binaries. -fpic will get the 643 assembler and linker to produce PIC code. 644*/ 645 646/* Set up assembler flags for PIC and ELF compilations */ 647#undef ASM_SPEC 648 649#if USE_GAS 650 /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c 651 * Undef MD_EXEC_PREFIX because we don't know where GAS is, but it's not 652 * likely in /usr/ccs/bin/ 653 */ 654#undef MD_EXEC_PREFIX 655#else 656 657#define ASM_SPEC \ 658 "-b %{!mcoff:elf}%{mcoff:coff \ 659 %{static:%e-static not valid with -mcoff} \ 660 %{shared:%e-shared not valid with -mcoff} \ 661 %{symbolic:%e-symbolic not valid with -mcoff}} \ 662 %{Ym,*} %{Yd,*} %{Wa,*:%*} \ 663 %{!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}}" 664#endif 665 666/* Use crt1.o as a startup file and crtn.o as a closing file. */ 667 668#undef STARTFILE_SPEC 669#define STARTFILE_SPEC \ 670 "%{shared: %{!mcoff: crti.o%s}} \ 671 %{!shared:\ 672 %{!symbolic: \ 673 %{pg:gcrt.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}} \ 674 %{ansi:values-Xc.o%s} \ 675 %{!ansi: \ 676 %{traditional:values-Xt.o%s} \ 677 %{!traditional: \ 678 %{Xa:values-Xa.o%s} \ 679 %{!Xa:%{Xc:values-Xc.o%s} \ 680 %{!Xc:%{Xk:values-Xk.o%s} \ 681 %{!Xk:%{Xt:values-Xt.o%s} \ 682 %{!Xt:values-Xa.o%s}}}}}} \ 683 %{mcoff:crtbeginS.o%s} %{!mcoff:crtbegin.o%s}" 684 685#undef ENDFILE_SPEC 686#define ENDFILE_SPEC \ 687 "%{!mcoff:crtend.o%s} \ 688 %{mcoff:crtendS.o%s} \ 689 %{pg:gcrtn.o%s}%{!pg:crtn.o%s}" 690 691#undef CPP_PREDEFINES 692#define CPP_PREDEFINES \ 693 "-Asystem=svr3" 694 695/* You are in a maze of GCC specs ... all alike */ 696 697#undef CPP_SPEC 698#define CPP_SPEC "%(cpp_cpu) \ 699 %{fpic:%{mcoff:%e-fpic is not valid with -mcoff}} \ 700 %{fPIC:%{mcoff:%e-fPIC is not valid with -mcoff}} \ 701 -D__i386 -D__unix -D_SCO_DS=1 -D_M_I386 -D_M_XENIX -D_M_UNIX \ 702 %{!Xods30:-D_STRICT_NAMES} \ 703 %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \ 704 %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi -D_STRICT_ANSI} \ 705 %{!ansi: \ 706 %{posix:-isystem include/posix%s -isystem /usr/include/posix \ 707 -D_POSIX_C_SOURCE=2 -D_POSIX_SOURCE=1} \ 708 %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \ 709 -D_XOPEN_SOURCE=1} \ 710 %{!Xpg4:-D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT \ 711 -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII \ 712 -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX \ 713 %{Xods30:-isystem include/ods_30_compat%s \ 714 -isystem /usr/include/ods_30_compat \ 715 -D_SCO_ODS_30 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \ 716 -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \ 717 -DM_WORDSWAP}}}} \ 718 %{scointl:-DM_INTERNAT -D_M_INTERNAT} \ 719 %{traditional:-D_KR -D_SVID -D_NO_PROTOTYPE} \ 720 %{!mcoff:-D_SCO_ELF} \ 721 %{mcoff:-D_M_COFF -D_SCO_COFF} \ 722 %{!mcoff:%{fpic:-D__PIC__ -D__pic__} \ 723 %{fPIC:%{!fpic:-D__PIC__ -D__pic__}}} \ 724 %{Xa:-D_SCO_C_DIALECT=1} \ 725 %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \ 726 %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \ 727 %{!Xk:%{Xt:-D_SCO_C_DIALECT=2} \ 728 %{!Xt:-D_SCO_C_DIALECT=1}}}} \ 729 %{traditional:-traditional -D_KR -D_NO_PROTOTYPE}" 730 731#undef LINK_SPEC 732#define LINK_SPEC \ 733 "-b %{!mcoff:elf}%{mcoff:coff \ 734 %{static:%e-static not valid with -mcoff} \ 735 %{shared:%e-shared not valid with -mcoff} \ 736 %{symbolic:%e-symbolic not valid with -mcoff} \ 737 %{fpic:%e-fpic not valid with -mcoff} \ 738 %{fPIC:%e-fPIC not valid with -mcoff}} \ 739 -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} \ 740 %{Wl,*%*} %{YP,*} %{YL,*} %{YU,*} \ 741 %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \ 742 %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \ 743 %{h*} %{static:-dn -Bstatic} %{shared:-G -dy %{!z*:-z text}} \ 744 %{symbolic:-Bsymbolic -G -dy %{!z*:-z text}} %{z*} %{R*} %{Y*} \ 745 %{G:-G} %{!mcoff:%{Qn:} %{!Qy:-Qn}}" 746 747/* The SCO COFF linker gets confused on the difference between "-ofoo" 748 and "-o foo". So we just always force a single space. */ 749 750#define SWITCHES_NEED_SPACES "o" 751 752/* Library spec. If we are not building a shared library, provide the 753 standard libraries, as per the SCO compiler. */ 754 755#undef LIB_SPEC 756#define LIB_SPEC \ 757 "%{shared:pic/libgcc.a%s}%{!shared:%{!symbolic:-lcrypt -lgen -lc}}" 758 759#undef LIBGCC_SPEC 760#define LIBGCC_SPEC \ 761 "%{!shared:-lgcc}" 762 763#define MASK_COFF 010000000000 /* Mask for elf generation */ 764#define TARGET_ELF (1) /* (!(target_flags & MASK_COFF)) */ 765 766#undef SUBTARGET_SWITCHES 767#define SUBTARGET_SWITCHES \ 768 { "elf", -MASK_COFF, N_("Generate ELF output") }, 769 770#define NO_DOLLAR_IN_LABEL 771 772/* Implicit library calls should use memcpy, not bcopy, etc. They are 773 faster on OpenServer libraries. */ 774 775#define TARGET_MEM_FUNCTIONS 776 777/* Biggest alignment supported by the object file format of this 778 machine. Use this macro to limit the alignment which can be 779 specified using the `__attribute__ ((aligned (N)))' construct. If 780 not defined, the default value is `BIGGEST_ALIGNMENT'. */ 781 782#define MAX_OFILE_ALIGNMENT (32768*8) 783 784/* Define the `__builtin_va_list' type for the ABI. On OpenServer, this 785 type is `char *'. */ 786#undef BUILD_VA_LIST_TYPE 787#define BUILD_VA_LIST_TYPE(VALIST) \ 788 (VALIST) = build_pointer_type (char_type_node) 789 790 791/* 792Here comes some major hackery to get the crt stuff to compile properly. 793Since we can (and do) compile for both COFF and ELF environments, we 794set things up accordingly, based on the pre-processor defines for ELF 795and COFF. This is insane, but then I guess having one compiler with a 796single back-end supporting two vastly different file format types is 797a little insane too. But it is not impossible and we get a useful 798compiler at the end of the day. Onward we go ... 799*/ 800 801#if defined(CRT_BEGIN) || defined(CRT_END) || defined(IN_LIBGCC2) 802# undef OBJECT_FORMAT_ELF 803# undef INIT_SECTION_ASM_OP 804# undef FINI_SECTION_ASM_OP 805# undef CTORS_SECTION_ASM_OP 806# undef DTORS_SECTION_ASM_OP 807# undef EH_FRAME_SECTION_NAME 808# undef CTOR_LIST_BEGIN 809# undef CTOR_LIST_END 810# undef DO_GLOBAL_CTORS_BODY 811 812# if defined (_SCO_ELF) 813# define OBJECT_FORMAT_ELF 814# define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_ELF 815# define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_ELF 816# define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_ELF 817# define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_ELF 818# define EH_FRAME_SECTION_NAME EH_FRAME_SECTION_NAME_ELF 819# else /* ! _SCO_ELF */ 820# define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_COFF 821# define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_COFF 822# define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_COFF 823# define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_COFF 824# define EH_FRAME_SECTION_NAME EH_FRAME_SECTION_NAME_COFF 825# define CTOR_LIST_BEGIN asm (INIT_SECTION_ASM_OP); asm ("pushl $0") 826# define CTOR_LIST_END CTOR_LIST_BEGIN 827# define DO_GLOBAL_CTORS_BODY \ 828do { \ 829 func_ptr *p, *beg = alloca(0); \ 830 for (p = beg; *p;) \ 831 (*p++) (); \ 832} while (0) 833# endif /* ! _SCO_ELF */ 834#endif /* CRT_BEGIN !! CRT_END */ 835 836/* Handle special EH pointer encodings. Absolute, pc-relative, and 837 indirect are handled automatically. */ 838#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \ 839 do { \ 840 if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \ 841 { \ 842 fputs (ASM_LONG, FILE); \ 843 assemble_name (FILE, XSTR (ADDR, 0)); \ 844 fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \ 845 goto DONE; \ 846 } \ 847 } while (0) 848 849/* Used by crtstuff.c to initialize the base of data-relative relocations. 850 These are GOT relative on x86, so return the pic register. */ 851#ifdef __PIC__ 852#define CRT_GET_RFIB_DATA(BASE) \ 853 { \ 854 register void *ebx_ __asm__("ebx"); \ 855 BASE = ebx_; \ 856 } 857#else 858#define CRT_GET_RFIB_DATA(BASE) \ 859 __asm__ ("call\t.LPR%=\n" \ 860 ".LPR%=:\n\t" \ 861 "popl\t%0\n\t" \ 862 /* Due to a GAS bug, this cannot use EAX. That encodes \ 863 smaller than the traditional EBX, which results in the \ 864 offset being off by one. */ \ 865 "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \ 866 : "=d"(BASE)) 867#endif 868 869/* Select a format to encode pointers in exception handling data. CODE 870 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is 871 true if the symbol may be affected by dynamic relocations. */ 872#undef ASM_PREFERRED_EH_DATA_FORMAT 873#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \ 874 (flag_pic ? (GLOBAL ? DW_EH_PE_indirect : 0) | DW_EH_PE_datarel \ 875 : DW_EH_PE_absptr) 876