OSDN Git Service

* config/i386/att.h: Fix comment formatting.
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / freebsd-aout.h
1 /* Definitions of target machine for GNU compiler for Intel 80386
2    running FreeBSD.
3    Copyright (C) 1988, 1992, 1994, 1996, 1997, 1999, 2000 Free Software
4    Foundation, Inc.
5    Contributed by Poul-Henning Kamp <phk@login.dkuug.dk>
6
7 This file is part of GNU CC.
8
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.
13
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.
18
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.  */
23
24 /* This is tested by i386gas.h.  */
25 #define YES_UNDERSCORES
26
27 /* Don't assume anything about the header files.  */
28 #define NO_IMPLICIT_EXTERN_C
29
30 #include "i386/gstabs.h"
31
32 /* This goes away when the math-emulator is fixed */
33 #undef TARGET_SUBTARGET_DEFAULT
34 #define TARGET_SUBTARGET_DEFAULT \
35   (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
36
37 /* The macro defined in i386.h doesn't work with the old gas of
38    FreeBSD 2.x.  The definition in sco.h and sol2.h appears to work,
39    but it turns out that, even though the assembler doesn't complain,
40    we get incorrect results.  Fortunately, the definition in
41    defaults.h works.  */
42 #undef ASM_PREFERRED_EH_DATA_FORMAT
43
44 #undef CPP_PREDEFINES
45 #define CPP_PREDEFINES "-Dunix -D__FreeBSD__\
46  -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
47
48 /* Like the default, except no -lg.  */
49 #define LIB_SPEC "%{!shared:%{!pg:-lc}%{pg:-lc_p}}"
50
51 #undef SIZE_TYPE
52 #define SIZE_TYPE "unsigned int"
53
54 #undef PTRDIFF_TYPE
55 #define PTRDIFF_TYPE "int"
56
57 #undef WCHAR_TYPE
58 #define WCHAR_TYPE "int"
59
60 #define WCHAR_UNSIGNED 0
61
62 #undef WCHAR_TYPE_SIZE
63 #define WCHAR_TYPE_SIZE BITS_PER_WORD
64
65 /* Override the default comment-starter of "/".  */
66
67 #undef ASM_COMMENT_START
68 #define ASM_COMMENT_START "#"
69
70 #undef ASM_APP_ON
71 #define ASM_APP_ON "#APP\n"
72
73 #undef ASM_APP_OFF
74 #define ASM_APP_OFF "#NO_APP\n"
75
76 /* FreeBSD using a.out does not support DWARF2 unwinding mechanisms.  */
77 #define DWARF2_UNWIND_INFO 0
78 \f
79 /* Don't default to pcc-struct-return, because in FreeBSD we prefer the
80    superior nature of the older gcc way.  */
81 #define DEFAULT_PCC_STRUCT_RETURN 0
82
83 /* Ensure we the configuration knows our system correctly so we can link with
84    libraries compiled with the native cc.  */
85 #undef NO_DOLLAR_IN_LABEL
86 \f
87 /* i386 freebsd still uses old binutils that don't insert nops by default
88    when the .align directive demands to insert extra space in the text
89    segment.  */
90 #undef ASM_OUTPUT_ALIGN
91 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
92   if ((LOG)!=0) fprintf ((FILE), "\t.align %d,0x90\n", (LOG))
93 \f
94 /* Profiling routines, partially copied from i386/osfrose.h.  */
95
96 /* Redefine this to use %eax instead of %edx.  */
97 #undef FUNCTION_PROFILER
98 #define FUNCTION_PROFILER(FILE, LABELNO)  \
99 {                                                                       \
100   if (flag_pic)                                                         \
101     {                                                                   \
102       fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n",              \
103                LPREFIX, (LABELNO));                                     \
104       fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n");                    \
105     }                                                                   \
106   else                                                                  \
107     {                                                                   \
108       fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO));      \
109       fprintf (FILE, "\tcall mcount\n");                                \
110     }                                                                   \
111 }
112
113 /*
114  * Some imports from svr4.h in support of shared libraries.
115  * Currently, we need the DECLARE_OBJECT_SIZE stuff.
116  */
117
118 /* Define the strings used for the special svr4 .type and .size directives.
119    These strings generally do not vary from one system running svr4 to
120    another, but if a given system (e.g. m88k running svr) needs to use
121    different pseudo-op names for these, they may be overridden in the
122    file which includes this one.  */
123
124 #define TYPE_ASM_OP     "\t.type\t"
125 #define SIZE_ASM_OP     "\t.size\t"
126
127 /* The following macro defines the format used to output the second
128    operand of the .type assembler directive.  Different svr4 assemblers
129    expect various different forms for this operand.  The one given here
130    is just a default.  You may need to override it in your machine-
131    specific tm.h file (depending upon the particulars of your assembler).  */
132
133 #define TYPE_OPERAND_FMT        "@%s"
134
135 /* Write the extra assembler code needed to declare a function's result.
136    Most svr4 assemblers don't require any special declaration of the
137    result value, but there are exceptions.  */
138
139 #ifndef ASM_DECLARE_RESULT
140 #define ASM_DECLARE_RESULT(FILE, RESULT)
141 #endif
142
143 /* These macros generate the special .type and .size directives which
144    are used to set the corresponding fields of the linker symbol table
145    entries in an ELF object file under SVR4.  These macros also output
146    the starting labels for the relevant functions/objects.  */
147
148 /* Write the extra assembler code needed to declare a function properly.
149    Some svr4 assemblers need to also have something extra said about the
150    function's return value.  We allow for that here.  */
151
152 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                     \
153   do {                                                                  \
154     fprintf (FILE, "%s", TYPE_ASM_OP);                                  \
155     assemble_name (FILE, NAME);                                         \
156     putc (',', FILE);                                                   \
157     fprintf (FILE, TYPE_OPERAND_FMT, "function");                       \
158     putc ('\n', FILE);                                                  \
159     ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));                      \
160     ASM_OUTPUT_LABEL(FILE, NAME);                                       \
161   } while (0)
162
163 /* Write the extra assembler code needed to declare an object properly.  */
164
165 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)                       \
166   do {                                                                  \
167     fprintf (FILE, "%s", TYPE_ASM_OP);                                  \
168     assemble_name (FILE, NAME);                                         \
169     putc (',', FILE);                                                   \
170     fprintf (FILE, TYPE_OPERAND_FMT, "object");                         \
171     putc ('\n', FILE);                                                  \
172     size_directive_output = 0;                                          \
173     if (!flag_inhibit_size_directive && DECL_SIZE (DECL))               \
174       {                                                                 \
175         size_directive_output = 1;                                      \
176         fprintf (FILE, "%s", SIZE_ASM_OP);                              \
177         assemble_name (FILE, NAME);                                     \
178         fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
179       }                                                                 \
180     ASM_OUTPUT_LABEL(FILE, NAME);                                       \
181   } while (0)
182
183 /* Output the size directive for a decl in rest_of_decl_compilation
184    in the case where we did not do so before the initializer.
185    Once we find the error_mark_node, we know that the value of
186    size_directive_output was set
187    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
188
189 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)        \
190 do {                                                                    \
191      const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);            \
192      if (!flag_inhibit_size_directive && DECL_SIZE (DECL)               \
193          && ! AT_END && TOP_LEVEL                                       \
194          && DECL_INITIAL (DECL) == error_mark_node                      \
195          && !size_directive_output)                                     \
196        {                                                                \
197          fprintf (FILE, "%s", SIZE_ASM_OP);                             \
198          assemble_name (FILE, name);                                    \
199          fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL)));\
200         }                                                               \
201    } while (0)
202
203
204 /* This is how to declare the size of a function.  */
205
206 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)                    \
207   do {                                                                  \
208     if (!flag_inhibit_size_directive)                                   \
209       {                                                                 \
210         char label[256];                                                \
211         static int labelno;                                             \
212         labelno++;                                                      \
213         ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno);            \
214         ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno);               \
215         fprintf (FILE, "%s", SIZE_ASM_OP);                              \
216         assemble_name (FILE, (FNAME));                                  \
217         fprintf (FILE, ",");                                            \
218         assemble_name (FILE, label);                                    \
219         fprintf (FILE, "-");                                            \
220         assemble_name (FILE, (FNAME));                                  \
221         putc ('\n', FILE);                                              \
222       }                                                                 \
223   } while (0)
224
225 #define ASM_SPEC   " %| %{fpic:-k} %{fPIC:-k}"
226 #define LINK_SPEC \
227   "%{p:%e`-p' not supported; use `-pg' and gprof(1)} \
228    %{shared:-Bshareable} \
229    %{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \
230    %{pg:-Bstatic} %{Z}} \
231    %{assert*} %{R*}"
232
233 #define STARTFILE_SPEC  \
234   "%{shared:c++rt0.o%s} \
235    %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
236
237 /* Define this so we can compile MS code for use with WINE.  */
238 #define HANDLE_PRAGMA_PACK_PUSH_POP