sco5.h revision 169689
1128032Stjr/* Definitions for Intel 386 running SCO Unix System V 3.2 Version 5. 2123222Stjr Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004 3123222Stjr Free Software Foundation, Inc. 4123222Stjr Contributed by Kean Johnston (jkj@sco.com) 5123222Stjr 6123222StjrThis file is part of GCC. 7123222Stjr 8123222StjrGCC is free software; you can redistribute it and/or modify 9123222Stjrit under the terms of the GNU General Public License as published by 10123222Stjrthe Free Software Foundation; either version 2, or (at your option) 11123222Stjrany later version. 12123222Stjr 13123222StjrGCC is distributed in the hope that it will be useful, 14123222Stjrbut WITHOUT ANY WARRANTY; without even the implied warranty of 15123222StjrMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16123222StjrGNU General Public License for more details. 17123222Stjr 18123222StjrYou should have received a copy of the GNU General Public License 19123222Stjralong with GCC; see the file COPYING. If not, write to 20123222Stjrthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 21123222StjrBoston, MA 02110-1301, USA. */ 22123222Stjr 23123222Stjr#undef TARGET_VERSION 24123222Stjr#define TARGET_VERSION fprintf (stderr, " (i386, SCO OpenServer 5 Syntax)"); 25123222Stjr 26123222Stjr#undef ASM_QUAD 27123222Stjr 28123222Stjr#undef GLOBAL_ASM_OP 29123222Stjr#define GLOBAL_ASM_OP "\t.globl\t" 30123222Stjr 31123222Stjr#undef BSS_SECTION_ASM_OP 32123222Stjr#define BSS_SECTION_ASM_OP "\t.section\t.bss, \"aw\", @nobits" 33123222Stjr 34123222Stjr/* 35123222Stjr * NOTE: We really do want CTORS_SECTION_ASM_OP and DTORS_SECTION_ASM_OP. 36128102Stjr * Here's the reason why. If we dont define them, and we dont define them 37123222Stjr * to always emit to the same section, the default is to emit to "named" 38123222Stjr * ctors and dtors sections. This would be great if we could use GNU ld, 39123222Stjr * but we can't. The native linker could possibly be trained to coalesce 40123222Stjr * named ctors sections, but that hasn't been done either. So if we don't 41123222Stjr * define these, many C++ ctors and dtors dont get run, because they never 42123222Stjr * wind up in the ctors/dtors arrays. 43123222Stjr */ 44123222Stjr#define CTORS_SECTION_ASM_OP "\t.section\t.ctors, \"aw\"" 45123222Stjr#define DTORS_SECTION_ASM_OP "\t.section\t.dtors, \"aw\"" 46123222Stjr 47123222Stjr#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true 48123222Stjr#undef X86_FILE_START_VERSION_DIRECTIVE 49123222Stjr#define X86_FILE_START_VERSION_DIRECTIVE true 50123222Stjr 51123222Stjr/* A C statement (sans semicolon) to output to the stdio stream 52123222Stjr FILE the assembler definition of uninitialized global DECL named 53128032Stjr NAME whose size is SIZE bytes and alignment is ALIGN bytes. 54128032Stjr Try to use asm_output_aligned_bss to implement this macro. */ 55123222Stjr 56123222Stjr#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ 57123222Stjr asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) 58123222Stjr 59123222Stjr#undef DBX_REGISTER_NUMBER 60123222Stjr#define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n] 61123222Stjr 62123222Stjr#define DWARF2_DEBUGGING_INFO 1 63123222Stjr#define DBX_DEBUGGING_INFO 1 64123222Stjr 65123222Stjr#undef PREFERRED_DEBUGGING_TYPE 66123222Stjr#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG 67123222Stjr 68123222Stjr#undef DWARF2_UNWIND_INFO 69123222Stjr#define DWARF2_UNWIND_INFO 1 70123222Stjr 71123222Stjr#undef NO_IMPLICIT_EXTERN_C 72123222Stjr#define NO_IMPLICIT_EXTERN_C 1 73128032Stjr 74128032Stjr#undef SWITCH_TAKES_ARG 75123222Stjr#define SWITCH_TAKES_ARG(CHAR) \ 76128032Stjr (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ 77123222Stjr || (CHAR) == 'h' \ 78128102Stjr || (CHAR) == 'R' \ 79128102Stjr || (CHAR) == 'Y' \ 80128102Stjr || (CHAR) == 'z') 81128102Stjr 82123222Stjr#undef WORD_SWITCH_TAKES_ARG 83128102Stjr#define WORD_SWITCH_TAKES_ARG(STR) \ 84123222Stjr (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ 85128032Stjr && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \ 86131608Sru && strcmp (STR, "Tbss")) 87128032Stjr 88123222Stjr#undef TARGET_SUBTARGET_DEFAULT 89131472Sru#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS) 90123222Stjr 91123222Stjr/* 92123222Stjr * Define sizes and types 93123222Stjr */ 94123222Stjr#undef SIZE_TYPE 95128032Stjr#undef PTRDIFF_TYPE 96128032Stjr#undef WCHAR_TYPE 97123222Stjr#undef WCHAR_TYPE_SIZE 98123222Stjr#undef WINT_TYPE 99123222Stjr#define SIZE_TYPE "unsigned int" 100128032Stjr#define PTRDIFF_TYPE "int" 101128032Stjr#define WCHAR_TYPE "long int" 102123222Stjr#define WCHAR_TYPE_SIZE BITS_PER_WORD 103123222Stjr#define WINT_TYPE "long int" 104123222Stjr 105123222Stjr/* 106128032Stjr * New for multilib support. Set the default switches for multilib, 107 * which is -melf. 108 */ 109#define MULTILIB_DEFAULTS { "melf" } 110 111 112/* Please note that these specs may look messy but they are required in 113 order to emulate the SCO Development system as closely as possible. 114 With SCO Open Server 5.0, you now get the linker and assembler free, 115 so that is what these specs are targeted for. These utilities are 116 very argument sensitive: a space in the wrong place breaks everything. 117 So please forgive this mess. It works. 118 119 Parameters which can be passed to gcc, and their SCO equivalents: 120 GCC Parameter SCO Equivalent 121 -ansi -a ansi 122 -posix -a posix 123 -Xpg4 -a xpg4 124 -Xpg4plus -a xpg4plus 125 -Xods30 -a ods30 126 127 As with SCO, the default is XPG4 plus mode. SCO also allows you to 128 specify a C dialect with -Xt, -Xa, -Xc, -Xk and -Xm. These are passed 129 on to the assembler and linker in the same way that the SCO compiler 130 does. 131 132 SCO also allows you to compile, link and generate either ELF or COFF 133 binaries. With gcc, we now only support ELF mode. 134 135 GCC also requires that the user has installed OSS646, the Execution 136 Environment Update, or is running release 5.0.7 or later. This has 137 many fixes to the ELF link editor and assembler, and a considerably 138 improved libc and RTLD. 139 140 In terms of tool usage, we want to use the standard link editor always, 141 and either the GNU assembler or the native assembler. With OSS646 the 142 native assembler has grown up quite a bit. Some of the specs below 143 assume that /usr/gnu is the prefix for the GNU tools, because thats 144 where the SCO provided ones go. This is especially important for 145 include and library search path ordering. We want to look in /usr/gnu 146 first because frequently people are linking against -lintl, and they 147 MEAN to link with gettext. What they get is the SCO intl library. Its 148 a REAL pity that GNU gettext chose that name; perhaps in a future 149 version they can be persuaded to change it to -lgnuintl and have a 150 link so that -lintl will work for other systems. The same goes for 151 header files. We want /usr/gnu/include searched for before the system 152 header files. Hence the -isystem /usr/gnu/include in the CPP_SPEC. 153 We get /usr/gnu/lib first by virtue of the MD_STARTFILE_PREFIX below. 154*/ 155 156#define MD_STARTFILE_PREFIX "/usr/gnu/lib/" 157#define MD_STARTFILE_PREFIX_1 "/usr/ccs/lib/" 158 159#if USE_GAS 160# define MD_EXEC_PREFIX "/usr/gnu/bin/" 161#else 162# define MD_EXEC_PREFIX "/usr/ccs/bin/elf/" 163#endif 164 165/* Always use the system linker, please. */ 166#ifndef DEFAULT_LINKER 167# define DEFAULT_LINKER "/usr/ccs/bin/elf/ld" 168#endif 169 170/* Set up assembler flags for PIC and ELF compilations */ 171#undef ASM_SPEC 172 173#if USE_GAS 174 /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c */ 175#else 176#define ASM_SPEC \ 177 "%{Ym,*} %{Yd,*} %{Wa,*:%*} \ 178 -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}" 179#endif 180 181/* 182 * Use crti.o for shared objects, crt1.o for normal executables. Make sure 183 * to recognize both -G and -shared as a valid way of introducing shared 184 * library generation. This is important for backwards compatibility. 185 */ 186 187#undef STARTFILE_SPEC 188#define STARTFILE_SPEC \ 189 "%{pg:%e-pg not supported on this platform} \ 190 %{p:%{pp:%e-p and -pp specified - pick one}} \ 191 %{!shared:\ 192 %{!symbolic: \ 193 %{!G: \ 194 %{pp:pcrt1elf.o%s}%{p:mcrt1.o%s}%{!p:%{!pp:crt1.o%s}}}}} \ 195 crti.o%s \ 196 %{ansi:values-Xc.o%s} \ 197 %{!ansi: \ 198 %{traditional:values-Xt.o%s} \ 199 %{!traditional: \ 200 %{Xa:values-Xa.o%s} \ 201 %{!Xa:%{Xc:values-Xc.o%s} \ 202 %{!Xc:%{Xk:values-Xk.o%s} \ 203 %{!Xk:%{Xt:values-Xt.o%s} \ 204 %{!Xt:values-Xa.o%s}}}}}} \ 205 crtbegin.o%s" 206 207#undef ENDFILE_SPEC 208#define ENDFILE_SPEC \ 209 "crtend.o%s crtn.o%s" 210 211#define TARGET_OS_CPP_BUILTINS() \ 212 do \ 213 { \ 214 builtin_define ("__unix"); \ 215 builtin_define ("_SCO_DS"); \ 216 builtin_define ("_SCO_DS_LL"); \ 217 builtin_define ("_SCO_ELF"); \ 218 builtin_define ("_M_I386"); \ 219 builtin_define ("_M_XENIX"); \ 220 builtin_define ("_M_UNIX"); \ 221 builtin_assert ("system=svr3"); \ 222 if (flag_iso) \ 223 cpp_define (pfile, "_STRICT_ANSI"); \ 224 } \ 225 while (0) 226 227#undef CPP_SPEC 228#define CPP_SPEC "\ 229 -isystem /usr/gnu/include \ 230 %{!Xods30:-D_STRICT_NAMES} \ 231 %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \ 232 %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi} \ 233 %{!ansi: \ 234 %{posix:-isystem include/posix%s -isystem /usr/include/posix \ 235 -D_POSIX_C_SOURCE=2 -D_POSIX_SOURCE=1} \ 236 %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \ 237 -D_XOPEN_SOURCE=1} \ 238 %{!Xpg4:-D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT \ 239 -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII \ 240 -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX \ 241 %{Xods30:-isystem include/ods_30_compat%s \ 242 -isystem /usr/include/ods_30_compat \ 243 -D_SCO_ODS_30 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \ 244 -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \ 245 -DM_WORDSWAP}}}} \ 246 %{scointl:-DM_INTERNAT -D_M_INTERNAT} \ 247 %{Xa:-D_SCO_C_DIALECT=1} \ 248 %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \ 249 %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \ 250 %{!Xk:%{Xt:-D_SCO_C_DIALECT=2} \ 251 %{!Xt:-D_SCO_C_DIALECT=1}}}}" 252 253#undef LINK_SPEC 254#define LINK_SPEC \ 255 "%{!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}}} \ 256 %{YP,*} %{YL,*} %{YU,*} \ 257 %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \ 258 %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \ 259 %{h*} %{static:-dn -Bstatic %{G:%e-G and -static are mutually exclusive}} \ 260 %{shared:%{!G:-G}} %{G:%{!shared:-G}} %{shared:%{G:-G}} \ 261 %{shared:-dy %{symbolic:-Bsymbolic -G} %{z*}} %{R*} %{Y*} \ 262 %{Qn:} %{!Qy:-Qn} -z alt_resolve" 263 264/* Library spec. If we are not building a shared library, provide the 265 standard libraries, as per the SCO compiler. */ 266 267#undef LIB_SPEC 268#define LIB_SPEC \ 269 "%{shared:%{!G:pic/libgcc.a%s}} \ 270 %{G:%{!shared:pic/libgcc.a%s}} \ 271 %{shared:%{G:pic/libgcc.a%s}} \ 272 %{p:%{!pp:-lelfprof -lelf}} %{pp:%{!p:-lelfprof -lelf}} \ 273 %{!shared:%{!symbolic:%{!G:-lcrypt -lgen -lc}}}" 274 275#undef LIBGCC_SPEC 276#define LIBGCC_SPEC \ 277 "%{!shared:%{!G:-lgcc}}" 278 279/* Handle special EH pointer encodings. Absolute, pc-relative, and 280 indirect are handled automatically. */ 281#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \ 282 do { \ 283 if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \ 284 { \ 285 fputs (ASM_LONG, FILE); \ 286 assemble_name (FILE, XSTR (ADDR, 0)); \ 287 fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \ 288 goto DONE; \ 289 } \ 290 } while (0) 291 292/* Used by crtstuff.c to initialize the base of data-relative relocations. 293 These are GOT relative on x86, so return the pic register. */ 294#ifdef __PIC__ 295#define CRT_GET_RFIB_DATA(BASE) \ 296 { \ 297 register void *ebx_ __asm__("ebx"); \ 298 BASE = ebx_; \ 299 } 300#else 301#define CRT_GET_RFIB_DATA(BASE) \ 302 __asm__ ("call\t.LPR%=\n" \ 303 ".LPR%=:\n\t" \ 304 "popl\t%0\n\t" \ 305 /* Due to a GAS bug, this cannot use EAX. That encodes \ 306 smaller than the traditional EBX, which results in the \ 307 offset being off by one. */ \ 308 "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \ 309 : "=d"(BASE)) 310#endif 311 312