1 /* Definitions of target machine for GNU compiler for Intel 80386
3 Copyright (C) 1988, 1992, 1994, 1996, 1997, 1999 Free Software
5 Contributed by Poul-Henning Kamp <phk@login.dkuug.dk>
7 This file is part of GNU CC.
9 GNU CC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
14 GNU CC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GNU CC; see the file COPYING. If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
24 /* This is tested by i386gas.h. */
25 #define YES_UNDERSCORES
27 /* Don't assume anything about the header files. */
28 #define NO_IMPLICIT_EXTERN_C
30 #include "i386/gstabs.h"
32 /* Get perform_* macros to build libgcc.a. */
33 #include "i386/perform.h"
35 /* This goes away when the math-emulator is fixed */
37 #define TARGET_DEFAULT \
38 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
41 #define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
43 /* Like the default, except no -lg. */
44 #define LIB_SPEC "%{!shared:%{!pg:-lc}%{pg:-lc_p}}"
47 #define SIZE_TYPE "unsigned int"
50 #define PTRDIFF_TYPE "int"
53 #define WCHAR_TYPE "int"
55 #define WCHAR_UNSIGNED 0
57 #undef WCHAR_TYPE_SIZE
58 #define WCHAR_TYPE_SIZE BITS_PER_WORD
62 /* Override the default comment-starter of "/". */
64 #undef ASM_COMMENT_START
65 #define ASM_COMMENT_START "#"
68 #define ASM_APP_ON "#APP\n"
71 #define ASM_APP_OFF "#NO_APP\n"
73 /* FreeBSD using a.out does not support DWARF2 unwinding mechanisms. */
74 #define DWARF2_UNWIND_INFO 0
76 /* The following macros are stolen from i386v4.h */
77 /* These have to be defined to get PIC code correct */
79 /* This is how to output an element of a case-vector that is relative.
80 This is only used for PIC code. See comments by the `casesi' insn in
81 i386.md for an explanation of the expression this outputs. */
83 #undef ASM_OUTPUT_ADDR_DIFF_ELT
84 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
85 fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
87 /* Indicate that jump tables go in the text section. This is
88 necessary when compiling PIC code. */
90 #define JUMP_TABLES_IN_TEXT_SECTION 1
92 /* Don't default to pcc-struct-return, because in FreeBSD we prefer the
93 superior nature of the older gcc way. */
94 #define DEFAULT_PCC_STRUCT_RETURN 0
96 /* Ensure we the configuration knows our system correctly so we can link with
97 libraries compiled with the native cc. */
98 #undef NO_DOLLAR_IN_LABEL
100 /* i386 freebsd still uses old binutils that don't insert nops by default
101 when the .align directive demands to insert extra space in the text
103 #undef ASM_OUTPUT_ALIGN
104 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
105 if ((LOG)!=0) fprintf ((FILE), "\t.align %d,0x90\n", (LOG))
107 /* Profiling routines, partially copied from i386/osfrose.h. */
109 /* Redefine this to use %eax instead of %edx. */
110 #undef FUNCTION_PROFILER
111 #define FUNCTION_PROFILER(FILE, LABELNO) \
115 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n", \
116 LPREFIX, (LABELNO)); \
117 fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
121 fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO)); \
122 fprintf (FILE, "\tcall mcount\n"); \
127 * Some imports from svr4.h in support of shared libraries.
128 * Currently, we need the DECLARE_OBJECT_SIZE stuff.
131 /* Define the strings used for the special svr4 .type and .size directives.
132 These strings generally do not vary from one system running svr4 to
133 another, but if a given system (e.g. m88k running svr) needs to use
134 different pseudo-op names for these, they may be overridden in the
135 file which includes this one. */
137 #define TYPE_ASM_OP ".type"
138 #define SIZE_ASM_OP ".size"
140 /* The following macro defines the format used to output the second
141 operand of the .type assembler directive. Different svr4 assemblers
142 expect various different forms for this operand. The one given here
143 is just a default. You may need to override it in your machine-
144 specific tm.h file (depending upon the particulars of your assembler). */
146 #define TYPE_OPERAND_FMT "@%s"
148 /* Write the extra assembler code needed to declare a function's result.
149 Most svr4 assemblers don't require any special declaration of the
150 result value, but there are exceptions. */
152 #ifndef ASM_DECLARE_RESULT
153 #define ASM_DECLARE_RESULT(FILE, RESULT)
156 /* These macros generate the special .type and .size directives which
157 are used to set the corresponding fields of the linker symbol table
158 entries in an ELF object file under SVR4. These macros also output
159 the starting labels for the relevant functions/objects. */
161 /* Write the extra assembler code needed to declare a function properly.
162 Some svr4 assemblers need to also have something extra said about the
163 function's return value. We allow for that here. */
165 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
167 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
168 assemble_name (FILE, NAME); \
170 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
172 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
173 ASM_OUTPUT_LABEL(FILE, NAME); \
176 /* Write the extra assembler code needed to declare an object properly. */
178 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
180 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
181 assemble_name (FILE, NAME); \
183 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
185 size_directive_output = 0; \
186 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
188 size_directive_output = 1; \
189 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
190 assemble_name (FILE, NAME); \
191 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
193 ASM_OUTPUT_LABEL(FILE, NAME); \
196 /* Output the size directive for a decl in rest_of_decl_compilation
197 in the case where we did not do so before the initializer.
198 Once we find the error_mark_node, we know that the value of
199 size_directive_output was set
200 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
202 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
204 char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
205 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
206 && ! AT_END && TOP_LEVEL \
207 && DECL_INITIAL (DECL) == error_mark_node \
208 && !size_directive_output) \
210 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
211 assemble_name (FILE, name); \
212 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\
217 /* This is how to declare the size of a function. */
219 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
221 if (!flag_inhibit_size_directive) \
224 static int labelno; \
226 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
227 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
228 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
229 assemble_name (FILE, (FNAME)); \
230 fprintf (FILE, ","); \
231 assemble_name (FILE, label); \
232 fprintf (FILE, "-"); \
233 assemble_name (FILE, (FNAME)); \
238 #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}"
240 "%{p:%e`-p' not supported; use `-pg' and gprof(1)} \
241 %{shared:-Bshareable} \
242 %{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \
243 %{pg:-Bstatic} %{Z}} \
246 #define STARTFILE_SPEC \
247 "%{shared:c++rt0.o%s} \
248 %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
250 /* Define this so we can compile MS code for use with WINE. */
251 #define HANDLE_PRAGMA_PACK_PUSH_POP