Deleted Added
full compact
freebsd.h (99883) freebsd.h (99884)
1/* Definitions for Intel 386 running FreeBSD with either a.out or 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 Added support for generating "old a.out gas" on the fly by Peter Wemm.
7 Continued development by David O'Brien <obrien@freebsd.org>
8
9This file is part of GNU CC.
10
11GNU CC is free software; you can redistribute it and/or modify
12it under the terms of the GNU General Public License as published by
13the Free Software Foundation; either version 2, or (at your option)
14any later version.
15
16GNU CC is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License
22along with GNU CC; see the file COPYING. If not, write to
23the Free Software Foundation, 59 Temple Place - Suite 330,
24Boston, MA 02111-1307, USA. */
25
1/* Definitions for Intel 386 running FreeBSD with either a.out or 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 Added support for generating "old a.out gas" on the fly by Peter Wemm.
7 Continued development by David O'Brien <obrien@freebsd.org>
8
9This file is part of GNU CC.
10
11GNU CC is free software; you can redistribute it and/or modify
12it under the terms of the GNU General Public License as published by
13the Free Software Foundation; either version 2, or (at your option)
14any later version.
15
16GNU CC is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License
22along with GNU CC; see the file COPYING. If not, write to
23the Free Software Foundation, 59 Temple Place - Suite 330,
24Boston, MA 02111-1307, USA. */
25
26/* $FreeBSD: head/contrib/gcc/config/i386/freebsd.h 99883 2002-07-12 17:35:35Z obrien $ */
26/* $FreeBSD: head/contrib/gcc/config/i386/freebsd.h 99884 2002-07-12 17:44:24Z obrien $ */
27
28#undef CC1_SPEC
29#define CC1_SPEC "%(cc1_cpu) %{profile:-p} \
30 %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
31 %{maout: %{!mno-underscores: %{!munderscores: -munderscores }}}"
32
33#undef ASM_SPEC
34#define ASM_SPEC "%{v*: -v} %{maout: %{fpic:-k} %{fPIC:-k}}"
35
36#undef ASM_FINAL_SPEC
37#define ASM_FINAL_SPEC "%|"
38
39/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support
40 for the special GCC options -static and -shared, which allow us to
41 link things in one of these three modes by applying the appropriate
42 combinations of options at link-time. We like to support here for
43 as many of the other GNU linker options as possible. But I don't
44 have the time to search for those flags. I am sure how to add
45 support for -soname shared_object_name. H.J.
46
47 When the -shared link option is used a final link is not being
48 done. */
49
50#undef LINK_SPEC
51#define LINK_SPEC "\
52 %{p:%e`-p' not supported; use `-pg' and gprof(1)} \
53 %{maout: %{shared:-Bshareable} \
54 %{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \
55 %{pg:-Bstatic} %{Z}} \
56 %{assert*} %{R*}} \
57 %{!maout: \
58 %{Wl,*:%*} \
59 %{v:-V} \
60 %{assert*} %{R*} %{rpath*} %{defsym*} \
61 %{shared:-Bshareable %{h*} %{soname*}} \
62 %{!shared: \
63 %{!static: \
64 %{rdynamic: -export-dynamic} \
65 %{!dynamic-linker: -dynamic-linker /usr/libexec/ld-elf.so.1}} \
66 %{static:-Bstatic}} \
67 %{symbolic:-Bsymbolic}}"
68
69/* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add the magical
70 crtbegin.o file (see crtstuff.c) which provides part of the support for
71 getting C++ file-scope static object constructed before entering `main'. */
72
73#undef STARTFILE_SPEC
74#define STARTFILE_SPEC "\
75 %{maout: %{shared:c++rt0.o%s} \
76 %{!shared: \
77 %{pg:gcrt0.o%s}%{!pg: \
78 %{static:scrt0.o%s} \
79 %{!static:crt0.o%s}}}} \
80 %{!maout: \
81 %{!shared: \
82 %{pg:gcrt1.o%s} \
83 %{!pg: \
84 %{p:gcrt1.o%s} \
85 %{!p:crt1.o%s}}} \
86 crti.o%s \
87 %{!shared:crtbegin.o%s} \
88 %{shared:crtbeginS.o%s}}"
89
90/* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386. Here we tack on our
91 own magical crtend.o file (see crtstuff.c) which provides part of the
92 support for getting C++ file-scope static object constructed before
93 entering `main', followed by the normal "finalizer" file, `crtn.o'. */
94
95#undef ENDFILE_SPEC
96#define ENDFILE_SPEC "\
97 %{!maout: \
98 %{!shared:crtend.o%s} \
99 %{shared:crtendS.o%s} crtn.o%s}"
100
101
102/************************[ Target stuff ]***********************************/
103
104/* Define the actual types of some ANSI-mandated types.
105 Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c,
106 c-common.c, and config/<arch>/<arch>.h. */
107
108#undef SIZE_TYPE
109#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
110
111#undef PTRDIFF_TYPE
112#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
113
114#undef WCHAR_TYPE_SIZE
115#define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD)
116
117#undef TARGET_VERSION
118#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)");
119
120#define MASK_PROFILER_EPILOGUE 010000000000
121#define MASK_AOUT 004000000000 /* a.out not elf */
122#define MASK_UNDERSCORES 002000000000 /* use leading _ */
123
124#define TARGET_PROFILER_EPILOGUE (target_flags & MASK_PROFILER_EPILOGUE)
125#define TARGET_AOUT (target_flags & MASK_AOUT)
126#define TARGET_ELF ((target_flags & MASK_AOUT) == 0)
127#define TARGET_UNDERSCORES ((target_flags & MASK_UNDERSCORES) != 0)
128
129#undef SUBTARGET_SWITCHES
130#define SUBTARGET_SWITCHES \
131 { "profiler-epilogue", MASK_PROFILER_EPILOGUE, "Function profiler epilogue"}, \
132 { "no-profiler-epilogue", -MASK_PROFILER_EPILOGUE, "No function profiler epilogue"}, \
133 { "aout", MASK_AOUT, "Generate an a.out (vs. ELF) binary"}, \
134 { "no-aout", -MASK_AOUT, "Do not generate an a.out binary"}, \
135 { "underscores", MASK_UNDERSCORES, "Add leading underscores to symbols"}, \
136 { "no-underscores", -MASK_UNDERSCORES, "Do not add leading underscores to symbols"},
137
138/* This goes away when the math emulator is fixed. */
139#undef TARGET_SUBTARGET_DEFAULT
140#define TARGET_SUBTARGET_DEFAULT \
141 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
142
143/* Don't default to pcc-struct-return, we want to retain compatibility with
144 older gcc versions AND pcc-struct-return is nonreentrant.
145 (even though the SVR4 ABI for the i386 says that records and unions are
146 returned in memory). */
147
148#undef DEFAULT_PCC_STRUCT_RETURN
149#define DEFAULT_PCC_STRUCT_RETURN 0
150
151/* The a.out tools do not support "linkonce" sections. */
152#undef SUPPORTS_ONE_ONLY
153#define SUPPORTS_ONE_ONLY TARGET_ELF
154
155/* Prefix for internally generated assembler labels. If we aren't using
156 underscores, we are using prefix `.'s to identify labels that should
157 be ignored, as in `i386/gas.h' --karl@cs.umb.edu */
158#undef LPREFIX
159#define LPREFIX ((TARGET_UNDERSCORES) ? "L" : ".L")
160
161/* supply our own hook for calling __main() from main() */
162#undef INVOKE__main
163#define INVOKE__main
164#undef GEN_CALL__MAIN
165#define GEN_CALL__MAIN \
166 do { \
167 if (!(TARGET_ELF)) \
168 emit_library_call (gen_rtx (SYMBOL_REF, Pmode, NAME__MAIN), 0, \
169 VOIDmode, 0); \
170 } while (0)
171
172/* Tell final.c that we don't need a label passed to mcount. */
173#define NO_PROFILE_COUNTERS 1
174
175/* Output assembler code to FILE to begin profiling of the current function.
176 LABELNO is an optional label. */
177
178#undef FUNCTION_PROFILER
179#define FUNCTION_PROFILER(FILE, LABELNO) \
180 do { \
181 char *_name = TARGET_AOUT ? "mcount" : ".mcount"; \
182 if (flag_pic) \
183 fprintf ((FILE), "\tcall *%s@GOT(%%ebx)\n", _name); \
184 else \
185 fprintf ((FILE), "\tcall %s\n", _name); \
186 } while (0)
187
188/* Output assembler code to FILE to end profiling of the current function. */
189
190#undef FUNCTION_PROFILER_EPILOGUE /* BDE will need to fix this. */
191
192
193/************************[ Assembler stuff ]********************************/
194
195/* Override the default comment-starter of "/" from unix.h. */
196#undef ASM_COMMENT_START
197#define ASM_COMMENT_START "#"
198
199/* Override the default comment-starter of "/APP" from unix.h. */
200#undef ASM_APP_ON
201#define ASM_APP_ON "#APP\n"
202#undef ASM_APP_OFF
203#define ASM_APP_OFF "#NO_APP\n"
204
205/* Override the default string pseudo-op of "\t.string\t" from ../elfos.h.
206 ".string" doesn't work for the aout case. */
207#undef STRING_ASM_OP
208#define STRING_ASM_OP (TARGET_AOUT ? "\t.asciz\t" : "\t.string\t")
209
210/* Override the use of "\t.section\t.rodata" from ../elfos.h. Neither
211 ".section" nor "rodata" works for the aout case. This forces a fallback
212 to ".text". */
213#undef USE_CONST_SECTION
214#define USE_CONST_SECTION TARGET_ELF
215
216/* This is how to store into the string BUF
217 the symbol_ref name of an internal numbered label where
218 PREFIX is the class of label and NUM is the number within the class.
219 This is suitable for output with `assemble_name'. */
220#undef ASM_GENERATE_INTERNAL_LABEL
221#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
222 sprintf ((LABEL), "*%s%s%u", (TARGET_UNDERSCORES) ? "" : ".", \
223 (PREFIX), (unsigned) (NUM))
224
225/* This is how to output an internal numbered label where
226 PREFIX is the class of label and NUM is the number within the class.
227 For most svr4/ELF systems, the convention is that any symbol which begins
228 with a period is not put into the linker symbol table by the assembler. */
229#undef ASM_OUTPUT_INTERNAL_LABEL
230#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \
231 fprintf ((FILE), "%s%s%u:\n", (TARGET_UNDERSCORES) ? "" : ".", \
232 (PREFIX), (unsigned) (NUM))
233
234/* This is how to output a reference to a user-level label named NAME. */
235#undef ASM_OUTPUT_LABELREF
236#define ASM_OUTPUT_LABELREF(FILE, NAME) \
237 do { \
238 char *_name = (NAME); \
239 /* Hack to avoid writing lots of rtl in \
240 FUNCTION_PROFILER_EPILOGUE (). */ \
241 if (*_name == '.' && strcmp(_name + 1, "mexitcount") == 0) \
242 { \
243 if (TARGET_AOUT) \
244 _name++; \
245 if (flag_pic) \
246 fprintf ((FILE), "*%s@GOT(%%ebx)", _name); \
247 else \
248 fprintf ((FILE), "%s", _name); \
249 } \
250 else \
251 fprintf (FILE, "%s%s", TARGET_UNDERSCORES ? "_" : "", _name); \
252} while (0)
253
254/* This is how to hack on the symbol code of certain relcalcitrant
255 symbols to modify their output in output_pic_addr_const (). */
256
257#undef ASM_HACK_SYMBOLREF_CODE /* BDE will need to fix this. */
258
259#undef ASM_OUTPUT_ALIGN
260#define ASM_OUTPUT_ALIGN(FILE, LOG) \
261 do { \
262 if ((LOG)!=0) { \
263 if (in_text_section()) \
264 fprintf ((FILE), "\t.p2align %d,0x90\n", (LOG)); \
265 else \
266 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
267 } \
268 } while (0)
269
270#undef ASM_OUTPUT_ALIGNED_COMMON
271#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
272 do { \
273 if (TARGET_ELF) \
274 { \
275 fprintf ((FILE), "%s", COMMON_ASM_OP); \
276 assemble_name ((FILE), (NAME)); \
277 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
278 } \
279 else \
280 { \
281 int alignbytes = ((ALIGN) + BITS_PER_UNIT - 1) / BITS_PER_UNIT; \
282 int rounded = (SIZE); \
283 rounded += alignbytes - 1; \
284 rounded = (rounded / alignbytes) * alignbytes; \
285 fprintf ((FILE), "%s ", COMMON_ASM_OP); \
286 assemble_name ((FILE), (NAME)); \
287 fprintf ((FILE), ",%u\n", (rounded)); \
288 } \
289 } while (0)
290
291/* This says how to output assembler code to declare an
292 uninitialized internal linkage data object. Under SVR4,
293 the linker seems to want the alignment of data objects
294 to depend on their types. We do exactly that here. */
295
296#undef ASM_OUTPUT_ALIGNED_LOCAL
297#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
298 do { \
299 if (TARGET_ELF) \
300 { \
301 fprintf ((FILE), "%s", LOCAL_ASM_OP); \
302 assemble_name ((FILE), (NAME)); \
303 fprintf ((FILE), "\n"); \
304 ASM_OUTPUT_ALIGNED_COMMON ((FILE), (NAME), (SIZE), (ALIGN)); \
305 } \
306 else \
307 { \
308 int rounded = (SIZE); \
309 if (rounded == 0) rounded = 1; \
310 rounded += (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1; \
311 rounded = (rounded / (BIGGEST_ALIGNMENT / BITS_PER_UNIT) \
312 * (BIGGEST_ALIGNMENT / BITS_PER_UNIT)); \
313 fputs ("\t.lcomm\t", (FILE)); \
314 assemble_name ((FILE), (NAME)); \
315 fprintf ((FILE), ",%u\n", (rounded)); \
316 } \
317 } while (0)
318
319/* How to output some space. The rules are different depending on the
320 object format. */
321#undef ASM_OUTPUT_SKIP
322#define ASM_OUTPUT_SKIP(FILE, SIZE) \
323 do { \
324 if (TARGET_ELF) \
325 { \
326 fprintf ((FILE), "%s%u\n", SKIP_ASM_OP, (SIZE)); \
327 } \
328 else \
329 { \
330 fprintf ((FILE), "\t.space\t%u\n", (SIZE)); \
331 } \
332 } while (0)
333
334#undef ASM_OUTPUT_SOURCE_LINE
335#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
336 do { \
337 static int sym_lineno = 1; \
338 if (TARGET_ELF) \
339 { \
340 fprintf ((FILE), ".stabn 68,0,%d,.LM%d-", (LINE), sym_lineno); \
341 assemble_name ((FILE), \
342 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
343 fprintf ((FILE), "\n.LM%d:\n", sym_lineno); \
344 sym_lineno += 1; \
345 } \
346 else \
347 { \
348 fprintf ((FILE), "\t%s %d,0,%d\n", ASM_STABD_OP, N_SLINE, \
349 lineno); \
350 } \
351 } while (0)
352
353/* A C statement to output to the stdio stream FILE an assembler
354 command to advance the location counter to a multiple of 1<<LOG
355 bytes if it is within MAX_SKIP bytes.
356
357 This is used to align code labels according to Intel recommendations. */
358
359/* XXX configuration of this is broken in the same way as HAVE_GAS_SHF_MERGE,
360 but it is easier to fix in an MD way. */
361
362#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
363#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \
364 do { \
365 if ((LOG) != 0) { \
366 if (TARGET_AOUT) \
367 ASM_OUTPUT_ALIGN ((FILE), (LOG)); \
368 else if ((MAX_SKIP) == 0) \
369 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
370 else \
371 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
372 } \
373 } while (0)
374#endif
375
376
377/************************[ Debugger stuff ]*********************************/
378
379/* The a.out tools do not support "Lscope" .stabs symbols. */
380#undef NO_DBX_FUNCTION_END
381#define NO_DBX_FUNCTION_END TARGET_AOUT
382
383#undef DBX_REGISTER_NUMBER
384#define DBX_REGISTER_NUMBER(n) (TARGET_64BIT ? dbx64_register_map[n] \
385 : (write_symbols == DWARF2_DEBUG \
386 || write_symbols == DWARF_DEBUG) \
387 ? svr4_dbx_register_map[(n)] \
388 : dbx_register_map[(n)])
389
27
28#undef CC1_SPEC
29#define CC1_SPEC "%(cc1_cpu) %{profile:-p} \
30 %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
31 %{maout: %{!mno-underscores: %{!munderscores: -munderscores }}}"
32
33#undef ASM_SPEC
34#define ASM_SPEC "%{v*: -v} %{maout: %{fpic:-k} %{fPIC:-k}}"
35
36#undef ASM_FINAL_SPEC
37#define ASM_FINAL_SPEC "%|"
38
39/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support
40 for the special GCC options -static and -shared, which allow us to
41 link things in one of these three modes by applying the appropriate
42 combinations of options at link-time. We like to support here for
43 as many of the other GNU linker options as possible. But I don't
44 have the time to search for those flags. I am sure how to add
45 support for -soname shared_object_name. H.J.
46
47 When the -shared link option is used a final link is not being
48 done. */
49
50#undef LINK_SPEC
51#define LINK_SPEC "\
52 %{p:%e`-p' not supported; use `-pg' and gprof(1)} \
53 %{maout: %{shared:-Bshareable} \
54 %{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \
55 %{pg:-Bstatic} %{Z}} \
56 %{assert*} %{R*}} \
57 %{!maout: \
58 %{Wl,*:%*} \
59 %{v:-V} \
60 %{assert*} %{R*} %{rpath*} %{defsym*} \
61 %{shared:-Bshareable %{h*} %{soname*}} \
62 %{!shared: \
63 %{!static: \
64 %{rdynamic: -export-dynamic} \
65 %{!dynamic-linker: -dynamic-linker /usr/libexec/ld-elf.so.1}} \
66 %{static:-Bstatic}} \
67 %{symbolic:-Bsymbolic}}"
68
69/* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add the magical
70 crtbegin.o file (see crtstuff.c) which provides part of the support for
71 getting C++ file-scope static object constructed before entering `main'. */
72
73#undef STARTFILE_SPEC
74#define STARTFILE_SPEC "\
75 %{maout: %{shared:c++rt0.o%s} \
76 %{!shared: \
77 %{pg:gcrt0.o%s}%{!pg: \
78 %{static:scrt0.o%s} \
79 %{!static:crt0.o%s}}}} \
80 %{!maout: \
81 %{!shared: \
82 %{pg:gcrt1.o%s} \
83 %{!pg: \
84 %{p:gcrt1.o%s} \
85 %{!p:crt1.o%s}}} \
86 crti.o%s \
87 %{!shared:crtbegin.o%s} \
88 %{shared:crtbeginS.o%s}}"
89
90/* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386. Here we tack on our
91 own magical crtend.o file (see crtstuff.c) which provides part of the
92 support for getting C++ file-scope static object constructed before
93 entering `main', followed by the normal "finalizer" file, `crtn.o'. */
94
95#undef ENDFILE_SPEC
96#define ENDFILE_SPEC "\
97 %{!maout: \
98 %{!shared:crtend.o%s} \
99 %{shared:crtendS.o%s} crtn.o%s}"
100
101
102/************************[ Target stuff ]***********************************/
103
104/* Define the actual types of some ANSI-mandated types.
105 Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c,
106 c-common.c, and config/<arch>/<arch>.h. */
107
108#undef SIZE_TYPE
109#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
110
111#undef PTRDIFF_TYPE
112#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
113
114#undef WCHAR_TYPE_SIZE
115#define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD)
116
117#undef TARGET_VERSION
118#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)");
119
120#define MASK_PROFILER_EPILOGUE 010000000000
121#define MASK_AOUT 004000000000 /* a.out not elf */
122#define MASK_UNDERSCORES 002000000000 /* use leading _ */
123
124#define TARGET_PROFILER_EPILOGUE (target_flags & MASK_PROFILER_EPILOGUE)
125#define TARGET_AOUT (target_flags & MASK_AOUT)
126#define TARGET_ELF ((target_flags & MASK_AOUT) == 0)
127#define TARGET_UNDERSCORES ((target_flags & MASK_UNDERSCORES) != 0)
128
129#undef SUBTARGET_SWITCHES
130#define SUBTARGET_SWITCHES \
131 { "profiler-epilogue", MASK_PROFILER_EPILOGUE, "Function profiler epilogue"}, \
132 { "no-profiler-epilogue", -MASK_PROFILER_EPILOGUE, "No function profiler epilogue"}, \
133 { "aout", MASK_AOUT, "Generate an a.out (vs. ELF) binary"}, \
134 { "no-aout", -MASK_AOUT, "Do not generate an a.out binary"}, \
135 { "underscores", MASK_UNDERSCORES, "Add leading underscores to symbols"}, \
136 { "no-underscores", -MASK_UNDERSCORES, "Do not add leading underscores to symbols"},
137
138/* This goes away when the math emulator is fixed. */
139#undef TARGET_SUBTARGET_DEFAULT
140#define TARGET_SUBTARGET_DEFAULT \
141 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
142
143/* Don't default to pcc-struct-return, we want to retain compatibility with
144 older gcc versions AND pcc-struct-return is nonreentrant.
145 (even though the SVR4 ABI for the i386 says that records and unions are
146 returned in memory). */
147
148#undef DEFAULT_PCC_STRUCT_RETURN
149#define DEFAULT_PCC_STRUCT_RETURN 0
150
151/* The a.out tools do not support "linkonce" sections. */
152#undef SUPPORTS_ONE_ONLY
153#define SUPPORTS_ONE_ONLY TARGET_ELF
154
155/* Prefix for internally generated assembler labels. If we aren't using
156 underscores, we are using prefix `.'s to identify labels that should
157 be ignored, as in `i386/gas.h' --karl@cs.umb.edu */
158#undef LPREFIX
159#define LPREFIX ((TARGET_UNDERSCORES) ? "L" : ".L")
160
161/* supply our own hook for calling __main() from main() */
162#undef INVOKE__main
163#define INVOKE__main
164#undef GEN_CALL__MAIN
165#define GEN_CALL__MAIN \
166 do { \
167 if (!(TARGET_ELF)) \
168 emit_library_call (gen_rtx (SYMBOL_REF, Pmode, NAME__MAIN), 0, \
169 VOIDmode, 0); \
170 } while (0)
171
172/* Tell final.c that we don't need a label passed to mcount. */
173#define NO_PROFILE_COUNTERS 1
174
175/* Output assembler code to FILE to begin profiling of the current function.
176 LABELNO is an optional label. */
177
178#undef FUNCTION_PROFILER
179#define FUNCTION_PROFILER(FILE, LABELNO) \
180 do { \
181 char *_name = TARGET_AOUT ? "mcount" : ".mcount"; \
182 if (flag_pic) \
183 fprintf ((FILE), "\tcall *%s@GOT(%%ebx)\n", _name); \
184 else \
185 fprintf ((FILE), "\tcall %s\n", _name); \
186 } while (0)
187
188/* Output assembler code to FILE to end profiling of the current function. */
189
190#undef FUNCTION_PROFILER_EPILOGUE /* BDE will need to fix this. */
191
192
193/************************[ Assembler stuff ]********************************/
194
195/* Override the default comment-starter of "/" from unix.h. */
196#undef ASM_COMMENT_START
197#define ASM_COMMENT_START "#"
198
199/* Override the default comment-starter of "/APP" from unix.h. */
200#undef ASM_APP_ON
201#define ASM_APP_ON "#APP\n"
202#undef ASM_APP_OFF
203#define ASM_APP_OFF "#NO_APP\n"
204
205/* Override the default string pseudo-op of "\t.string\t" from ../elfos.h.
206 ".string" doesn't work for the aout case. */
207#undef STRING_ASM_OP
208#define STRING_ASM_OP (TARGET_AOUT ? "\t.asciz\t" : "\t.string\t")
209
210/* Override the use of "\t.section\t.rodata" from ../elfos.h. Neither
211 ".section" nor "rodata" works for the aout case. This forces a fallback
212 to ".text". */
213#undef USE_CONST_SECTION
214#define USE_CONST_SECTION TARGET_ELF
215
216/* This is how to store into the string BUF
217 the symbol_ref name of an internal numbered label where
218 PREFIX is the class of label and NUM is the number within the class.
219 This is suitable for output with `assemble_name'. */
220#undef ASM_GENERATE_INTERNAL_LABEL
221#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
222 sprintf ((LABEL), "*%s%s%u", (TARGET_UNDERSCORES) ? "" : ".", \
223 (PREFIX), (unsigned) (NUM))
224
225/* This is how to output an internal numbered label where
226 PREFIX is the class of label and NUM is the number within the class.
227 For most svr4/ELF systems, the convention is that any symbol which begins
228 with a period is not put into the linker symbol table by the assembler. */
229#undef ASM_OUTPUT_INTERNAL_LABEL
230#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \
231 fprintf ((FILE), "%s%s%u:\n", (TARGET_UNDERSCORES) ? "" : ".", \
232 (PREFIX), (unsigned) (NUM))
233
234/* This is how to output a reference to a user-level label named NAME. */
235#undef ASM_OUTPUT_LABELREF
236#define ASM_OUTPUT_LABELREF(FILE, NAME) \
237 do { \
238 char *_name = (NAME); \
239 /* Hack to avoid writing lots of rtl in \
240 FUNCTION_PROFILER_EPILOGUE (). */ \
241 if (*_name == '.' && strcmp(_name + 1, "mexitcount") == 0) \
242 { \
243 if (TARGET_AOUT) \
244 _name++; \
245 if (flag_pic) \
246 fprintf ((FILE), "*%s@GOT(%%ebx)", _name); \
247 else \
248 fprintf ((FILE), "%s", _name); \
249 } \
250 else \
251 fprintf (FILE, "%s%s", TARGET_UNDERSCORES ? "_" : "", _name); \
252} while (0)
253
254/* This is how to hack on the symbol code of certain relcalcitrant
255 symbols to modify their output in output_pic_addr_const (). */
256
257#undef ASM_HACK_SYMBOLREF_CODE /* BDE will need to fix this. */
258
259#undef ASM_OUTPUT_ALIGN
260#define ASM_OUTPUT_ALIGN(FILE, LOG) \
261 do { \
262 if ((LOG)!=0) { \
263 if (in_text_section()) \
264 fprintf ((FILE), "\t.p2align %d,0x90\n", (LOG)); \
265 else \
266 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
267 } \
268 } while (0)
269
270#undef ASM_OUTPUT_ALIGNED_COMMON
271#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
272 do { \
273 if (TARGET_ELF) \
274 { \
275 fprintf ((FILE), "%s", COMMON_ASM_OP); \
276 assemble_name ((FILE), (NAME)); \
277 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
278 } \
279 else \
280 { \
281 int alignbytes = ((ALIGN) + BITS_PER_UNIT - 1) / BITS_PER_UNIT; \
282 int rounded = (SIZE); \
283 rounded += alignbytes - 1; \
284 rounded = (rounded / alignbytes) * alignbytes; \
285 fprintf ((FILE), "%s ", COMMON_ASM_OP); \
286 assemble_name ((FILE), (NAME)); \
287 fprintf ((FILE), ",%u\n", (rounded)); \
288 } \
289 } while (0)
290
291/* This says how to output assembler code to declare an
292 uninitialized internal linkage data object. Under SVR4,
293 the linker seems to want the alignment of data objects
294 to depend on their types. We do exactly that here. */
295
296#undef ASM_OUTPUT_ALIGNED_LOCAL
297#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
298 do { \
299 if (TARGET_ELF) \
300 { \
301 fprintf ((FILE), "%s", LOCAL_ASM_OP); \
302 assemble_name ((FILE), (NAME)); \
303 fprintf ((FILE), "\n"); \
304 ASM_OUTPUT_ALIGNED_COMMON ((FILE), (NAME), (SIZE), (ALIGN)); \
305 } \
306 else \
307 { \
308 int rounded = (SIZE); \
309 if (rounded == 0) rounded = 1; \
310 rounded += (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1; \
311 rounded = (rounded / (BIGGEST_ALIGNMENT / BITS_PER_UNIT) \
312 * (BIGGEST_ALIGNMENT / BITS_PER_UNIT)); \
313 fputs ("\t.lcomm\t", (FILE)); \
314 assemble_name ((FILE), (NAME)); \
315 fprintf ((FILE), ",%u\n", (rounded)); \
316 } \
317 } while (0)
318
319/* How to output some space. The rules are different depending on the
320 object format. */
321#undef ASM_OUTPUT_SKIP
322#define ASM_OUTPUT_SKIP(FILE, SIZE) \
323 do { \
324 if (TARGET_ELF) \
325 { \
326 fprintf ((FILE), "%s%u\n", SKIP_ASM_OP, (SIZE)); \
327 } \
328 else \
329 { \
330 fprintf ((FILE), "\t.space\t%u\n", (SIZE)); \
331 } \
332 } while (0)
333
334#undef ASM_OUTPUT_SOURCE_LINE
335#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
336 do { \
337 static int sym_lineno = 1; \
338 if (TARGET_ELF) \
339 { \
340 fprintf ((FILE), ".stabn 68,0,%d,.LM%d-", (LINE), sym_lineno); \
341 assemble_name ((FILE), \
342 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
343 fprintf ((FILE), "\n.LM%d:\n", sym_lineno); \
344 sym_lineno += 1; \
345 } \
346 else \
347 { \
348 fprintf ((FILE), "\t%s %d,0,%d\n", ASM_STABD_OP, N_SLINE, \
349 lineno); \
350 } \
351 } while (0)
352
353/* A C statement to output to the stdio stream FILE an assembler
354 command to advance the location counter to a multiple of 1<<LOG
355 bytes if it is within MAX_SKIP bytes.
356
357 This is used to align code labels according to Intel recommendations. */
358
359/* XXX configuration of this is broken in the same way as HAVE_GAS_SHF_MERGE,
360 but it is easier to fix in an MD way. */
361
362#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
363#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \
364 do { \
365 if ((LOG) != 0) { \
366 if (TARGET_AOUT) \
367 ASM_OUTPUT_ALIGN ((FILE), (LOG)); \
368 else if ((MAX_SKIP) == 0) \
369 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
370 else \
371 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
372 } \
373 } while (0)
374#endif
375
376
377/************************[ Debugger stuff ]*********************************/
378
379/* The a.out tools do not support "Lscope" .stabs symbols. */
380#undef NO_DBX_FUNCTION_END
381#define NO_DBX_FUNCTION_END TARGET_AOUT
382
383#undef DBX_REGISTER_NUMBER
384#define DBX_REGISTER_NUMBER(n) (TARGET_64BIT ? dbx64_register_map[n] \
385 : (write_symbols == DWARF2_DEBUG \
386 || write_symbols == DWARF_DEBUG) \
387 ? svr4_dbx_register_map[(n)] \
388 : dbx_register_map[(n)])
389
390/* The same functions are used to creating the DWARF2 debug info and C++
391 unwind info (except.c). Regardless of the debug format requested, the
392 register numbers used in exception unwinding sections still have to be
393 DWARF compatible. IMO the GCC folks may be abusing the DBX_REGISTER_NUMBER
394 macro to mean too much. */
395#define DWARF_FRAME_REGNUM(n) (TARGET_64BIT ? dbx64_register_map[n] \
396 : svr4_dbx_register_map[(n)])
397
390/* tag end of file in elf mode */
391#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
392#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
393 do { \
394 if (TARGET_ELF) { \
395 asm_fprintf ((FILE), \
396 "\t.text\n\t.stabs \"\",%d,0,0,%LLetext\n%LLetext:\n",\
397 N_SO); \
398 } \
399 } while (0)
400
401/* stabs-in-elf has offsets relative to function beginning */
402#undef DBX_OUTPUT_LBRAC
403#define DBX_OUTPUT_LBRAC(FILE, NAME) \
404 do { \
405 fprintf (asmfile, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC); \
406 assemble_name (asmfile, buf); \
407 if (TARGET_ELF) \
408 { \
409 fputc ('-', asmfile); \
410 assemble_name (asmfile, \
411 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
412 } \
413 fprintf (asmfile, "\n"); \
414 } while (0)
415
416#undef DBX_OUTPUT_RBRAC
417#define DBX_OUTPUT_RBRAC(FILE, NAME) \
418 do { \
419 fprintf (asmfile, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC); \
420 assemble_name (asmfile, buf); \
421 if (TARGET_ELF) \
422 { \
423 fputc ('-', asmfile); \
424 assemble_name (asmfile, \
425 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
426 } \
427 fprintf (asmfile, "\n"); \
428 } while (0)
398/* tag end of file in elf mode */
399#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
400#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
401 do { \
402 if (TARGET_ELF) { \
403 asm_fprintf ((FILE), \
404 "\t.text\n\t.stabs \"\",%d,0,0,%LLetext\n%LLetext:\n",\
405 N_SO); \
406 } \
407 } while (0)
408
409/* stabs-in-elf has offsets relative to function beginning */
410#undef DBX_OUTPUT_LBRAC
411#define DBX_OUTPUT_LBRAC(FILE, NAME) \
412 do { \
413 fprintf (asmfile, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC); \
414 assemble_name (asmfile, buf); \
415 if (TARGET_ELF) \
416 { \
417 fputc ('-', asmfile); \
418 assemble_name (asmfile, \
419 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
420 } \
421 fprintf (asmfile, "\n"); \
422 } while (0)
423
424#undef DBX_OUTPUT_RBRAC
425#define DBX_OUTPUT_RBRAC(FILE, NAME) \
426 do { \
427 fprintf (asmfile, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC); \
428 assemble_name (asmfile, buf); \
429 if (TARGET_ELF) \
430 { \
431 fputc ('-', asmfile); \
432 assemble_name (asmfile, \
433 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
434 } \
435 fprintf (asmfile, "\n"); \
436 } while (0)