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
--- 9 unchanged lines hidden (view full) ---
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 95810 2002-04-30 17:15:01Z obrien $ */
27
28#undef TARGET_VERSION
29#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)");
30
31#undef CC1_SPEC
32#define CC1_SPEC "%(cc1_cpu) %{profile:-p} \
33 %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
34 %{maout: %{!mno-underscores: %{!munderscores: -munderscores }}}"
35
36#undef ASM_SPEC
37#define ASM_SPEC "%{v*: -v} %{maout: %{fpic:-k} %{fPIC:-k}}"
38
39#undef ASM_FINAL_SPEC
40#define ASM_FINAL_SPEC "%|"
--- 71 unchanged lines hidden (view full) ---
112#define SIZE_TYPE "unsigned int"
113
114#undef PTRDIFF_TYPE
115#define PTRDIFF_TYPE "int"
116
117#undef WCHAR_TYPE_SIZE
118#define WCHAR_TYPE_SIZE BITS_PER_WORD
119
120#undef TARGET_VERSION
121#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)");
122
123#define MASK_PROFILER_EPILOGUE 010000000000
124#define MASK_AOUT 004000000000 /* a.out not elf */
125#define MASK_UNDERSCORES 002000000000 /* use leading _ */
126
127#define TARGET_PROFILER_EPILOGUE (target_flags & MASK_PROFILER_EPILOGUE)
--- 6 unchanged lines hidden (view full) ---
134 { "profiler-epilogue", MASK_PROFILER_EPILOGUE, "Function profiler epilogue"}, \
135 { "no-profiler-epilogue", -MASK_PROFILER_EPILOGUE, "No function profiler epilogue"}, \
136 { "aout", MASK_AOUT, "Generate an a.out (vs. ELF) binary"}, \
137 { "no-aout", -MASK_AOUT, "Do not generate an a.out binary"}, \
138 { "underscores", MASK_UNDERSCORES, "Add leading underscores to symbols"}, \
139 { "no-underscores", -MASK_UNDERSCORES, "Do not add leading underscores to symbols"},
140
141/* This goes away when the math emulator is fixed. */
142#undef TARGET_SUBTARGET_DEFAULT
143#define TARGET_SUBTARGET_DEFAULT \
144 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
145
146/* Don't default to pcc-struct-return, we want to retain compatibility with
147 older gcc versions AND pcc-struct-return is nonreentrant.
148 (even though the SVR4 ABI for the i386 says that records and unions are
149 returned in memory). */
150
151#undef DEFAULT_PCC_STRUCT_RETURN
--- 15 unchanged lines hidden (view full) ---
167#undef GEN_CALL__MAIN
168#define GEN_CALL__MAIN \
169 do { \
170 if (!(TARGET_ELF)) \
171 emit_library_call (gen_rtx (SYMBOL_REF, Pmode, NAME__MAIN), 0, \
172 VOIDmode, 0); \
173 } while (0)
174
175/* Tell final.c that we don't need a label passed to mcount. */
176#define NO_PROFILE_COUNTERS 1
177
178/* Output assembler code to FILE to begin profiling of the current function.
179 LABELNO is an optional label. */
180
181#undef FUNCTION_PROFILER
182#define FUNCTION_PROFILER(FILE, LABELNO) \
183 do { \
184 char *_name = TARGET_AOUT ? "mcount" : ".mcount"; \
185 if (flag_pic) \
186 fprintf ((FILE), "\tcall *%s@GOT(%%ebx)\n", _name); \
187 else \
188 fprintf ((FILE), "\tcall %s\n", _name); \
189 } while (0)
190
191/* Output assembler code to FILE to end profiling of the current function. */
192
193#undef FUNCTION_PROFILER_EPILOGUE /* BDE will need to fix this. */
194
195
196/************************[ Assembler stuff ]********************************/
197
198/* Override the default comment-starter of "/" from unix.h. */
199#undef ASM_COMMENT_START
200#define ASM_COMMENT_START "#"
201
202#undef ASM_APP_ON
203#define ASM_APP_ON "#APP\n"
204
205#undef ASM_APP_OFF
206#define ASM_APP_OFF "#NO_APP\n"
207
208/* This is how to store into the string BUF
209 the symbol_ref name of an internal numbered label where
210 PREFIX is the class of label and NUM is the number within the class.
211 This is suitable for output with `assemble_name'. */
212#undef ASM_GENERATE_INTERNAL_LABEL
213#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
214 sprintf ((LABEL), "*%s%s%u", (TARGET_UNDERSCORES) ? "" : ".", \
215 (PREFIX), (unsigned) (NUM))
216
217/* This is how to output an internal numbered label where
218 PREFIX is the class of label and NUM is the number within the class.
219 For most svr4/ELF systems, the convention is that any symbol which begins
220 with a period is not put into the linker symbol table by the assembler. */
221#undef ASM_OUTPUT_INTERNAL_LABEL
222#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \
223 fprintf ((FILE), "%s%s%u:\n", (TARGET_UNDERSCORES) ? "" : ".", \
224 (PREFIX), (unsigned) (NUM))
225
226/* This is how to output a reference to a user-level label named NAME. */
227#undef ASM_OUTPUT_LABELREF
228#define ASM_OUTPUT_LABELREF(FILE, NAME) \
229 do { \
230 char *_name = (NAME); \
231 /* Hack to avoid writing lots of rtl in \
232 FUNCTION_PROFILER_EPILOGUE (). */ \
--- 8 unchanged lines hidden (view full) ---
241 } \
242 else \
243 fprintf (FILE, "%s%s", TARGET_UNDERSCORES ? "_" : "", _name); \
244} while (0)
245
246/* This is how to hack on the symbol code of certain relcalcitrant
247 symbols to modify their output in output_pic_addr_const (). */
248
249#undef ASM_HACK_SYMBOLREF_CODE /* BDE will need to fix this. */
250
251/* This is how to output an element of a case-vector that is relative.
252 This is only used for PIC code. See comments by the `casesi' insn in
253 i386.md for an explanation of the expression this outputs. */
254#undef ASM_OUTPUT_ADDR_DIFF_ELT
255#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
256 fprintf ((FILE), "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, (VALUE))
257
--- 85 unchanged lines hidden (view full) ---
343 } \
344 else \
345 { \
346 fprintf ((FILE), "\t%s %d,0,%d\n", ASM_STABD_OP, N_SLINE, \
347 lineno); \
348 } \
349 } while (0)
350
351/* A C statement to output to the stdio stream FILE an assembler
352 command to advance the location counter to a multiple of 1<<LOG
353 bytes if it is within MAX_SKIP bytes.
354
355 This is used to align code labels according to Intel recommendations. */
356
357#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
358#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \
359 if ((LOG) != 0) { \
360 if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
361 else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
362 }
363#endif
364
365
366/************************[ Debugger stuff ]*********************************/
367
368/* The a.out tools do not support "Lscope" .stabs symbols. */
369#undef NO_DBX_FUNCTION_END
370#define NO_DBX_FUNCTION_END TARGET_AOUT
371
372/* In ELF, the function stabs come first, before the relative offsets. */
373#undef DBX_FUNCTION_FIRST
374#define DBX_CHECK_FUNCTION_FIRST TARGET_ELF
375
376#undef DBX_REGISTER_NUMBER
377#define DBX_REGISTER_NUMBER(n) (TARGET_64BIT ? dbx64_register_map[n] \
378 : (write_symbols == DWARF2_DEBUG \
379 || write_symbols == DWARF_DEBUG) \
380 ? svr4_dbx_register_map[(n)] \
381 : dbx_register_map[(n)])
382
383/* tag end of file in elf mode */
384#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
385#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
386 do { \
387 if (TARGET_ELF) { \
388 fprintf ((FILE), "\t.text\n\t.stabs \"\",%d,0,0,%LLetext\n%LLetext:\n", \
389 N_SO); \
390 } \
391 } while (0)
392
393/* stabs-in-elf has offsets relative to function beginning */
394#undef DBX_OUTPUT_LBRAC
395#define DBX_OUTPUT_LBRAC(FILE, NAME) \
396 do { \
--- 24 unchanged lines hidden ---
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
--- 9 unchanged lines hidden (view full) ---
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 95810 2002-04-30 17:15:01Z obrien $ */
27
28#undef TARGET_VERSION
29#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)");
30
31#undef CC1_SPEC
32#define CC1_SPEC "%(cc1_cpu) %{profile:-p} \
33 %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
34 %{maout: %{!mno-underscores: %{!munderscores: -munderscores }}}"
35
36#undef ASM_SPEC
37#define ASM_SPEC "%{v*: -v} %{maout: %{fpic:-k} %{fPIC:-k}}"
38
39#undef ASM_FINAL_SPEC
40#define ASM_FINAL_SPEC "%|"
--- 71 unchanged lines hidden (view full) ---
112#define SIZE_TYPE "unsigned int"
113
114#undef PTRDIFF_TYPE
115#define PTRDIFF_TYPE "int"
116
117#undef WCHAR_TYPE_SIZE
118#define WCHAR_TYPE_SIZE BITS_PER_WORD
119
120#undef TARGET_VERSION
121#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)");
122
123#define MASK_PROFILER_EPILOGUE 010000000000
124#define MASK_AOUT 004000000000 /* a.out not elf */
125#define MASK_UNDERSCORES 002000000000 /* use leading _ */
126
127#define TARGET_PROFILER_EPILOGUE (target_flags & MASK_PROFILER_EPILOGUE)
--- 6 unchanged lines hidden (view full) ---
134 { "profiler-epilogue", MASK_PROFILER_EPILOGUE, "Function profiler epilogue"}, \
135 { "no-profiler-epilogue", -MASK_PROFILER_EPILOGUE, "No function profiler epilogue"}, \
136 { "aout", MASK_AOUT, "Generate an a.out (vs. ELF) binary"}, \
137 { "no-aout", -MASK_AOUT, "Do not generate an a.out binary"}, \
138 { "underscores", MASK_UNDERSCORES, "Add leading underscores to symbols"}, \
139 { "no-underscores", -MASK_UNDERSCORES, "Do not add leading underscores to symbols"},
140
141/* This goes away when the math emulator is fixed. */
142#undef TARGET_SUBTARGET_DEFAULT
143#define TARGET_SUBTARGET_DEFAULT \
144 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
145
146/* Don't default to pcc-struct-return, we want to retain compatibility with
147 older gcc versions AND pcc-struct-return is nonreentrant.
148 (even though the SVR4 ABI for the i386 says that records and unions are
149 returned in memory). */
150
151#undef DEFAULT_PCC_STRUCT_RETURN
--- 15 unchanged lines hidden (view full) ---
167#undef GEN_CALL__MAIN
168#define GEN_CALL__MAIN \
169 do { \
170 if (!(TARGET_ELF)) \
171 emit_library_call (gen_rtx (SYMBOL_REF, Pmode, NAME__MAIN), 0, \
172 VOIDmode, 0); \
173 } while (0)
174
175/* Tell final.c that we don't need a label passed to mcount. */
176#define NO_PROFILE_COUNTERS 1
177
178/* Output assembler code to FILE to begin profiling of the current function.
179 LABELNO is an optional label. */
180
181#undef FUNCTION_PROFILER
182#define FUNCTION_PROFILER(FILE, LABELNO) \
183 do { \
184 char *_name = TARGET_AOUT ? "mcount" : ".mcount"; \
185 if (flag_pic) \
186 fprintf ((FILE), "\tcall *%s@GOT(%%ebx)\n", _name); \
187 else \
188 fprintf ((FILE), "\tcall %s\n", _name); \
189 } while (0)
190
191/* Output assembler code to FILE to end profiling of the current function. */
192
193#undef FUNCTION_PROFILER_EPILOGUE /* BDE will need to fix this. */
194
195
196/************************[ Assembler stuff ]********************************/
197
198/* Override the default comment-starter of "/" from unix.h. */
199#undef ASM_COMMENT_START
200#define ASM_COMMENT_START "#"
201
202#undef ASM_APP_ON
203#define ASM_APP_ON "#APP\n"
204
205#undef ASM_APP_OFF
206#define ASM_APP_OFF "#NO_APP\n"
207
208/* This is how to store into the string BUF
209 the symbol_ref name of an internal numbered label where
210 PREFIX is the class of label and NUM is the number within the class.
211 This is suitable for output with `assemble_name'. */
212#undef ASM_GENERATE_INTERNAL_LABEL
213#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
214 sprintf ((LABEL), "*%s%s%u", (TARGET_UNDERSCORES) ? "" : ".", \
215 (PREFIX), (unsigned) (NUM))
216
217/* This is how to output an internal numbered label where
218 PREFIX is the class of label and NUM is the number within the class.
219 For most svr4/ELF systems, the convention is that any symbol which begins
220 with a period is not put into the linker symbol table by the assembler. */
221#undef ASM_OUTPUT_INTERNAL_LABEL
222#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \
223 fprintf ((FILE), "%s%s%u:\n", (TARGET_UNDERSCORES) ? "" : ".", \
224 (PREFIX), (unsigned) (NUM))
225
226/* This is how to output a reference to a user-level label named NAME. */
227#undef ASM_OUTPUT_LABELREF
228#define ASM_OUTPUT_LABELREF(FILE, NAME) \
229 do { \
230 char *_name = (NAME); \
231 /* Hack to avoid writing lots of rtl in \
232 FUNCTION_PROFILER_EPILOGUE (). */ \
--- 8 unchanged lines hidden (view full) ---
241 } \
242 else \
243 fprintf (FILE, "%s%s", TARGET_UNDERSCORES ? "_" : "", _name); \
244} while (0)
245
246/* This is how to hack on the symbol code of certain relcalcitrant
247 symbols to modify their output in output_pic_addr_const (). */
248
249#undef ASM_HACK_SYMBOLREF_CODE /* BDE will need to fix this. */
250
251/* This is how to output an element of a case-vector that is relative.
252 This is only used for PIC code. See comments by the `casesi' insn in
253 i386.md for an explanation of the expression this outputs. */
254#undef ASM_OUTPUT_ADDR_DIFF_ELT
255#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
256 fprintf ((FILE), "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, (VALUE))
257
--- 85 unchanged lines hidden (view full) ---
343 } \
344 else \
345 { \
346 fprintf ((FILE), "\t%s %d,0,%d\n", ASM_STABD_OP, N_SLINE, \
347 lineno); \
348 } \
349 } while (0)
350
351/* A C statement to output to the stdio stream FILE an assembler
352 command to advance the location counter to a multiple of 1<<LOG
353 bytes if it is within MAX_SKIP bytes.
354
355 This is used to align code labels according to Intel recommendations. */
356
357#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
358#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \
359 if ((LOG) != 0) { \
360 if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
361 else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
362 }
363#endif
364
365
366/************************[ Debugger stuff ]*********************************/
367
368/* The a.out tools do not support "Lscope" .stabs symbols. */
369#undef NO_DBX_FUNCTION_END
370#define NO_DBX_FUNCTION_END TARGET_AOUT
371
372/* In ELF, the function stabs come first, before the relative offsets. */
373#undef DBX_FUNCTION_FIRST
374#define DBX_CHECK_FUNCTION_FIRST TARGET_ELF
375
376#undef DBX_REGISTER_NUMBER
377#define DBX_REGISTER_NUMBER(n) (TARGET_64BIT ? dbx64_register_map[n] \
378 : (write_symbols == DWARF2_DEBUG \
379 || write_symbols == DWARF_DEBUG) \
380 ? svr4_dbx_register_map[(n)] \
381 : dbx_register_map[(n)])
382
383/* tag end of file in elf mode */
384#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
385#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
386 do { \
387 if (TARGET_ELF) { \
388 fprintf ((FILE), "\t.text\n\t.stabs \"\",%d,0,0,%LLetext\n%LLetext:\n", \
389 N_SO); \
390 } \
391 } while (0)
392
393/* stabs-in-elf has offsets relative to function beginning */
394#undef DBX_OUTPUT_LBRAC
395#define DBX_OUTPUT_LBRAC(FILE, NAME) \
396 do { \
--- 24 unchanged lines hidden ---