OSDN Git Service

89dae55f997241dfd4d338b1813414019c328036
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / sco5.h
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
3    Free Software Foundation, Inc.
4    Contributed by Kean Johnston (jkj@sco.com)
5
6 This file is part of GNU CC.
7
8 GNU CC 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 2, or (at your option)
11 any later version.
12
13 GNU CC 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.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23 #undef TARGET_VERSION
24 #define TARGET_VERSION fprintf (stderr, " (i386, SCO OpenServer 5 Syntax)");
25
26 #undef ASM_QUAD
27
28 #undef GLOBAL_ASM_OP
29 #define GLOBAL_ASM_OP                   "\t.globl\t"
30
31 #undef BSS_SECTION_ASM_OP
32 #define BSS_SECTION_ASM_OP              "\t.section\t.bss, \"aw\", @nobits"
33   
34 /*
35  * NOTE: We really do want CTORS_SECTION_ASM_OP and DTORS_SECTION_ASM_OP.
36  * Here's the reason why. If we dont define them, and we dont define them
37  * to always emit to the same section, the default is to emit to "named"
38  * ctors and dtors sections. This would be great if we could use GNU ld,
39  * but we can't. The native linker could possibly be trained to coallesce
40  * named ctors sections, but that hasn't been done either. So if we don't
41  * define these, many C++ ctors and dtors dont get run, because they never
42  * wind up in the ctors/dtors arrays.
43  */
44 #define CTORS_SECTION_ASM_OP            "\t.section\t.ctors, \"aw\""
45 #define DTORS_SECTION_ASM_OP            "\t.section\t.dtors, \"aw\""
46
47 #undef ASM_FILE_START_1
48 #define ASM_FILE_START_1(FILE)
49
50 #undef ASM_FILE_START
51 #define ASM_FILE_START(FILE)                                            \
52 do {                                                                    \
53   output_file_directive((FILE),main_input_filename);                    \
54   fprintf ((FILE), "\t.version\t\"01.01\"\n");                          \
55 } while (0)
56
57 /* A C statement (sans semicolon) to output to the stdio stream
58    FILE the assembler definition of uninitialized global DECL named
59    NAME whose size is SIZE bytes and alignment is ALIGN bytes.
60    Try to use asm_output_aligned_bss to implement this macro.  */
61
62 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
63   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
64
65 #undef DBX_REGISTER_NUMBER
66 #define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
67
68 #define DWARF2_DEBUGGING_INFO           1
69 #define DWARF_DEBUGGING_INFO            1
70 #define DBX_DEBUGGING_INFO              1
71
72 #undef PREFERRED_DEBUGGING_TYPE
73 #define PREFERRED_DEBUGGING_TYPE        DWARF2_DEBUG
74
75 #undef DWARF2_UNWIND_INFO
76 #define DWARF2_UNWIND_INFO              1
77
78 #undef NO_IMPLICIT_EXTERN_C
79 #define NO_IMPLICIT_EXTERN_C            1
80
81 #undef SWITCH_TAKES_ARG
82 #define SWITCH_TAKES_ARG(CHAR)                                          \
83   (DEFAULT_SWITCH_TAKES_ARG(CHAR)                                       \
84    || (CHAR) == 'h'                                                     \
85    || (CHAR) == 'R'                                                     \
86    || (CHAR) == 'Y'                                                     \
87    || (CHAR) == 'z')
88
89 #undef WORD_SWITCH_TAKES_ARG
90 #define WORD_SWITCH_TAKES_ARG(STR)                                      \
91  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                                   \
92   && strcmp (STR, "Tdata") && strcmp (STR, "Ttext")                     \
93   && strcmp (STR, "Tbss"))
94
95 #undef TARGET_SUBTARGET_DEFAULT
96 #define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
97
98 /*
99  * Define sizes and types
100  */
101 #undef SIZE_TYPE
102 #undef PTRDIFF_TYPE
103 #undef WCHAR_TYPE
104 #undef WCHAR_TYPE_SIZE
105 #undef WINT_TYPE
106 #undef LONG_DOUBLE_TYPE_SIZE
107 #define SIZE_TYPE               "unsigned int"
108 #define PTRDIFF_TYPE            "int"
109 #define WCHAR_TYPE              "long int"
110 #define WCHAR_TYPE_SIZE         BITS_PER_WORD
111 #define WINT_TYPE               "long int"
112 #define LONG_DOUBLE_TYPE_SIZE   96
113
114 /*
115  * New for multilib support. Set the default switches for multilib,
116  * which is -melf.
117  */
118 #define MULTILIB_DEFAULTS { "melf" }
119
120 \f
121 /* Please note that these specs may look messy but they are required in
122    order to emulate the SCO Development system as closely as possible.
123    With SCO Open Server 5.0, you now get the linker and assembler free,
124    so that is what these specs are targeted for. These utilities are
125    very argument sensitive: a space in the wrong place breaks everything.
126    So please forgive this mess. It works.
127
128    Parameters which can be passed to gcc, and their SCO equivalents:
129    GCC Parameter                SCO Equivalent
130    -ansi                        -a ansi
131    -posix                       -a posix
132    -Xpg4                        -a xpg4
133    -Xpg4plus                    -a xpg4plus
134    -Xods30                      -a ods30
135
136    As with SCO, the default is XPG4 plus mode. SCO also allows you to
137    specify a C dialect with -Xt, -Xa, -Xc, -Xk and -Xm. These are passed
138    on to the assembler and linker in the same way that the SCO compiler
139    does.
140
141    SCO also allows you to compile, link and generate either ELF or COFF
142    binaries. With gcc, we now only support ELF mode.
143
144    GCC also requires that the user has installed OSS646, the Execution
145    Environment Update, or is running release 5.0.7 or later. This has
146    many fixes to the ELF link editor and assembler, and a considerably
147    improved libc and RTLD.
148
149    In terms of tool usage, we want to use the standard link editor always,
150    and either the GNU assembler or the native assembler. With OSS646 the
151    native assembler has grown up quite a bit. Some of the specs below
152    assume that /usr/gnu is the prefix for the GNU tools, because thats
153    where the SCO provided ones go. This is especially important for
154    include and library search path ordering. We want to look in /usr/gnu
155    first, becuase frequently people are linking against -lintl, and they
156    MEAN to link with gettext. What they get is the SCO intl library. Its
157    a REAL pity that GNU gettext chose that name; perhaps in a future
158    version they can be persuaded to change it to -lgnuintl and have a
159    link so that -lintl will work for other systems. The same goes for
160    header files. We want /usr/gnu/include searched for before the system
161    header files. Hence the -isystem /usr/gnu/include in the CPP_SPEC.
162    We get /usr/gnu/lib first by virtue of the MD_STARTFILE_PREFIX below.
163 */
164
165 #define MD_STARTFILE_PREFIX     "/usr/gnu/lib/"
166 #define MD_STARTFILE_PREFIX_1   "/usr/ccs/lib/"
167
168 #if USE_GAS
169 # define MD_EXEC_PREFIX         "/usr/gnu/bin/"
170 #else
171 # define MD_EXEC_PREFIX         "/usr/ccs/bin/elf/"
172 #endif
173
174 /* Always use the system linker, please.  */
175 #ifndef DEFAULT_LINKER
176 # define DEFAULT_LINKER         "/usr/ccs/bin/elf/ld"
177 #endif
178
179 /* Set up assembler flags for PIC and ELF compilations */
180 #undef ASM_SPEC
181
182 #if USE_GAS
183   /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c  */
184 #else
185 #define ASM_SPEC \
186    "%{Ym,*} %{Yd,*} %{Wa,*:%*} \
187     -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}"
188 #endif
189
190 /*
191  * Use crti.o for shared objects, crt1.o for normal executables. Make sure
192  * to recognize both -G and -shared as a valid way of introducing shared
193  * library generation. This is important for backwards compatibility.
194  */
195
196 #undef STARTFILE_SPEC
197 #define STARTFILE_SPEC \
198  "%{pg:%e-pg not supported on this platform} \
199   %{p:%{pp:%e-p and -pp specified - pick one}} \
200  %{!shared:\
201    %{!symbolic: \
202     %{!G: \
203      %{pp:pcrt1elf.o%s}%{p:mcrt1.o%s}%{!p:%{!pp:crt1.o%s}}}}} \
204   crti.o%s \
205   %{ansi:values-Xc.o%s} \
206   %{!ansi: \
207    %{traditional:values-Xt.o%s} \
208     %{!traditional: \
209      %{Xa:values-Xa.o%s} \
210       %{!Xa:%{Xc:values-Xc.o%s} \
211        %{!Xc:%{Xk:values-Xk.o%s} \
212         %{!Xk:%{Xt:values-Xt.o%s} \
213          %{!Xt:values-Xa.o%s}}}}}} \
214   crtbegin.o%s"
215
216 #undef ENDFILE_SPEC
217 #define ENDFILE_SPEC \
218  "crtend.o%s crtn.o%s"
219
220 #define TARGET_OS_CPP_BUILTINS()                                \
221   do                                                            \
222     {                                                           \
223         builtin_define ("__unix");                              \
224         builtin_define ("_SCO_DS");                             \
225         builtin_define ("_SCO_DS_LL");                          \
226         builtin_define ("_SCO_ELF");                            \
227         builtin_define ("_M_I386");                             \
228         builtin_define ("_M_XENIX");                            \
229         builtin_define ("_M_UNIX");                             \
230         builtin_assert ("system=svr3");                         \
231         if (flag_iso)                                           \
232           cpp_define (pfile, "_STRICT_ANSI");                   \
233         if (flag_pic)                                           \
234           {                                                     \
235             builtin_define ("__PIC__");                         \
236             builtin_define ("__pic__");                         \
237           }                                                     \
238     }                                                           \
239   while (0)
240
241 #undef CPP_SPEC
242 #define CPP_SPEC "\
243   -isystem /usr/gnu/include \
244   %{!Xods30:-D_STRICT_NAMES} \
245   %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \
246   %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi} \
247   %{!ansi: \
248    %{posix:-isystem include/posix%s -isystem /usr/include/posix \
249            -D_POSIX_C_SOURCE=2 -D_POSIX_SOURCE=1} \
250     %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \
251                     -D_XOPEN_SOURCE=1} \
252      %{!Xpg4:-D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT \
253              -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII \
254              -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX \
255              %{Xods30:-isystem include/ods_30_compat%s \
256                       -isystem /usr/include/ods_30_compat \
257                       -D_SCO_ODS_30 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \
258                       -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \
259                       -DM_WORDSWAP}}}} \
260   %{scointl:-DM_INTERNAT -D_M_INTERNAT} \
261   %{Xa:-D_SCO_C_DIALECT=1} \
262   %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \
263    %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \
264     %{!Xk:%{Xt:-D_SCO_C_DIALECT=2} \
265      %{!Xt:-D_SCO_C_DIALECT=1}}}}"
266
267 #undef LINK_SPEC
268 #define LINK_SPEC \
269  "%{!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}}} \
270   %{Wl,*:%*} %{YP,*} %{YL,*} %{YU,*} \
271   %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \
272    %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \
273   %{h*} %{static:-dn -Bstatic %{G:%e-G and -static are mutually exclusive}} \
274   %{shared:%{!G:-G}} %{G:%{!shared:-G}} %{shared:%{G:-G}} \
275   %{shared:-dy %{symbolic:-Bsymbolic -G} %{z*}} %{R*} %{Y*} \
276   %{Qn:} %{!Qy:-Qn} -z alt_resolve"
277
278 /* Library spec. If we are not building a shared library, provide the
279    standard libraries, as per the SCO compiler.  */
280
281 #undef LIB_SPEC
282 #define LIB_SPEC \
283  "%{shared:%{!G:pic/libgcc.a%s}} \
284   %{G:%{!shared:pic/libgcc.a%s}} \
285   %{shared:%{G:pic/libgcc.a%s}} \
286   %{p:%{!pp:-lelfprof -lelf}} %{pp:%{!p:-lelfprof -lelf}} \
287   %{!shared:%{!symbolic:%{!G:-lcrypt -lgen -lc}}}"
288
289 #undef LIBGCC_SPEC
290 #define LIBGCC_SPEC \
291  "%{!shared:%{!G:-lgcc}}"
292
293 /* Here for legacy support only so we still accept -melf flag */
294 #define MASK_COFF               010000000000    /* Mask for COFF generation */
295 #define TARGET_ELF              (1)
296
297 #undef SUBTARGET_SWITCHES
298 #define SUBTARGET_SWITCHES                                      \
299         { "elf", -MASK_COFF, N_("Generate ELF output")  },
300
301 /* Handle special EH pointer encodings.  Absolute, pc-relative, and
302    indirect are handled automatically.  */
303 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
304   do {                                                                  \
305     if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel)         \
306       {                                                                 \
307         fputs (ASM_LONG, FILE);                                         \
308         assemble_name (FILE, XSTR (ADDR, 0));                           \
309         fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
310         goto DONE;                                                      \
311       }                                                                 \
312   } while (0)
313
314 /* Used by crtstuff.c to initialize the base of data-relative relocations.
315    These are GOT relative on x86, so return the pic register.  */
316 #ifdef __PIC__
317 #define CRT_GET_RFIB_DATA(BASE)                 \
318   {                                             \
319     register void *ebx_ __asm__("ebx");         \
320     BASE = ebx_;                                \
321   }
322 #else
323 #define CRT_GET_RFIB_DATA(BASE)                                         \
324   __asm__ ("call\t.LPR%=\n"                                             \
325            ".LPR%=:\n\t"                                                \
326            "popl\t%0\n\t"                                               \
327            /* Due to a GAS bug, this cannot use EAX.  That encodes      \
328               smaller than the traditional EBX, which results in the    \
329               offset being off by one.  */                              \
330            "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0"                 \
331            : "=d"(BASE))
332 #endif
333