1 /* Definitions of target machine for GNU compiler for Intel 80386
3 Copyright (C) 1988, 1992, 1994, 1996, 1997, 1999, 2000, 2002
4 Free Software Foundation, Inc.
5 Contributed by Poul-Henning Kamp <phk@login.dkuug.dk>
6 Continued development by David O'Brien <obrien@NUXI.org>
8 This file is part of GNU CC.
10 GNU CC is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
15 GNU CC is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with GNU CC; see the file COPYING. If not, write to
22 the Free Software Foundation, 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
25 /* Don't assume anything about the header files. */
26 #define NO_IMPLICIT_EXTERN_C
28 /* This goes away when the math-emulator is fixed */
29 #undef TARGET_SUBTARGET_DEFAULT
30 #define TARGET_SUBTARGET_DEFAULT \
31 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
33 /* The macro defined in i386.h doesn't work with the old gas of
34 FreeBSD 2.x. The definition in sco.h and sol2.h appears to work,
35 but it turns out that, even though the assembler doesn't complain,
36 we get incorrect results. Fortunately, the definition in
38 #undef ASM_PREFERRED_EH_DATA_FORMAT
41 #define CPP_PREDEFINES "-Dunix -D__FreeBSD__\
42 -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
44 /* Like the default, except no -lg. */
45 #define LIB_SPEC "%{!shared:%{!pg:-lc}%{pg:-lc_p}}"
48 #define SIZE_TYPE "unsigned int"
51 #define PTRDIFF_TYPE "int"
54 #define WCHAR_TYPE "int"
56 #define WCHAR_UNSIGNED 0
58 #undef WCHAR_TYPE_SIZE
59 #define WCHAR_TYPE_SIZE BITS_PER_WORD
61 /* Override the default comment-starter of "/". */
63 #undef ASM_COMMENT_START
64 #define ASM_COMMENT_START "#"
67 #define ASM_APP_ON "#APP\n"
70 #define ASM_APP_OFF "#NO_APP\n"
72 /* FreeBSD using a.out does not support DWARF2 unwinding mechanisms. */
73 #define DWARF2_UNWIND_INFO 0
75 /* Don't default to pcc-struct-return, because in FreeBSD we prefer the
76 superior nature of the older gcc way. */
77 #define DEFAULT_PCC_STRUCT_RETURN 0
79 /* Ensure we the configuration knows our system correctly so we can link with
80 libraries compiled with the native cc. */
81 #undef NO_DOLLAR_IN_LABEL
83 /* i386 freebsd still uses old binutils that don't insert nops by default
84 when the .align directive demands to insert extra space in the text
86 #undef ASM_OUTPUT_ALIGN
87 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
88 if ((LOG)!=0) fprintf ((FILE), "\t.align %d,0x90\n", (LOG))
90 /* Profiling routines, partially copied from i386/osfrose.h. */
92 /* Redefine this to use %eax instead of %edx. */
93 #undef FUNCTION_PROFILER
94 #define FUNCTION_PROFILER(FILE, LABELNO) \
98 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n", \
99 LPREFIX, (LABELNO)); \
100 fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
104 fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO)); \
105 fprintf (FILE, "\tcall mcount\n"); \
110 * Some imports from svr4.h in support of shared libraries.
111 * Currently, we need the DECLARE_OBJECT_SIZE stuff.
114 /* Define the strings used for the special svr4 .type and .size directives.
115 These strings generally do not vary from one system running svr4 to
116 another, but if a given system (e.g. m88k running svr) needs to use
117 different pseudo-op names for these, they may be overridden in the
118 file which includes this one. */
120 #define TYPE_ASM_OP "\t.type\t"
121 #define SIZE_ASM_OP "\t.size\t"
123 /* The following macro defines the format used to output the second
124 operand of the .type assembler directive. Different svr4 assemblers
125 expect various different forms for this operand. The one given here
126 is just a default. You may need to override it in your machine-
127 specific tm.h file (depending upon the particulars of your assembler). */
129 #define TYPE_OPERAND_FMT "@%s"
131 /* Write the extra assembler code needed to declare a function's result.
132 Most svr4 assemblers don't require any special declaration of the
133 result value, but there are exceptions. */
135 #ifndef ASM_DECLARE_RESULT
136 #define ASM_DECLARE_RESULT(FILE, RESULT)
139 /* These macros generate the special .type and .size directives which
140 are used to set the corresponding fields of the linker symbol table
141 entries in an ELF object file under SVR4. These macros also output
142 the starting labels for the relevant functions/objects. */
144 /* Write the extra assembler code needed to declare a function properly.
145 Some svr4 assemblers need to also have something extra said about the
146 function's return value. We allow for that here. */
148 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
150 fprintf (FILE, "%s", TYPE_ASM_OP); \
151 assemble_name (FILE, NAME); \
153 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
155 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
156 ASM_OUTPUT_LABEL(FILE, NAME); \
159 /* Write the extra assembler code needed to declare an object properly. */
161 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
163 fprintf (FILE, "%s", TYPE_ASM_OP); \
164 assemble_name (FILE, NAME); \
166 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
168 size_directive_output = 0; \
169 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
171 size_directive_output = 1; \
172 fprintf (FILE, "%s", SIZE_ASM_OP); \
173 assemble_name (FILE, NAME); \
174 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
176 ASM_OUTPUT_LABEL(FILE, NAME); \
179 /* Output the size directive for a decl in rest_of_decl_compilation
180 in the case where we did not do so before the initializer.
181 Once we find the error_mark_node, we know that the value of
182 size_directive_output was set
183 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
185 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
187 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
188 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
189 && ! AT_END && TOP_LEVEL \
190 && DECL_INITIAL (DECL) == error_mark_node \
191 && !size_directive_output) \
193 fprintf (FILE, "%s", SIZE_ASM_OP); \
194 assemble_name (FILE, name); \
195 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\
200 /* This is how to declare the size of a function. */
202 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
204 if (!flag_inhibit_size_directive) \
207 static int labelno; \
209 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
210 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
211 fprintf (FILE, "%s", SIZE_ASM_OP); \
212 assemble_name (FILE, (FNAME)); \
213 fprintf (FILE, ","); \
214 assemble_name (FILE, label); \
215 fprintf (FILE, "-"); \
216 assemble_name (FILE, (FNAME)); \
221 #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}"
223 "%{p:%e`-p' not supported; use `-pg' and gprof(1)} \
224 %{shared:-Bshareable} \
225 %{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \
226 %{pg:-Bstatic} %{Z}} \
229 #define STARTFILE_SPEC \
230 "%{shared:c++rt0.o%s} \
231 %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
233 /* Define this so we can compile MS code for use with WINE. */
234 #define HANDLE_PRAGMA_PACK_PUSH_POP
236 /* FreeBSD 2.2.7's assembler does not support .quad properly. Do not