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