]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/gcc/config/i386/freebsd.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / gcc / config / i386 / freebsd.h
1 /* Definitions for Intel 386 running FreeBSD with ELF format
2    Copyright (C) 1996, 2000, 2002, 2004 Free Software Foundation, Inc.
3    Contributed by Eric Youngdale.
4    Modified for stabs-in-ELF by H.J. Lu.
5    Adapted from GNU/Linux version by John Polstra.
6    Continued development by David O'Brien <obrien@freebsd.org>
7
8 This file is part of GCC.
9
10 GCC 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.
14
15 GCC 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.
19
20 You should have received a copy of the GNU General Public License
21 along with GCC; see the file COPYING.  If not, write to
22 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23 Boston, MA 02110-1301, USA.  */
24
25 /* $FreeBSD$ */
26
27 #undef  CC1_SPEC
28 #define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
29
30 /* Provide a LINK_SPEC appropriate for FreeBSD.  Here we provide support
31    for the special GCC options -static and -shared, which allow us to
32    link things in one of these three modes by applying the appropriate
33    combinations of options at link-time. We like to support here for
34    as many of the other GNU linker options as possible. But I don't
35    have the time to search for those flags. I am sure how to add
36    support for -soname shared_object_name. H.J.
37
38    When the -shared link option is used a final link is not being
39    done.  */
40
41 #undef  LINK_SPEC
42 #define LINK_SPEC "\
43  %{p:%nconsider using `-pg' instead of `-p' with gprof(1) } \
44     %{v:-V} \
45     %{assert*} %{R*} %{rpath*} %{defsym*} \
46     %{shared:-Bshareable %{h*} %{soname*}} \
47     %{!shared: \
48       %{!static: \
49         %{rdynamic: -export-dynamic} \
50         %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
51       %{static:-Bstatic}} \
52     %{!static:--hash-style=both --enable-new-dtags} \
53     %{symbolic:-Bsymbolic}"
54
55 /* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h
56    but trashed by config/<cpu>/<file.h>. */
57
58 #undef  STARTFILE_SPEC
59 #define STARTFILE_SPEC FBSD_STARTFILE_SPEC
60
61 /* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386.  */
62
63 #undef  ENDFILE_SPEC
64 #define ENDFILE_SPEC FBSD_ENDFILE_SPEC
65
66
67 /************************[  Target stuff  ]***********************************/
68
69 /* Define the actual types of some ANSI-mandated types.
70    Needs to agree with <machine/ansi.h>.  GCC defaults come from c-decl.c,
71    c-common.c, and config/<arch>/<arch>.h.  */
72
73 #undef  SIZE_TYPE
74 #define SIZE_TYPE       (TARGET_64BIT ? "long unsigned int" : "unsigned int")
75
76 #undef  PTRDIFF_TYPE
77 #define PTRDIFF_TYPE    (TARGET_64BIT ? "long int" : "int")
78
79 #undef  WCHAR_TYPE_SIZE
80 #define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD)
81
82 #undef  SUBTARGET_EXTRA_SPECS   /* i386.h bogusly defines it.  */
83 #define SUBTARGET_EXTRA_SPECS \
84   { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
85
86 #define TARGET_VERSION  fprintf (stderr, " (i386 FreeBSD/ELF)");
87
88 #define TARGET_ELF      1
89
90 /* Don't default to pcc-struct-return, we want to retain compatibility with
91    older gcc versions AND pcc-struct-return is nonreentrant.
92    (even though the SVR4 ABI for the i386 says that records and unions are
93    returned in memory).  */
94
95 #undef  DEFAULT_PCC_STRUCT_RETURN
96 #define DEFAULT_PCC_STRUCT_RETURN 0
97
98 /* FreeBSD sets the rounding precision of the FPU to 53 bits.  Let the
99    compiler get the contents of <float.h> and std::numeric_limits correct.  */
100 #undef  TARGET_96_ROUND_53_LONG_DOUBLE
101 #define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT)
102
103 /* Tell final.c that we don't need a label passed to mcount.  */
104 #define NO_PROFILE_COUNTERS     1
105
106 /* Output assembler code to FILE to begin profiling of the current function.
107    LABELNO is an optional label.  */
108
109 #undef  MCOUNT_NAME
110 #define MCOUNT_NAME ".mcount"
111
112 /* Output assembler code to FILE to end profiling of the current function.  */
113
114 #undef  FUNCTION_PROFILER_EPILOGUE      /* BDE will need to fix this. */
115
116
117 /************************[  Assembler stuff  ]********************************/
118
119 /* Override the default comment-starter of "/" from unix.h.  */
120 #undef  ASM_COMMENT_START
121 #define ASM_COMMENT_START "#"
122
123 /* Override the default comment-starter of "/APP" from unix.h.  */
124 #undef  ASM_APP_ON
125 #define ASM_APP_ON      "#APP\n"
126 #undef  ASM_APP_OFF
127 #define ASM_APP_OFF     "#NO_APP\n"
128
129 /* XXX:DEO do we still need this override to defaults.h ?? */
130 /* This is how to output a reference to a user-level label named NAME.  */
131 #undef  ASM_OUTPUT_LABELREF
132 #define ASM_OUTPUT_LABELREF(FILE, NAME)                                 \
133   do {                                                                  \
134     const char *xname = (NAME);                                         \
135     /* Hack to avoid writing lots of rtl in                             \
136        FUNCTION_PROFILER_EPILOGUE ().  */                               \
137     if (*xname == '.' && strcmp(xname + 1, "mexitcount") == 0)          \
138       {                                                                 \
139         if (flag_pic)                                                   \
140           fprintf ((FILE), "*%s@GOT(%%ebx)", xname);                    \
141         else                                                            \
142           fprintf ((FILE), "%s", xname);                                \
143       }                                                                 \
144     else                                                                \
145       {                                                                 \
146           if (xname[0] == '%')                                          \
147             xname += 2;                                                 \
148           if (xname[0] == '*')                                          \
149             xname += 1;                                                 \
150           else                                                          \
151             fputs (user_label_prefix, FILE);                            \
152           fputs (xname, FILE);                                          \
153       }                                                                 \
154 } while (0)
155
156 /* This is how to hack on the symbol code of certain relcalcitrant
157    symbols to modify their output in output_pic_addr_const ().  */
158
159 #undef  ASM_HACK_SYMBOLREF_CODE /* BDE will need to fix this. */
160
161 /* A C statement to output to the stdio stream FILE an assembler
162    command to advance the location counter to a multiple of 1<<LOG
163    bytes if it is within MAX_SKIP bytes.
164
165    This is used to align code labels according to Intel recommendations.  */
166
167 /* XXX configuration of this is broken in the same way as HAVE_GAS_SHF_MERGE,
168    but it is easier to fix in an MD way.  */
169
170 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
171 #undef  ASM_OUTPUT_MAX_SKIP_ALIGN
172 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP)                  \
173   do {                                                                  \
174     if ((LOG) != 0) {                                                   \
175       if ((MAX_SKIP) == 0)                                              \
176         fprintf ((FILE), "\t.p2align %d\n", (LOG));                     \
177       else                                                              \
178         fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));     \
179     }                                                                   \
180   } while (0)
181 #endif
182
183 /* If defined, a C expression whose value is a string containing the
184    assembler operation to identify the following data as
185    uninitialized global data.  If not defined, and neither
186    `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
187    uninitialized global data will be output in the data section if
188    `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
189    used.  */
190 #undef  BSS_SECTION_ASM_OP
191 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
192
193 /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
194    separate, explicit argument.  If you define this macro, it is used
195    in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
196    handling the required alignment of the variable.  The alignment is
197    specified as the number of bits.
198
199    Try to use function `asm_output_aligned_bss' defined in file
200    `varasm.c' when defining this macro.  */
201 #undef  ASM_OUTPUT_ALIGNED_BSS
202 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
203   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
204
205 /************************[  Debugger stuff  ]*********************************/
206
207 #undef  DBX_REGISTER_NUMBER
208 #define DBX_REGISTER_NUMBER(n)  (TARGET_64BIT ? dbx64_register_map[n]   \
209                                 : (write_symbols == DWARF2_DEBUG)       \
210                                   ? svr4_dbx_register_map[(n)]          \
211                                   : dbx_register_map[(n)])
212
213 /* The same functions are used to creating the DWARF2 debug info and C++
214    unwind info (except.c).  Regardless of the debug format requested, the
215    register numbers used in exception unwinding sections still have to be
216    DWARF compatible.  IMO the GCC folks may be abusing the DBX_REGISTER_NUMBER
217    macro to mean too much.  */
218 #define DWARF_FRAME_REGNUM(n)   (TARGET_64BIT ? dbx64_register_map[n]   \
219                                 : svr4_dbx_register_map[(n)])
220
221 /* stabs-in-elf has offsets relative to function beginning */
222 #undef  DBX_OUTPUT_LBRAC
223 #define DBX_OUTPUT_LBRAC(FILE, NAME)                                    \
224   do {                                                                  \
225     fprintf (asm_out_file, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC);        \
226     assemble_name (asm_out_file, NAME);                                 \
227         fputc ('-', asm_out_file);                                      \
228         assemble_name (asm_out_file,                                    \
229                  XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
230     fprintf (asm_out_file, "\n");                                       \
231   } while (0)
232
233 #undef  DBX_OUTPUT_RBRAC
234 #define DBX_OUTPUT_RBRAC(FILE, NAME)                                    \
235   do {                                                                  \
236     fprintf (asm_out_file, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC);        \
237     assemble_name (asm_out_file, NAME);                                 \
238         fputc ('-', asm_out_file);                                      \
239         assemble_name (asm_out_file,                                    \
240                  XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
241     fprintf (asm_out_file, "\n");                                       \
242   } while (0)
243
244 #undef NEED_INDICATE_EXEC_STACK
245 #define NEED_INDICATE_EXEC_STACK 1