freebsd.h revision 114077
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 114077 2003-04-26 19:16:54Z obrien $ */ 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:%e`-p' not supported; use `-pg' and 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#undef TARGET_VERSION 103#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)"); 104 105#define MASK_PROFILER_EPILOGUE 010000000000 106 107#define TARGET_PROFILER_EPILOGUE (target_flags & MASK_PROFILER_EPILOGUE) 108#define TARGET_ELF 1 109 110#undef SUBTARGET_SWITCHES 111#define SUBTARGET_SWITCHES \ 112 { "profiler-epilogue", MASK_PROFILER_EPILOGUE, "Function profiler epilogue"}, \ 113 { "no-profiler-epilogue", -MASK_PROFILER_EPILOGUE, "No function profiler epilogue"}, 114 115/* This goes away when the math emulator is fixed. */ 116#undef TARGET_SUBTARGET_DEFAULT 117#define TARGET_SUBTARGET_DEFAULT \ 118 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387) 119 120/* Don't default to pcc-struct-return, we want to retain compatibility with 121 older gcc versions AND pcc-struct-return is nonreentrant. 122 (even though the SVR4 ABI for the i386 says that records and unions are 123 returned in memory). */ 124 125#undef DEFAULT_PCC_STRUCT_RETURN 126#define DEFAULT_PCC_STRUCT_RETURN 0 127 128/* Tell final.c that we don't need a label passed to mcount. */ 129#define NO_PROFILE_COUNTERS 1 130 131/* Output assembler code to FILE to begin profiling of the current function. 132 LABELNO is an optional label. */ 133 134#undef FUNCTION_PROFILER 135#define FUNCTION_PROFILER(FILE, LABELNO) \ 136 do { \ 137 if (flag_pic) \ 138 fprintf ((FILE), "\tcall *.mcount%s@GOT(%%ebx)\n"); \ 139 else \ 140 fprintf ((FILE), "\tcall .mcount\n"); \ 141 } while (0) 142 143/* Output assembler code to FILE to end profiling of the current function. */ 144 145#undef FUNCTION_PROFILER_EPILOGUE /* BDE will need to fix this. */ 146 147 148/************************[ Assembler stuff ]********************************/ 149 150/* Override the default comment-starter of "/" from unix.h. */ 151#undef ASM_COMMENT_START 152#define ASM_COMMENT_START "#" 153 154/* Override the default comment-starter of "/APP" from unix.h. */ 155#undef ASM_APP_ON 156#define ASM_APP_ON "#APP\n" 157#undef ASM_APP_OFF 158#define ASM_APP_OFF "#NO_APP\n" 159 160/* XXX:DEO do we still need this override to defaults.h ?? */ 161/* This is how to output a reference to a user-level label named NAME. */ 162#undef ASM_OUTPUT_LABELREF 163#define ASM_OUTPUT_LABELREF(FILE, NAME) \ 164 do { \ 165 char *_name = (NAME); \ 166 /* Hack to avoid writing lots of rtl in \ 167 FUNCTION_PROFILER_EPILOGUE (). */ \ 168 if (*_name == '.' && strcmp(_name + 1, "mexitcount") == 0) \ 169 { \ 170 if (flag_pic) \ 171 fprintf ((FILE), "*%s@GOT(%%ebx)", _name); \ 172 else \ 173 fprintf ((FILE), "%s", _name); \ 174 } \ 175 else \ 176 fprintf (FILE, "%s", _name); \ 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#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \ 206 do { \ 207 if ((LOG) != 0) { \ 208 if ((MAX_SKIP) == 0) \ 209 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ 210 else \ 211 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ 212 } \ 213 } while (0) 214#endif 215 216/* If defined, a C expression whose value is a string containing the 217 assembler operation to identify the following data as 218 uninitialized global data. If not defined, and neither 219 `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined, 220 uninitialized global data will be output in the data section if 221 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be 222 used. */ 223#undef BSS_SECTION_ASM_OP 224#define BSS_SECTION_ASM_OP "\t.section\t.bss" 225 226/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a 227 separate, explicit argument. If you define this macro, it is used 228 in place of `ASM_OUTPUT_BSS', and gives you more flexibility in 229 handling the required alignment of the variable. The alignment is 230 specified as the number of bits. 231 232 Try to use function `asm_output_aligned_bss' defined in file 233 `varasm.c' when defining this macro. */ 234#undef ASM_OUTPUT_ALIGNED_BSS 235#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ 236 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) 237 238/************************[ Debugger stuff ]*********************************/ 239 240#undef DBX_REGISTER_NUMBER 241#define DBX_REGISTER_NUMBER(n) (TARGET_64BIT ? dbx64_register_map[n] \ 242 : (write_symbols == DWARF2_DEBUG \ 243 || write_symbols == DWARF_DEBUG) \ 244 ? svr4_dbx_register_map[(n)] \ 245 : dbx_register_map[(n)]) 246 247/* The same functions are used to creating the DWARF2 debug info and C++ 248 unwind info (except.c). Regardless of the debug format requested, the 249 register numbers used in exception unwinding sections still have to be 250 DWARF compatible. IMO the GCC folks may be abusing the DBX_REGISTER_NUMBER 251 macro to mean too much. */ 252#define DWARF_FRAME_REGNUM(n) (TARGET_64BIT ? dbx64_register_map[n] \ 253 : svr4_dbx_register_map[(n)]) 254 255/* stabs-in-elf has offsets relative to function beginning */ 256#undef DBX_OUTPUT_LBRAC 257#define DBX_OUTPUT_LBRAC(FILE, NAME) \ 258 do { \ 259 fprintf (asmfile, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC); \ 260 assemble_name (asmfile, buf); \ 261 fputc ('-', asmfile); \ 262 assemble_name (asmfile, \ 263 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ 264 fprintf (asmfile, "\n"); \ 265 } while (0) 266 267#undef DBX_OUTPUT_RBRAC 268#define DBX_OUTPUT_RBRAC(FILE, NAME) \ 269 do { \ 270 fprintf (asmfile, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC); \ 271 assemble_name (asmfile, buf); \ 272 fputc ('-', asmfile); \ 273 assemble_name (asmfile, \ 274 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ 275 fprintf (asmfile, "\n"); \ 276 } while (0) 277