* config/i386/netbsd-elf.h (TARGET_OS_CPP_BUILTINS): Define.
[official-gcc.git] / gcc / config / i386 / freebsd-aout.h
blob7f8a4fe811c056eaff88af9a061bcd14fded6859
1 /* Definitions of target machine for GNU compiler for Intel 80386
2 running FreeBSD.
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)
13 any later version.
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
37 defaults.h works. */
38 #undef ASM_PREFERRED_EH_DATA_FORMAT
40 #undef CPP_PREDEFINES
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}}"
47 #undef SIZE_TYPE
48 #define SIZE_TYPE "unsigned int"
50 #undef PTRDIFF_TYPE
51 #define PTRDIFF_TYPE "int"
53 #undef WCHAR_TYPE
54 #define WCHAR_TYPE "int"
56 #undef WCHAR_TYPE_SIZE
57 #define WCHAR_TYPE_SIZE BITS_PER_WORD
59 /* Override the default comment-starter of "/". */
61 #undef ASM_COMMENT_START
62 #define ASM_COMMENT_START "#"
64 #undef ASM_APP_ON
65 #define ASM_APP_ON "#APP\n"
67 #undef ASM_APP_OFF
68 #define ASM_APP_OFF "#NO_APP\n"
70 /* FreeBSD using a.out does not support DWARF2 unwinding mechanisms. */
71 #define DWARF2_UNWIND_INFO 0
73 /* Don't default to pcc-struct-return, because in FreeBSD we prefer the
74 superior nature of the older gcc way. */
75 #define DEFAULT_PCC_STRUCT_RETURN 0
77 /* Ensure we the configuration knows our system correctly so we can link with
78 libraries compiled with the native cc. */
79 #undef NO_DOLLAR_IN_LABEL
81 /* i386 freebsd still uses old binutils that don't insert nops by default
82 when the .align directive demands to insert extra space in the text
83 segment. */
84 #undef ASM_OUTPUT_ALIGN
85 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
86 if ((LOG)!=0) fprintf ((FILE), "\t.align %d,0x90\n", (LOG))
88 /* Profiling routines, partially copied from i386/osfrose.h. */
90 /* Redefine this to use %eax instead of %edx. */
91 #undef FUNCTION_PROFILER
92 #define FUNCTION_PROFILER(FILE, LABELNO) \
93 { \
94 if (flag_pic) \
95 { \
96 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n", \
97 LPREFIX, (LABELNO)); \
98 fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
99 } \
100 else \
102 fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO)); \
103 fprintf (FILE, "\tcall mcount\n"); \
108 * Some imports from svr4.h in support of shared libraries.
109 * Currently, we need the DECLARE_OBJECT_SIZE stuff.
112 /* Define the strings used for the special svr4 .type and .size directives.
113 These strings generally do not vary from one system running svr4 to
114 another, but if a given system (e.g. m88k running svr) needs to use
115 different pseudo-op names for these, they may be overridden in the
116 file which includes this one. */
118 #define TYPE_ASM_OP "\t.type\t"
119 #define SIZE_ASM_OP "\t.size\t"
121 /* The following macro defines the format used to output the second
122 operand of the .type assembler directive. Different svr4 assemblers
123 expect various different forms for this operand. The one given here
124 is just a default. You may need to override it in your machine-
125 specific tm.h file (depending upon the particulars of your assembler). */
127 #define TYPE_OPERAND_FMT "@%s"
129 /* Write the extra assembler code needed to declare a function's result.
130 Most svr4 assemblers don't require any special declaration of the
131 result value, but there are exceptions. */
133 #ifndef ASM_DECLARE_RESULT
134 #define ASM_DECLARE_RESULT(FILE, RESULT)
135 #endif
137 /* These macros generate the special .type and .size directives which
138 are used to set the corresponding fields of the linker symbol table
139 entries in an ELF object file under SVR4. These macros also output
140 the starting labels for the relevant functions/objects. */
142 /* Write the extra assembler code needed to declare a function properly.
143 Some svr4 assemblers need to also have something extra said about the
144 function's return value. We allow for that here. */
146 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
147 do { \
148 fprintf (FILE, "%s", TYPE_ASM_OP); \
149 assemble_name (FILE, NAME); \
150 putc (',', FILE); \
151 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
152 putc ('\n', FILE); \
153 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
154 ASM_OUTPUT_LABEL(FILE, NAME); \
155 } while (0)
157 /* Write the extra assembler code needed to declare an object properly. */
159 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
160 do { \
161 fprintf (FILE, "%s", TYPE_ASM_OP); \
162 assemble_name (FILE, NAME); \
163 putc (',', FILE); \
164 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
165 putc ('\n', FILE); \
166 size_directive_output = 0; \
167 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
169 size_directive_output = 1; \
170 fprintf (FILE, "%s", SIZE_ASM_OP); \
171 assemble_name (FILE, NAME); \
172 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
174 ASM_OUTPUT_LABEL(FILE, NAME); \
175 } while (0)
177 /* Output the size directive for a decl in rest_of_decl_compilation
178 in the case where we did not do so before the initializer.
179 Once we find the error_mark_node, we know that the value of
180 size_directive_output was set
181 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
183 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
184 do { \
185 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
186 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
187 && ! AT_END && TOP_LEVEL \
188 && DECL_INITIAL (DECL) == error_mark_node \
189 && !size_directive_output) \
191 fprintf (FILE, "%s", SIZE_ASM_OP); \
192 assemble_name (FILE, name); \
193 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\
195 } while (0)
198 /* This is how to declare the size of a function. */
200 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
201 do { \
202 if (!flag_inhibit_size_directive) \
204 char label[256]; \
205 static int labelno; \
206 labelno++; \
207 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
208 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
209 fprintf (FILE, "%s", SIZE_ASM_OP); \
210 assemble_name (FILE, (FNAME)); \
211 fprintf (FILE, ","); \
212 assemble_name (FILE, label); \
213 fprintf (FILE, "-"); \
214 assemble_name (FILE, (FNAME)); \
215 putc ('\n', FILE); \
217 } while (0)
219 #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}"
220 #define LINK_SPEC \
221 "%{p:%e`-p' not supported; use `-pg' and gprof(1)} \
222 %{shared:-Bshareable} \
223 %{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \
224 %{pg:-Bstatic} %{Z}} \
225 %{assert*} %{R*}"
227 #define STARTFILE_SPEC \
228 "%{shared:c++rt0.o%s} \
229 %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
231 /* Define this so we can compile MS code for use with WINE. */
232 #define HANDLE_PRAGMA_PACK_PUSH_POP
234 /* FreeBSD 2.2.7's assembler does not support .quad properly. Do not
235 use it. */
236 #undef ASM_QUAD