OSDN Git Service

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