* rtl.h (rtunion_def): Constify member `rtstr'.
[official-gcc.git] / gcc / config / i386 / freebsd.h
blobb83423556039a6ad702eb3e68aa29f583e4e5f0b
1 /* Definitions of target machine for GNU compiler for Intel 80386
2 running FreeBSD.
3 Copyright (C) 1988, 1992, 1994, 1996, 1997, 1999 Free Software
4 Foundation, Inc.
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)
12 any later version.
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 /* This goes away when the math-emulator is fixed */
33 #undef TARGET_DEFAULT
34 #define TARGET_DEFAULT \
35 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
37 #undef CPP_PREDEFINES
38 #define CPP_PREDEFINES "-Dunix -D__FreeBSD__\
39 -Asystem(unix) -Asystem(bsd) -Asystem(FreeBSD)"
41 /* Like the default, except no -lg. */
42 #define LIB_SPEC "%{!shared:%{!pg:-lc}%{pg:-lc_p}}"
44 #undef SIZE_TYPE
45 #define SIZE_TYPE "unsigned int"
47 #undef PTRDIFF_TYPE
48 #define PTRDIFF_TYPE "int"
50 #undef WCHAR_TYPE
51 #define WCHAR_TYPE "int"
53 #define WCHAR_UNSIGNED 0
55 #undef WCHAR_TYPE_SIZE
56 #define WCHAR_TYPE_SIZE BITS_PER_WORD
58 /* Override the default comment-starter of "/". */
60 #undef ASM_COMMENT_START
61 #define ASM_COMMENT_START "#"
63 #undef ASM_APP_ON
64 #define ASM_APP_ON "#APP\n"
66 #undef ASM_APP_OFF
67 #define ASM_APP_OFF "#NO_APP\n"
69 /* FreeBSD using a.out does not support DWARF2 unwinding mechanisms. */
70 #define DWARF2_UNWIND_INFO 0
72 /* The following macros are stolen from i386v4.h */
73 /* These have to be defined to get PIC code correct */
75 /* This is how to output an element of a case-vector that is relative.
76 This is only used for PIC code. See comments by the `casesi' insn in
77 i386.md for an explanation of the expression this outputs. */
79 #undef ASM_OUTPUT_ADDR_DIFF_ELT
80 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
81 fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
83 /* Indicate that jump tables go in the text section. This is
84 necessary when compiling PIC code. */
86 #define JUMP_TABLES_IN_TEXT_SECTION 1
88 /* Don't default to pcc-struct-return, because in FreeBSD we prefer the
89 superior nature of the older gcc way. */
90 #define DEFAULT_PCC_STRUCT_RETURN 0
92 /* Ensure we the configuration knows our system correctly so we can link with
93 libraries compiled with the native cc. */
94 #undef NO_DOLLAR_IN_LABEL
96 /* i386 freebsd still uses old binutils that don't insert nops by default
97 when the .align directive demands to insert extra space in the text
98 segment. */
99 #undef ASM_OUTPUT_ALIGN
100 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
101 if ((LOG)!=0) fprintf ((FILE), "\t.align %d,0x90\n", (LOG))
103 /* Profiling routines, partially copied from i386/osfrose.h. */
105 /* Redefine this to use %eax instead of %edx. */
106 #undef FUNCTION_PROFILER
107 #define FUNCTION_PROFILER(FILE, LABELNO) \
109 if (flag_pic) \
111 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n", \
112 LPREFIX, (LABELNO)); \
113 fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
115 else \
117 fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO)); \
118 fprintf (FILE, "\tcall mcount\n"); \
123 * Some imports from svr4.h in support of shared libraries.
124 * Currently, we need the DECLARE_OBJECT_SIZE stuff.
127 /* Define the strings used for the special svr4 .type and .size directives.
128 These strings generally do not vary from one system running svr4 to
129 another, but if a given system (e.g. m88k running svr) needs to use
130 different pseudo-op names for these, they may be overridden in the
131 file which includes this one. */
133 #define TYPE_ASM_OP ".type"
134 #define SIZE_ASM_OP ".size"
136 /* The following macro defines the format used to output the second
137 operand of the .type assembler directive. Different svr4 assemblers
138 expect various different forms for this operand. The one given here
139 is just a default. You may need to override it in your machine-
140 specific tm.h file (depending upon the particulars of your assembler). */
142 #define TYPE_OPERAND_FMT "@%s"
144 /* Write the extra assembler code needed to declare a function's result.
145 Most svr4 assemblers don't require any special declaration of the
146 result value, but there are exceptions. */
148 #ifndef ASM_DECLARE_RESULT
149 #define ASM_DECLARE_RESULT(FILE, RESULT)
150 #endif
152 /* These macros generate the special .type and .size directives which
153 are used to set the corresponding fields of the linker symbol table
154 entries in an ELF object file under SVR4. These macros also output
155 the starting labels for the relevant functions/objects. */
157 /* Write the extra assembler code needed to declare a function properly.
158 Some svr4 assemblers need to also have something extra said about the
159 function's return value. We allow for that here. */
161 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
162 do { \
163 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
164 assemble_name (FILE, NAME); \
165 putc (',', FILE); \
166 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
167 putc ('\n', FILE); \
168 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
169 ASM_OUTPUT_LABEL(FILE, NAME); \
170 } while (0)
172 /* Write the extra assembler code needed to declare an object properly. */
174 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
175 do { \
176 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
177 assemble_name (FILE, NAME); \
178 putc (',', FILE); \
179 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
180 putc ('\n', FILE); \
181 size_directive_output = 0; \
182 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
184 size_directive_output = 1; \
185 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
186 assemble_name (FILE, NAME); \
187 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
189 ASM_OUTPUT_LABEL(FILE, NAME); \
190 } while (0)
192 /* Output the size directive for a decl in rest_of_decl_compilation
193 in the case where we did not do so before the initializer.
194 Once we find the error_mark_node, we know that the value of
195 size_directive_output was set
196 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
198 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
199 do { \
200 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
201 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
202 && ! AT_END && TOP_LEVEL \
203 && DECL_INITIAL (DECL) == error_mark_node \
204 && !size_directive_output) \
206 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
207 assemble_name (FILE, name); \
208 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\
210 } while (0)
213 /* This is how to declare the size of a function. */
215 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
216 do { \
217 if (!flag_inhibit_size_directive) \
219 char label[256]; \
220 static int labelno; \
221 labelno++; \
222 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
223 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
224 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
225 assemble_name (FILE, (FNAME)); \
226 fprintf (FILE, ","); \
227 assemble_name (FILE, label); \
228 fprintf (FILE, "-"); \
229 assemble_name (FILE, (FNAME)); \
230 putc ('\n', FILE); \
232 } while (0)
234 #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}"
235 #define LINK_SPEC \
236 "%{p:%e`-p' not supported; use `-pg' and gprof(1)} \
237 %{shared:-Bshareable} \
238 %{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \
239 %{pg:-Bstatic} %{Z}} \
240 %{assert*} %{R*}"
242 #define STARTFILE_SPEC \
243 "%{shared:c++rt0.o%s} \
244 %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
246 /* Define this so we can compile MS code for use with WINE. */
247 #define HANDLE_PRAGMA_PACK_PUSH_POP