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