sco5.h revision 122180
1266328Sian/* Definitions for Intel 386 running SCO Unix System V 3.2 Version 5. 2266328Sian Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003 3249997Swkoszek Free Software Foundation, Inc. 4266328Sian Contributed by Kean Johnston (jkj@sco.com) 5266328Sian 6249997SwkoszekThis file is part of GNU CC. 7266328Sian 8249997SwkoszekGNU CC is free software; you can redistribute it and/or modify 9266328Sianit under the terms of the GNU General Public License as published by 10266328Sianthe Free Software Foundation; either version 2, or (at your option) 11266328Sianany later version. 12266328Sian 13249997SwkoszekGNU CC is distributed in the hope that it will be useful, 14266328Sianbut WITHOUT ANY WARRANTY; without even the implied warranty of 15266328SianMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16266328SianGNU General Public License for more details. 17266328Sian 18249997SwkoszekYou should have received a copy of the GNU General Public License 19266328Sianalong with GNU CC; see the file COPYING. If not, write to 20249997Swkoszekthe Free Software Foundation, 59 Temple Place - Suite 330, 21249997SwkoszekBoston, MA 02111-1307, USA. */ 22249997Swkoszek 23249997Swkoszek#undef TARGET_VERSION 24249997Swkoszek#define TARGET_VERSION fprintf (stderr, " (i386, SCO OpenServer 5 Syntax)"); 25249997Swkoszek 26249997Swkoszek/* The native link editor does not support linkonce stuff */ 27249997Swkoszek#define SUPPORTS_ONE_ONLY 0 28266328Sian 29266328Sian#undef ASM_QUAD 30266328Sian 31266328Sian#undef GLOBAL_ASM_OP 32266328Sian#define GLOBAL_ASM_OP "\t.globl\t" 33266328Sian 34266328Sian#undef BSS_SECTION_ASM_OP 35249997Swkoszek#define BSS_SECTION_ASM_OP "\t.section\t.bss, \"aw\", @nobits" 36249997Swkoszek 37266328Sian/* 38266328Sian * NOTE: We really do want CTORS_SECTION_ASM_OP and DTORS_SECTION_ASM_OP. 39266328Sian * Here's the reason why. If we dont define them, and we dont define them 40266328Sian * to always emit to the same section, the default is to emit to "named" 41249997Swkoszek * ctors and dtors sections. This would be great if we could use GNU ld, 42249997Swkoszek * but we can't. The native linker could possibly be trained to coalesce 43249997Swkoszek * named ctors sections, but that hasn't been done either. So if we don't 44266328Sian * define these, many C++ ctors and dtors dont get run, because they never 45266328Sian * wind up in the ctors/dtors arrays. 46266331Sian */ 47266328Sian#define CTORS_SECTION_ASM_OP "\t.section\t.ctors, \"aw\"" 48266328Sian#define DTORS_SECTION_ASM_OP "\t.section\t.dtors, \"aw\"" 49266328Sian 50266328Sian#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true 51266328Sian#undef X86_FILE_START_VERSION_DIRECTIVE 52266328Sian#define X86_FILE_START_VERSION_DIRECTIVE true 53266328Sian 54266328Sian/* A C statement (sans semicolon) to output to the stdio stream 55266328Sian FILE the assembler definition of uninitialized global DECL named 56266328Sian NAME whose size is SIZE bytes and alignment is ALIGN bytes. 57266331Sian Try to use asm_output_aligned_bss to implement this macro. */ 58266328Sian 59266379Sian#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ 60249997Swkoszek asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) 61249997Swkoszek 62268813Simp#undef DBX_REGISTER_NUMBER 63249997Swkoszek#define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n] 64249997Swkoszek 65249997Swkoszek#define DWARF2_DEBUGGING_INFO 1 66249997Swkoszek#define DWARF_DEBUGGING_INFO 1 67266328Sian#define DBX_DEBUGGING_INFO 1 68266328Sian 69266328Sian#undef PREFERRED_DEBUGGING_TYPE 70266328Sian#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG 71249997Swkoszek 72249997Swkoszek#undef DWARF2_UNWIND_INFO 73249997Swkoszek#define DWARF2_UNWIND_INFO 1 74249997Swkoszek 75249997Swkoszek#undef NO_IMPLICIT_EXTERN_C 76249997Swkoszek#define NO_IMPLICIT_EXTERN_C 1 77249997Swkoszek 78249997Swkoszek#undef SWITCH_TAKES_ARG 79249997Swkoszek#define SWITCH_TAKES_ARG(CHAR) \ 80249997Swkoszek (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ 81249997Swkoszek || (CHAR) == 'h' \ 82249997Swkoszek || (CHAR) == 'R' \ 83249997Swkoszek || (CHAR) == 'Y' \ 84249997Swkoszek || (CHAR) == 'z') 85249997Swkoszek 86249997Swkoszek#undef WORD_SWITCH_TAKES_ARG 87249997Swkoszek#define WORD_SWITCH_TAKES_ARG(STR) \ 88249997Swkoszek (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ 89249997Swkoszek && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \ 90249997Swkoszek && strcmp (STR, "Tbss")) 91249997Swkoszek 92249997Swkoszek#undef TARGET_SUBTARGET_DEFAULT 93249997Swkoszek#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS) 94249997Swkoszek 95249997Swkoszek/* 96249997Swkoszek * Define sizes and types 97249997Swkoszek */ 98249997Swkoszek#undef SIZE_TYPE 99249997Swkoszek#undef PTRDIFF_TYPE 100249997Swkoszek#undef WCHAR_TYPE 101249997Swkoszek#undef WCHAR_TYPE_SIZE 102249997Swkoszek#undef WINT_TYPE 103249997Swkoszek#undef LONG_DOUBLE_TYPE_SIZE 104#define SIZE_TYPE "unsigned int" 105#define PTRDIFF_TYPE "int" 106#define WCHAR_TYPE "long int" 107#define WCHAR_TYPE_SIZE BITS_PER_WORD 108#define WINT_TYPE "long int" 109#define LONG_DOUBLE_TYPE_SIZE 96 110 111/* 112 * New for multilib support. Set the default switches for multilib, 113 * which is -melf. 114 */ 115#define MULTILIB_DEFAULTS { "melf" } 116 117 118/* Please note that these specs may look messy but they are required in 119 order to emulate the SCO Development system as closely as possible. 120 With SCO Open Server 5.0, you now get the linker and assembler free, 121 so that is what these specs are targeted for. These utilities are 122 very argument sensitive: a space in the wrong place breaks everything. 123 So please forgive this mess. It works. 124 125 Parameters which can be passed to gcc, and their SCO equivalents: 126 GCC Parameter SCO Equivalent 127 -ansi -a ansi 128 -posix -a posix 129 -Xpg4 -a xpg4 130 -Xpg4plus -a xpg4plus 131 -Xods30 -a ods30 132 133 As with SCO, the default is XPG4 plus mode. SCO also allows you to 134 specify a C dialect with -Xt, -Xa, -Xc, -Xk and -Xm. These are passed 135 on to the assembler and linker in the same way that the SCO compiler 136 does. 137 138 SCO also allows you to compile, link and generate either ELF or COFF 139 binaries. With gcc, we now only support ELF mode. 140 141 GCC also requires that the user has installed OSS646, the Execution 142 Environment Update, or is running release 5.0.7 or later. This has 143 many fixes to the ELF link editor and assembler, and a considerably 144 improved libc and RTLD. 145 146 In terms of tool usage, we want to use the standard link editor always, 147 and either the GNU assembler or the native assembler. With OSS646 the 148 native assembler has grown up quite a bit. Some of the specs below 149 assume that /usr/gnu is the prefix for the GNU tools, because thats 150 where the SCO provided ones go. This is especially important for 151 include and library search path ordering. We want to look in /usr/gnu 152 first, becuase frequently people are linking against -lintl, and they 153 MEAN to link with gettext. What they get is the SCO intl library. Its 154 a REAL pity that GNU gettext chose that name; perhaps in a future 155 version they can be persuaded to change it to -lgnuintl and have a 156 link so that -lintl will work for other systems. The same goes for 157 header files. We want /usr/gnu/include searched for before the system 158 header files. Hence the -isystem /usr/gnu/include in the CPP_SPEC. 159 We get /usr/gnu/lib first by virtue of the MD_STARTFILE_PREFIX below. 160*/ 161 162#define MD_STARTFILE_PREFIX "/usr/gnu/lib/" 163#define MD_STARTFILE_PREFIX_1 "/usr/ccs/lib/" 164 165#if USE_GAS 166# define MD_EXEC_PREFIX "/usr/gnu/bin/" 167#else 168# define MD_EXEC_PREFIX "/usr/ccs/bin/elf/" 169#endif 170 171/* Always use the system linker, please. */ 172#ifndef DEFAULT_LINKER 173# define DEFAULT_LINKER "/usr/ccs/bin/elf/ld" 174#endif 175 176/* Set up assembler flags for PIC and ELF compilations */ 177#undef ASM_SPEC 178 179#if USE_GAS 180 /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c */ 181#else 182#define ASM_SPEC \ 183 "%{Ym,*} %{Yd,*} %{Wa,*:%*} \ 184 -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}" 185#endif 186 187/* 188 * Use crti.o for shared objects, crt1.o for normal executables. Make sure 189 * to recognize both -G and -shared as a valid way of introducing shared 190 * library generation. This is important for backwards compatibility. 191 */ 192 193#undef STARTFILE_SPEC 194#define STARTFILE_SPEC \ 195 "%{pg:%e-pg not supported on this platform} \ 196 %{p:%{pp:%e-p and -pp specified - pick one}} \ 197 %{!shared:\ 198 %{!symbolic: \ 199 %{!G: \ 200 %{pp:pcrt1elf.o%s}%{p:mcrt1.o%s}%{!p:%{!pp:crt1.o%s}}}}} \ 201 crti.o%s \ 202 %{ansi:values-Xc.o%s} \ 203 %{!ansi: \ 204 %{traditional:values-Xt.o%s} \ 205 %{!traditional: \ 206 %{Xa:values-Xa.o%s} \ 207 %{!Xa:%{Xc:values-Xc.o%s} \ 208 %{!Xc:%{Xk:values-Xk.o%s} \ 209 %{!Xk:%{Xt:values-Xt.o%s} \ 210 %{!Xt:values-Xa.o%s}}}}}} \ 211 crtbegin.o%s" 212 213#undef ENDFILE_SPEC 214#define ENDFILE_SPEC \ 215 "crtend.o%s crtn.o%s" 216 217#define TARGET_OS_CPP_BUILTINS() \ 218 do \ 219 { \ 220 builtin_define ("__unix"); \ 221 builtin_define ("_SCO_DS"); \ 222 builtin_define ("_SCO_DS_LL"); \ 223 builtin_define ("_SCO_ELF"); \ 224 builtin_define ("_M_I386"); \ 225 builtin_define ("_M_XENIX"); \ 226 builtin_define ("_M_UNIX"); \ 227 builtin_assert ("system=svr3"); \ 228 if (flag_iso) \ 229 cpp_define (pfile, "_STRICT_ANSI"); \ 230 if (flag_pic) \ 231 { \ 232 builtin_define ("__PIC__"); \ 233 builtin_define ("__pic__"); \ 234 } \ 235 } \ 236 while (0) 237 238#undef CPP_SPEC 239#define CPP_SPEC "\ 240 -isystem /usr/gnu/include \ 241 %{pthread:-D_REENTRANT} \ 242 %{!Xods30:-D_STRICT_NAMES} \ 243 %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \ 244 %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi} \ 245 %{!ansi: \ 246 %{posix:-isystem include/posix%s -isystem /usr/include/posix \ 247 -D_POSIX_C_SOURCE=2 -D_POSIX_SOURCE=1} \ 248 %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \ 249 -D_XOPEN_SOURCE=1} \ 250 %{!Xpg4:-D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT \ 251 -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII \ 252 -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX \ 253 %{Xods30:-isystem include/ods_30_compat%s \ 254 -isystem /usr/include/ods_30_compat \ 255 -D_SCO_ODS_30 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \ 256 -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \ 257 -DM_WORDSWAP}}}} \ 258 %{scointl:-DM_INTERNAT -D_M_INTERNAT} \ 259 %{Xa:-D_SCO_C_DIALECT=1} \ 260 %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \ 261 %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \ 262 %{!Xk:%{Xt:-D_SCO_C_DIALECT=2} \ 263 %{!Xt:-D_SCO_C_DIALECT=1}}}}" 264 265#undef LINK_SPEC 266#define LINK_SPEC \ 267 "%{!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}}} \ 268 %{Wl,*:%*} %{YP,*} %{YL,*} %{YU,*} \ 269 %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \ 270 %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \ 271 %{h*} %{static:-dn -Bstatic %{G:%e-G and -static are mutually exclusive}} \ 272 %{shared:%{!G:-G}} %{G:%{!shared:-G}} %{shared:%{G:-G}} \ 273 %{shared:-dy %{symbolic:-Bsymbolic -G} %{z*}} %{R*} %{Y*} \ 274 %{Qn:} %{!Qy:-Qn} -z alt_resolve" 275 276/* Library spec. If we are not building a shared library, provide the 277 standard libraries, as per the SCO compiler. */ 278 279#undef LIB_SPEC 280#define LIB_SPEC \ 281 "%{shared:%{!G:pic/libgcc.a%s}} \ 282 %{G:%{!shared:pic/libgcc.a%s}} \ 283 %{shared:%{G:pic/libgcc.a%s}} \ 284 %{p:%{!pp:-lelfprof -lelf}} %{pp:%{!p:-lelfprof -lelf}} \ 285 %{!shared:%{!symbolic:%{!G:-lcrypt -lgen -lc %{pthread:-lpthread}}}}" 286 287#undef LIBGCC_SPEC 288#define LIBGCC_SPEC \ 289 "%{!shared:%{!G:-lgcc}}" 290 291/* Here for legacy support only so we still accept -melf flag */ 292#define MASK_COFF 010000000000 /* Mask for COFF generation */ 293#define TARGET_ELF (1) 294 295#undef SUBTARGET_SWITCHES 296#define SUBTARGET_SWITCHES \ 297 { "elf", -MASK_COFF, N_("Generate ELF output") }, 298 299/* Handle special EH pointer encodings. Absolute, pc-relative, and 300 indirect are handled automatically. */ 301#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \ 302 do { \ 303 if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \ 304 { \ 305 fputs (ASM_LONG, FILE); \ 306 assemble_name (FILE, XSTR (ADDR, 0)); \ 307 fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \ 308 goto DONE; \ 309 } \ 310 } while (0) 311 312/* Used by crtstuff.c to initialize the base of data-relative relocations. 313 These are GOT relative on x86, so return the pic register. */ 314#ifdef __PIC__ 315#define CRT_GET_RFIB_DATA(BASE) \ 316 { \ 317 register void *ebx_ __asm__("ebx"); \ 318 BASE = ebx_; \ 319 } 320#else 321#define CRT_GET_RFIB_DATA(BASE) \ 322 __asm__ ("call\t.LPR%=\n" \ 323 ".LPR%=:\n\t" \ 324 "popl\t%0\n\t" \ 325 /* Due to a GAS bug, this cannot use EAX. That encodes \ 326 smaller than the traditional EBX, which results in the \ 327 offset being off by one. */ \ 328 "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \ 329 : "=d"(BASE)) 330#endif 331 332