1 /* Definitions for Intel 386 running SCO Unix System V 3.2 Version 5.
2 Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004,
3 2007 Free Software Foundation, Inc.
4 Contributed by Kean Johnston (jkj@sco.com)
6 This file is part of GCC.
8 GCC 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 3, or (at your option)
13 GCC 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.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
23 #define TARGET_VERSION fprintf (stderr, " (i386, SCO OpenServer 5 Syntax)");
28 #define GLOBAL_ASM_OP "\t.globl\t"
30 #undef BSS_SECTION_ASM_OP
31 #define BSS_SECTION_ASM_OP "\t.section\t.bss, \"aw\", @nobits"
34 * NOTE: We really do want CTORS_SECTION_ASM_OP and DTORS_SECTION_ASM_OP.
35 * Here's the reason why. If we dont define them, and we dont define them
36 * to always emit to the same section, the default is to emit to "named"
37 * ctors and dtors sections. This would be great if we could use GNU ld,
38 * but we can't. The native linker could possibly be trained to coalesce
39 * named ctors sections, but that hasn't been done either. So if we don't
40 * define these, many C++ ctors and dtors dont get run, because they never
41 * wind up in the ctors/dtors arrays.
43 #define CTORS_SECTION_ASM_OP "\t.section\t.ctors, \"aw\""
44 #define DTORS_SECTION_ASM_OP "\t.section\t.dtors, \"aw\""
46 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
47 #undef X86_FILE_START_VERSION_DIRECTIVE
48 #define X86_FILE_START_VERSION_DIRECTIVE true
50 /* A C statement (sans semicolon) to output to the stdio stream
51 FILE the assembler definition of uninitialized global DECL named
52 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
53 Try to use asm_output_aligned_bss to implement this macro. */
55 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
56 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
58 #undef DBX_REGISTER_NUMBER
59 #define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n]
61 #define DWARF2_DEBUGGING_INFO 1
62 #define DBX_DEBUGGING_INFO 1
64 #undef PREFERRED_DEBUGGING_TYPE
65 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
67 #undef DWARF2_UNWIND_INFO
68 #define DWARF2_UNWIND_INFO 1
70 #undef NO_IMPLICIT_EXTERN_C
71 #define NO_IMPLICIT_EXTERN_C 1
73 #undef SWITCH_TAKES_ARG
74 #define SWITCH_TAKES_ARG(CHAR) \
75 (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
81 #undef WORD_SWITCH_TAKES_ARG
82 #define WORD_SWITCH_TAKES_ARG(STR) \
83 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
84 && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \
85 && strcmp (STR, "Tbss"))
87 #undef TARGET_SUBTARGET_DEFAULT
88 #define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
91 * Define sizes and types
96 #undef WCHAR_TYPE_SIZE
98 #define SIZE_TYPE "unsigned int"
99 #define PTRDIFF_TYPE "int"
100 #define WCHAR_TYPE "long int"
101 #define WCHAR_TYPE_SIZE BITS_PER_WORD
102 #define WINT_TYPE "long int"
105 * New for multilib support. Set the default switches for multilib,
108 #define MULTILIB_DEFAULTS { "melf" }
111 /* Please note that these specs may look messy but they are required in
112 order to emulate the SCO Development system as closely as possible.
113 With SCO Open Server 5.0, you now get the linker and assembler free,
114 so that is what these specs are targeted for. These utilities are
115 very argument sensitive: a space in the wrong place breaks everything.
116 So please forgive this mess. It works.
118 Parameters which can be passed to gcc, and their SCO equivalents:
119 GCC Parameter SCO Equivalent
123 -Xpg4plus -a xpg4plus
126 As with SCO, the default is XPG4 plus mode. SCO also allows you to
127 specify a C dialect with -Xt, -Xa, -Xc, -Xk and -Xm. These are passed
128 on to the assembler and linker in the same way that the SCO compiler
131 SCO also allows you to compile, link and generate either ELF or COFF
132 binaries. With gcc, we now only support ELF mode.
134 GCC also requires that the user has installed OSS646, the Execution
135 Environment Update, or is running release 5.0.7 or later. This has
136 many fixes to the ELF link editor and assembler, and a considerably
137 improved libc and RTLD.
139 In terms of tool usage, we want to use the standard link editor always,
140 and either the GNU assembler or the native assembler. With OSS646 the
141 native assembler has grown up quite a bit. Some of the specs below
142 assume that /usr/gnu is the prefix for the GNU tools, because thats
143 where the SCO provided ones go. This is especially important for
144 include and library search path ordering. We want to look in /usr/gnu
145 first because frequently people are linking against -lintl, and they
146 MEAN to link with gettext. What they get is the SCO intl library. Its
147 a REAL pity that GNU gettext chose that name; perhaps in a future
148 version they can be persuaded to change it to -lgnuintl and have a
149 link so that -lintl will work for other systems. The same goes for
150 header files. We want /usr/gnu/include searched for before the system
151 header files. Hence the -isystem /usr/gnu/include in the CPP_SPEC.
152 We get /usr/gnu/lib first by virtue of the MD_STARTFILE_PREFIX below.
155 #define MD_STARTFILE_PREFIX "/usr/gnu/lib/"
156 #define MD_STARTFILE_PREFIX_1 "/usr/ccs/lib/"
159 # define MD_EXEC_PREFIX "/usr/gnu/bin/"
161 # define MD_EXEC_PREFIX "/usr/ccs/bin/elf/"
164 /* Always use the system linker, please. */
165 #ifndef DEFAULT_LINKER
166 # define DEFAULT_LINKER "/usr/ccs/bin/elf/ld"
169 /* Set up assembler flags for PIC and ELF compilations */
173 /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c */
176 "%{Ym,*} %{Yd,*} %{Wa,*:%*} \
177 -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}"
181 * Use crti.o for shared objects, crt1.o for normal executables. Make sure
182 * to recognize both -G and -shared as a valid way of introducing shared
183 * library generation. This is important for backwards compatibility.
186 #undef STARTFILE_SPEC
187 #define STARTFILE_SPEC \
188 "%{pg:%e-pg not supported on this platform} \
189 %{p:%{pp:%e-p and -pp specified - pick one}} \
193 %{pp:pcrt1elf.o%s}%{p:mcrt1.o%s}%{!p:%{!pp:crt1.o%s}}}}} \
195 %{ansi:values-Xc.o%s} \
197 %{traditional:values-Xt.o%s} \
199 %{Xa:values-Xa.o%s} \
200 %{!Xa:%{Xc:values-Xc.o%s} \
201 %{!Xc:%{Xk:values-Xk.o%s} \
202 %{!Xk:%{Xt:values-Xt.o%s} \
203 %{!Xt:values-Xa.o%s}}}}}} \
207 #define ENDFILE_SPEC \
208 "crtend.o%s crtn.o%s"
210 #define TARGET_OS_CPP_BUILTINS() \
213 builtin_define ("__unix"); \
214 builtin_define ("_SCO_DS"); \
215 builtin_define ("_SCO_DS_LL"); \
216 builtin_define ("_SCO_ELF"); \
217 builtin_define ("_M_I386"); \
218 builtin_define ("_M_XENIX"); \
219 builtin_define ("_M_UNIX"); \
220 builtin_assert ("system=svr3"); \
222 cpp_define (pfile, "_STRICT_ANSI"); \
228 -isystem /usr/gnu/include \
229 %{!Xods30:-D_STRICT_NAMES} \
230 %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \
231 %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi} \
233 %{posix:-isystem include/posix%s -isystem /usr/include/posix \
234 -D_POSIX_C_SOURCE=2 -D_POSIX_SOURCE=1} \
235 %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \
237 %{!Xpg4:-D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT \
238 -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII \
239 -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX \
240 %{Xods30:-isystem include/ods_30_compat%s \
241 -isystem /usr/include/ods_30_compat \
242 -D_SCO_ODS_30 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \
243 -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \
245 %{scointl:-DM_INTERNAT -D_M_INTERNAT} \
246 %{Xa:-D_SCO_C_DIALECT=1} \
247 %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \
248 %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \
249 %{!Xk:%{Xt:-D_SCO_C_DIALECT=2} \
250 %{!Xt:-D_SCO_C_DIALECT=1}}}}"
254 "%{!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}}} \
255 %{YP,*} %{YL,*} %{YU,*} \
256 %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \
257 %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \
258 %{h*} %{static:-dn -Bstatic %{G:%e-G and -static are mutually exclusive}} \
259 %{shared:%{!G:-G}} %{G:%{!shared:-G}} %{shared:%{G:-G}} \
260 %{shared:-dy %{symbolic:-Bsymbolic -G} %{z*}} %{R*} %{Y*} \
261 %{Qn:} %{!Qy:-Qn} -z alt_resolve"
263 /* Library spec. If we are not building a shared library, provide the
264 standard libraries, as per the SCO compiler. */
268 "%{shared:%{!G:pic/libgcc.a%s}} \
269 %{G:%{!shared:pic/libgcc.a%s}} \
270 %{shared:%{G:pic/libgcc.a%s}} \
271 %{p:%{!pp:-lelfprof -lelf}} %{pp:%{!p:-lelfprof -lelf}} \
272 %{!shared:%{!symbolic:%{!G:-lcrypt -lgen -lc}}}"
275 #define LIBGCC_SPEC \
276 "%{!shared:%{!G:-lgcc}}"
278 /* Handle special EH pointer encodings. Absolute, pc-relative, and
279 indirect are handled automatically. */
280 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
282 if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \
284 fputs (ASM_LONG, FILE); \
285 assemble_name (FILE, XSTR (ADDR, 0)); \
286 fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
291 /* Used by crtstuff.c to initialize the base of data-relative relocations.
292 These are GOT relative on x86, so return the pic register. */
294 #define CRT_GET_RFIB_DATA(BASE) \
296 register void *ebx_ __asm__("ebx"); \
300 #define CRT_GET_RFIB_DATA(BASE) \
301 __asm__ ("call\t.LPR%=\n" \
304 /* Due to a GAS bug, this cannot use EAX. That encodes \
305 smaller than the traditional EBX, which results in the \
306 offset being off by one. */ \
307 "add{l}\t{$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \
308 "|%0,_GLOBAL_OFFSET_TABLE_+(.-.LPR%=)}" \