150397Sobrien/* Definitions for Intel 386 running SCO Unix System V 3.2 Version 5. 2169689Skan Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004 390075Sobrien Free Software Foundation, Inc. 4122180Skan Contributed by Kean Johnston (jkj@sco.com) 550397Sobrien 6132718SkanThis file is part of GCC. 750397Sobrien 8132718SkanGCC is free software; you can redistribute it and/or modify 950397Sobrienit under the terms of the GNU General Public License as published by 1050397Sobrienthe Free Software Foundation; either version 2, or (at your option) 1150397Sobrienany later version. 1250397Sobrien 13132718SkanGCC is distributed in the hope that it will be useful, 1450397Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 1550397SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1650397SobrienGNU General Public License for more details. 1750397Sobrien 1850397SobrienYou should have received a copy of the GNU General Public License 19132718Skanalong with GCC; see the file COPYING. If not, write to 20169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 21169689SkanBoston, MA 02110-1301, USA. */ 2250397Sobrien 23122180Skan#undef TARGET_VERSION 2450397Sobrien#define TARGET_VERSION fprintf (stderr, " (i386, SCO OpenServer 5 Syntax)"); 2550397Sobrien 2690075Sobrien#undef ASM_QUAD 2750397Sobrien 2850397Sobrien#undef GLOBAL_ASM_OP 2990075Sobrien#define GLOBAL_ASM_OP "\t.globl\t" 3050397Sobrien 3150397Sobrien#undef BSS_SECTION_ASM_OP 32122180Skan#define BSS_SECTION_ASM_OP "\t.section\t.bss, \"aw\", @nobits" 33122180Skan 34122180Skan/* 35122180Skan * NOTE: We really do want CTORS_SECTION_ASM_OP and DTORS_SECTION_ASM_OP. 36122180Skan * Here's the reason why. If we dont define them, and we dont define them 37122180Skan * to always emit to the same section, the default is to emit to "named" 38122180Skan * ctors and dtors sections. This would be great if we could use GNU ld, 39122180Skan * but we can't. The native linker could possibly be trained to coalesce 40122180Skan * named ctors sections, but that hasn't been done either. So if we don't 41122180Skan * define these, many C++ ctors and dtors dont get run, because they never 42122180Skan * wind up in the ctors/dtors arrays. 43122180Skan */ 44122180Skan#define CTORS_SECTION_ASM_OP "\t.section\t.ctors, \"aw\"" 45122180Skan#define DTORS_SECTION_ASM_OP "\t.section\t.dtors, \"aw\"" 4650397Sobrien 47122180Skan#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true 48122180Skan#undef X86_FILE_START_VERSION_DIRECTIVE 49122180Skan#define X86_FILE_START_VERSION_DIRECTIVE true 5050397Sobrien 5150397Sobrien/* A C statement (sans semicolon) to output to the stdio stream 5250397Sobrien FILE the assembler definition of uninitialized global DECL named 5350397Sobrien NAME whose size is SIZE bytes and alignment is ALIGN bytes. 5450397Sobrien Try to use asm_output_aligned_bss to implement this macro. */ 5550397Sobrien 5650397Sobrien#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ 57122180Skan asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) 5850397Sobrien 5950397Sobrien#undef DBX_REGISTER_NUMBER 60122180Skan#define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n] 6150397Sobrien 62122180Skan#define DWARF2_DEBUGGING_INFO 1 63122180Skan#define DBX_DEBUGGING_INFO 1 64117395Skan 65117395Skan#undef PREFERRED_DEBUGGING_TYPE 66122180Skan#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG 6750397Sobrien 68122180Skan#undef DWARF2_UNWIND_INFO 69122180Skan#define DWARF2_UNWIND_INFO 1 7050397Sobrien 7150397Sobrien#undef NO_IMPLICIT_EXTERN_C 72122180Skan#define NO_IMPLICIT_EXTERN_C 1 7350397Sobrien 7450397Sobrien#undef SWITCH_TAKES_ARG 7550397Sobrien#define SWITCH_TAKES_ARG(CHAR) \ 7650397Sobrien (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ 7750397Sobrien || (CHAR) == 'h' \ 7850397Sobrien || (CHAR) == 'R' \ 7950397Sobrien || (CHAR) == 'Y' \ 8050397Sobrien || (CHAR) == 'z') 8150397Sobrien 8250397Sobrien#undef WORD_SWITCH_TAKES_ARG 8350397Sobrien#define WORD_SWITCH_TAKES_ARG(STR) \ 8450397Sobrien (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ 8550397Sobrien && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \ 8650397Sobrien && strcmp (STR, "Tbss")) 8750397Sobrien 8890075Sobrien#undef TARGET_SUBTARGET_DEFAULT 8990075Sobrien#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS) 9050397Sobrien 9150397Sobrien/* 9250397Sobrien * Define sizes and types 9350397Sobrien */ 9450397Sobrien#undef SIZE_TYPE 9550397Sobrien#undef PTRDIFF_TYPE 9650397Sobrien#undef WCHAR_TYPE 9750397Sobrien#undef WCHAR_TYPE_SIZE 98122180Skan#undef WINT_TYPE 9950397Sobrien#define SIZE_TYPE "unsigned int" 10050397Sobrien#define PTRDIFF_TYPE "int" 10150397Sobrien#define WCHAR_TYPE "long int" 10250397Sobrien#define WCHAR_TYPE_SIZE BITS_PER_WORD 103122180Skan#define WINT_TYPE "long int" 10450397Sobrien 10550397Sobrien/* 10650397Sobrien * New for multilib support. Set the default switches for multilib, 10750397Sobrien * which is -melf. 10850397Sobrien */ 10950397Sobrien#define MULTILIB_DEFAULTS { "melf" } 11050397Sobrien 11150397Sobrien 11250397Sobrien/* Please note that these specs may look messy but they are required in 11350397Sobrien order to emulate the SCO Development system as closely as possible. 11450397Sobrien With SCO Open Server 5.0, you now get the linker and assembler free, 11550397Sobrien so that is what these specs are targeted for. These utilities are 11650397Sobrien very argument sensitive: a space in the wrong place breaks everything. 117122180Skan So please forgive this mess. It works. 11850397Sobrien 11950397Sobrien Parameters which can be passed to gcc, and their SCO equivalents: 12050397Sobrien GCC Parameter SCO Equivalent 12150397Sobrien -ansi -a ansi 12250397Sobrien -posix -a posix 12350397Sobrien -Xpg4 -a xpg4 12450397Sobrien -Xpg4plus -a xpg4plus 12550397Sobrien -Xods30 -a ods30 12650397Sobrien 12750397Sobrien As with SCO, the default is XPG4 plus mode. SCO also allows you to 12850397Sobrien specify a C dialect with -Xt, -Xa, -Xc, -Xk and -Xm. These are passed 12950397Sobrien on to the assembler and linker in the same way that the SCO compiler 13050397Sobrien does. 13150397Sobrien 13250397Sobrien SCO also allows you to compile, link and generate either ELF or COFF 133122180Skan binaries. With gcc, we now only support ELF mode. 134122180Skan 135122180Skan GCC also requires that the user has installed OSS646, the Execution 136122180Skan Environment Update, or is running release 5.0.7 or later. This has 137122180Skan many fixes to the ELF link editor and assembler, and a considerably 138122180Skan improved libc and RTLD. 139122180Skan 140122180Skan In terms of tool usage, we want to use the standard link editor always, 141122180Skan and either the GNU assembler or the native assembler. With OSS646 the 142122180Skan native assembler has grown up quite a bit. Some of the specs below 143122180Skan assume that /usr/gnu is the prefix for the GNU tools, because thats 144122180Skan where the SCO provided ones go. This is especially important for 145122180Skan include and library search path ordering. We want to look in /usr/gnu 146132718Skan first because frequently people are linking against -lintl, and they 147122180Skan MEAN to link with gettext. What they get is the SCO intl library. Its 148122180Skan a REAL pity that GNU gettext chose that name; perhaps in a future 149122180Skan version they can be persuaded to change it to -lgnuintl and have a 150122180Skan link so that -lintl will work for other systems. The same goes for 151122180Skan header files. We want /usr/gnu/include searched for before the system 152122180Skan header files. Hence the -isystem /usr/gnu/include in the CPP_SPEC. 153122180Skan We get /usr/gnu/lib first by virtue of the MD_STARTFILE_PREFIX below. 15450397Sobrien*/ 15550397Sobrien 156122180Skan#define MD_STARTFILE_PREFIX "/usr/gnu/lib/" 157122180Skan#define MD_STARTFILE_PREFIX_1 "/usr/ccs/lib/" 158122180Skan 159122180Skan#if USE_GAS 160122180Skan# define MD_EXEC_PREFIX "/usr/gnu/bin/" 161122180Skan#else 162122180Skan# define MD_EXEC_PREFIX "/usr/ccs/bin/elf/" 163122180Skan#endif 164122180Skan 165122180Skan/* Always use the system linker, please. */ 166122180Skan#ifndef DEFAULT_LINKER 167122180Skan# define DEFAULT_LINKER "/usr/ccs/bin/elf/ld" 168122180Skan#endif 169122180Skan 17050397Sobrien/* Set up assembler flags for PIC and ELF compilations */ 17150397Sobrien#undef ASM_SPEC 17250397Sobrien 17350397Sobrien#if USE_GAS 174122180Skan /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c */ 17550397Sobrien#else 17650397Sobrien#define ASM_SPEC \ 177122180Skan "%{Ym,*} %{Yd,*} %{Wa,*:%*} \ 178122180Skan -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}" 17950397Sobrien#endif 18050397Sobrien 181122180Skan/* 182122180Skan * Use crti.o for shared objects, crt1.o for normal executables. Make sure 183122180Skan * to recognize both -G and -shared as a valid way of introducing shared 184122180Skan * library generation. This is important for backwards compatibility. 185122180Skan */ 18650397Sobrien 18750397Sobrien#undef STARTFILE_SPEC 18850397Sobrien#define STARTFILE_SPEC \ 189122180Skan "%{pg:%e-pg not supported on this platform} \ 190122180Skan %{p:%{pp:%e-p and -pp specified - pick one}} \ 191122180Skan %{!shared:\ 19250397Sobrien %{!symbolic: \ 193122180Skan %{!G: \ 194122180Skan %{pp:pcrt1elf.o%s}%{p:mcrt1.o%s}%{!p:%{!pp:crt1.o%s}}}}} \ 195122180Skan crti.o%s \ 19650397Sobrien %{ansi:values-Xc.o%s} \ 19750397Sobrien %{!ansi: \ 198122180Skan %{traditional:values-Xt.o%s} \ 199122180Skan %{!traditional: \ 200122180Skan %{Xa:values-Xa.o%s} \ 201122180Skan %{!Xa:%{Xc:values-Xc.o%s} \ 202122180Skan %{!Xc:%{Xk:values-Xk.o%s} \ 203122180Skan %{!Xk:%{Xt:values-Xt.o%s} \ 204122180Skan %{!Xt:values-Xa.o%s}}}}}} \ 205122180Skan crtbegin.o%s" 20650397Sobrien 20750397Sobrien#undef ENDFILE_SPEC 20850397Sobrien#define ENDFILE_SPEC \ 209122180Skan "crtend.o%s crtn.o%s" 21050397Sobrien 211122180Skan#define TARGET_OS_CPP_BUILTINS() \ 212122180Skan do \ 213122180Skan { \ 214122180Skan builtin_define ("__unix"); \ 215122180Skan builtin_define ("_SCO_DS"); \ 216122180Skan builtin_define ("_SCO_DS_LL"); \ 217122180Skan builtin_define ("_SCO_ELF"); \ 218122180Skan builtin_define ("_M_I386"); \ 219122180Skan builtin_define ("_M_XENIX"); \ 220122180Skan builtin_define ("_M_UNIX"); \ 221122180Skan builtin_assert ("system=svr3"); \ 222122180Skan if (flag_iso) \ 223122180Skan cpp_define (pfile, "_STRICT_ANSI"); \ 224122180Skan } \ 225117395Skan while (0) 22650397Sobrien 22750397Sobrien#undef CPP_SPEC 228117395Skan#define CPP_SPEC "\ 229122180Skan -isystem /usr/gnu/include \ 23050397Sobrien %{!Xods30:-D_STRICT_NAMES} \ 23150397Sobrien %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \ 232117395Skan %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi} \ 23350397Sobrien %{!ansi: \ 23450397Sobrien %{posix:-isystem include/posix%s -isystem /usr/include/posix \ 23550397Sobrien -D_POSIX_C_SOURCE=2 -D_POSIX_SOURCE=1} \ 23650397Sobrien %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \ 23750397Sobrien -D_XOPEN_SOURCE=1} \ 23850397Sobrien %{!Xpg4:-D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT \ 23950397Sobrien -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII \ 24050397Sobrien -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX \ 24150397Sobrien %{Xods30:-isystem include/ods_30_compat%s \ 24250397Sobrien -isystem /usr/include/ods_30_compat \ 24350397Sobrien -D_SCO_ODS_30 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \ 24450397Sobrien -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \ 24550397Sobrien -DM_WORDSWAP}}}} \ 24650397Sobrien %{scointl:-DM_INTERNAT -D_M_INTERNAT} \ 24750397Sobrien %{Xa:-D_SCO_C_DIALECT=1} \ 24850397Sobrien %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \ 24950397Sobrien %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \ 25050397Sobrien %{!Xk:%{Xt:-D_SCO_C_DIALECT=2} \ 251117395Skan %{!Xt:-D_SCO_C_DIALECT=1}}}}" 25250397Sobrien 25350397Sobrien#undef LINK_SPEC 25450397Sobrien#define LINK_SPEC \ 255122180Skan "%{!shared:%{!symbolic:%{!G:-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}}} \ 256169689Skan %{YP,*} %{YL,*} %{YU,*} \ 25750397Sobrien %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \ 25850397Sobrien %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \ 259122180Skan %{h*} %{static:-dn -Bstatic %{G:%e-G and -static are mutually exclusive}} \ 260122180Skan %{shared:%{!G:-G}} %{G:%{!shared:-G}} %{shared:%{G:-G}} \ 261122180Skan %{shared:-dy %{symbolic:-Bsymbolic -G} %{z*}} %{R*} %{Y*} \ 262122180Skan %{Qn:} %{!Qy:-Qn} -z alt_resolve" 26350397Sobrien 26450397Sobrien/* Library spec. If we are not building a shared library, provide the 26550397Sobrien standard libraries, as per the SCO compiler. */ 26650397Sobrien 26750397Sobrien#undef LIB_SPEC 26850397Sobrien#define LIB_SPEC \ 269122180Skan "%{shared:%{!G:pic/libgcc.a%s}} \ 270122180Skan %{G:%{!shared:pic/libgcc.a%s}} \ 271122180Skan %{shared:%{G:pic/libgcc.a%s}} \ 272122180Skan %{p:%{!pp:-lelfprof -lelf}} %{pp:%{!p:-lelfprof -lelf}} \ 273132718Skan %{!shared:%{!symbolic:%{!G:-lcrypt -lgen -lc}}}" 27450397Sobrien 27550397Sobrien#undef LIBGCC_SPEC 27650397Sobrien#define LIBGCC_SPEC \ 277122180Skan "%{!shared:%{!G:-lgcc}}" 27850397Sobrien 27990075Sobrien/* Handle special EH pointer encodings. Absolute, pc-relative, and 28090075Sobrien indirect are handled automatically. */ 28190075Sobrien#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \ 28290075Sobrien do { \ 28390075Sobrien if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \ 28490075Sobrien { \ 28590075Sobrien fputs (ASM_LONG, FILE); \ 28690075Sobrien assemble_name (FILE, XSTR (ADDR, 0)); \ 28790075Sobrien fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \ 28890075Sobrien goto DONE; \ 28990075Sobrien } \ 29090075Sobrien } while (0) 29190075Sobrien 29290075Sobrien/* Used by crtstuff.c to initialize the base of data-relative relocations. 29390075Sobrien These are GOT relative on x86, so return the pic register. */ 29490075Sobrien#ifdef __PIC__ 29590075Sobrien#define CRT_GET_RFIB_DATA(BASE) \ 29690075Sobrien { \ 29790075Sobrien register void *ebx_ __asm__("ebx"); \ 29890075Sobrien BASE = ebx_; \ 29990075Sobrien } 30090075Sobrien#else 30190075Sobrien#define CRT_GET_RFIB_DATA(BASE) \ 30290075Sobrien __asm__ ("call\t.LPR%=\n" \ 30390075Sobrien ".LPR%=:\n\t" \ 30490075Sobrien "popl\t%0\n\t" \ 30590075Sobrien /* Due to a GAS bug, this cannot use EAX. That encodes \ 30690075Sobrien smaller than the traditional EBX, which results in the \ 30790075Sobrien offset being off by one. */ \ 30890075Sobrien "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \ 30990075Sobrien : "=d"(BASE)) 31090075Sobrien#endif 31190075Sobrien 312