freebsd.h revision 181534
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 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, 51 Franklin Street, Fifth Floor, 23Boston, MA 02110-1301, USA. */ 24 25/* $FreeBSD: head/contrib/gcc/config/i386/freebsd.h 181534 2008-08-10 19:02:57Z das $ */ 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 %{symbolic:-Bsymbolic}" 53 54/* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h 55 but trashed by config/<cpu>/<file.h>. */ 56 57#undef STARTFILE_SPEC 58#define STARTFILE_SPEC FBSD_STARTFILE_SPEC 59 60/* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386. */ 61 62#undef ENDFILE_SPEC 63#define ENDFILE_SPEC FBSD_ENDFILE_SPEC 64 65 66/************************[ Target stuff ]***********************************/ 67 68/* Define the actual types of some ANSI-mandated types. 69 Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c, 70 c-common.c, and config/<arch>/<arch>.h. */ 71 72#undef SIZE_TYPE 73#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") 74 75#undef PTRDIFF_TYPE 76#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") 77 78#undef WCHAR_TYPE_SIZE 79#define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD) 80 81#undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */ 82#define SUBTARGET_EXTRA_SPECS \ 83 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER } 84 85#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)"); 86 87#define TARGET_ELF 1 88 89/* Don't default to pcc-struct-return, we want to retain compatibility with 90 older gcc versions AND pcc-struct-return is nonreentrant. 91 (even though the SVR4 ABI for the i386 says that records and unions are 92 returned in memory). */ 93 94#undef DEFAULT_PCC_STRUCT_RETURN 95#define DEFAULT_PCC_STRUCT_RETURN 0 96 97/* FreeBSD sets the rounding precision of the FPU to 53 bits. Let the 98 compiler get the contents of <float.h> and std::numeric_limits correct. */ 99#undef TARGET_96_ROUND_53_LONG_DOUBLE 100#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT) 101 102/* Tell final.c that we don't need a label passed to mcount. */ 103#define NO_PROFILE_COUNTERS 1 104 105/* Output assembler code to FILE to begin profiling of the current function. 106 LABELNO is an optional label. */ 107 108#undef MCOUNT_NAME 109#define MCOUNT_NAME ".mcount" 110 111/* Output assembler code to FILE to end profiling of the current function. */ 112 113#undef FUNCTION_PROFILER_EPILOGUE /* BDE will need to fix this. */ 114 115 116/************************[ Assembler stuff ]********************************/ 117 118/* Override the default comment-starter of "/" from unix.h. */ 119#undef ASM_COMMENT_START 120#define ASM_COMMENT_START "#" 121 122/* Override the default comment-starter of "/APP" from unix.h. */ 123#undef ASM_APP_ON 124#define ASM_APP_ON "#APP\n" 125#undef ASM_APP_OFF 126#define ASM_APP_OFF "#NO_APP\n" 127 128/* XXX:DEO do we still need this override to defaults.h ?? */ 129/* This is how to output a reference to a user-level label named NAME. */ 130#undef ASM_OUTPUT_LABELREF 131#define ASM_OUTPUT_LABELREF(FILE, NAME) \ 132 do { \ 133 const char *xname = (NAME); \ 134 /* Hack to avoid writing lots of rtl in \ 135 FUNCTION_PROFILER_EPILOGUE (). */ \ 136 if (*xname == '.' && strcmp(xname + 1, "mexitcount") == 0) \ 137 { \ 138 if (flag_pic) \ 139 fprintf ((FILE), "*%s@GOT(%%ebx)", xname); \ 140 else \ 141 fprintf ((FILE), "%s", xname); \ 142 } \ 143 else \ 144 { \ 145 if (xname[0] == '%') \ 146 xname += 2; \ 147 if (xname[0] == '*') \ 148 xname += 1; \ 149 else \ 150 fputs (user_label_prefix, FILE); \ 151 fputs (xname, FILE); \ 152 } \ 153} while (0) 154 155/* This is how to hack on the symbol code of certain relcalcitrant 156 symbols to modify their output in output_pic_addr_const (). */ 157 158#undef ASM_HACK_SYMBOLREF_CODE /* BDE will need to fix this. */ 159 160/* A C statement to output to the stdio stream FILE an assembler 161 command to advance the location counter to a multiple of 1<<LOG 162 bytes if it is within MAX_SKIP bytes. 163 164 This is used to align code labels according to Intel recommendations. */ 165 166/* XXX configuration of this is broken in the same way as HAVE_GAS_SHF_MERGE, 167 but it is easier to fix in an MD way. */ 168 169#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN 170#undef ASM_OUTPUT_MAX_SKIP_ALIGN 171#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \ 172 do { \ 173 if ((LOG) != 0) { \ 174 if ((MAX_SKIP) == 0) \ 175 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ 176 else \ 177 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ 178 } \ 179 } while (0) 180#endif 181 182/* If defined, a C expression whose value is a string containing the 183 assembler operation to identify the following data as 184 uninitialized global data. If not defined, and neither 185 `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined, 186 uninitialized global data will be output in the data section if 187 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be 188 used. */ 189#undef BSS_SECTION_ASM_OP 190#define BSS_SECTION_ASM_OP "\t.section\t.bss" 191 192/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a 193 separate, explicit argument. If you define this macro, it is used 194 in place of `ASM_OUTPUT_BSS', and gives you more flexibility in 195 handling the required alignment of the variable. The alignment is 196 specified as the number of bits. 197 198 Try to use function `asm_output_aligned_bss' defined in file 199 `varasm.c' when defining this macro. */ 200#undef ASM_OUTPUT_ALIGNED_BSS 201#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ 202 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) 203 204/************************[ Debugger stuff ]*********************************/ 205 206#undef DBX_REGISTER_NUMBER 207#define DBX_REGISTER_NUMBER(n) (TARGET_64BIT ? dbx64_register_map[n] \ 208 : (write_symbols == DWARF2_DEBUG) \ 209 ? svr4_dbx_register_map[(n)] \ 210 : dbx_register_map[(n)]) 211 212/* The same functions are used to creating the DWARF2 debug info and C++ 213 unwind info (except.c). Regardless of the debug format requested, the 214 register numbers used in exception unwinding sections still have to be 215 DWARF compatible. IMO the GCC folks may be abusing the DBX_REGISTER_NUMBER 216 macro to mean too much. */ 217#define DWARF_FRAME_REGNUM(n) (TARGET_64BIT ? dbx64_register_map[n] \ 218 : svr4_dbx_register_map[(n)]) 219 220/* stabs-in-elf has offsets relative to function beginning */ 221#undef DBX_OUTPUT_LBRAC 222#define DBX_OUTPUT_LBRAC(FILE, NAME) \ 223 do { \ 224 fprintf (asm_out_file, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC); \ 225 assemble_name (asm_out_file, NAME); \ 226 fputc ('-', asm_out_file); \ 227 assemble_name (asm_out_file, \ 228 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ 229 fprintf (asm_out_file, "\n"); \ 230 } while (0) 231 232#undef DBX_OUTPUT_RBRAC 233#define DBX_OUTPUT_RBRAC(FILE, NAME) \ 234 do { \ 235 fprintf (asm_out_file, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC); \ 236 assemble_name (asm_out_file, NAME); \ 237 fputc ('-', asm_out_file); \ 238 assemble_name (asm_out_file, \ 239 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ 240 fprintf (asm_out_file, "\n"); \ 241 } while (0) 242