freebsd.h revision 217098
1148456Spjd/* Definitions for Intel 386 running FreeBSD with ELF format 2213072Spjd Copyright (C) 1996, 2000, 2002, 2004 Free Software Foundation, Inc. 3148456Spjd Contributed by Eric Youngdale. 4148456Spjd Modified for stabs-in-ELF by H.J. Lu. 5148456Spjd Adapted from GNU/Linux version by John Polstra. 6148456Spjd Continued development by David O'Brien <obrien@freebsd.org> 7148456Spjd 8148456SpjdThis file is part of GCC. 9148456Spjd 10148456SpjdGCC is free software; you can redistribute it and/or modify 11148456Spjdit under the terms of the GNU General Public License as published by 12148456Spjdthe Free Software Foundation; either version 2, or (at your option) 13155174Spjdany later version. 14148456Spjd 15148456SpjdGCC is distributed in the hope that it will be useful, 16148456Spjdbut WITHOUT ANY WARRANTY; without even the implied warranty of 17148456SpjdMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18148456SpjdGNU General Public License for more details. 19148456Spjd 20148456SpjdYou should have received a copy of the GNU General Public License 21148456Spjdalong with GCC; see the file COPYING. If not, write to 22148456Spjdthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 23148456SpjdBoston, MA 02110-1301, USA. */ 24148456Spjd 25148456Spjd/* $FreeBSD: head/contrib/gcc/config/i386/freebsd.h 217098 2011-01-07 14:24:24Z kib $ */ 26148456Spjd 27148456Spjd#undef CC1_SPEC 28148456Spjd#define CC1_SPEC "%(cc1_cpu) %{profile:-p}" 29148456Spjd 30148456Spjd/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support 31148456Spjd for the special GCC options -static and -shared, which allow us to 32148456Spjd link things in one of these three modes by applying the appropriate 33148456Spjd combinations of options at link-time. We like to support here for 34148456Spjd as many of the other GNU linker options as possible. But I don't 35148456Spjd have the time to search for those flags. I am sure how to add 36148456Spjd support for -soname shared_object_name. H.J. 37148456Spjd 38148456Spjd When the -shared link option is used a final link is not being 39148456Spjd done. */ 40148456Spjd 41148456Spjd#undef LINK_SPEC 42148456Spjd#define LINK_SPEC "\ 43148456Spjd %{p:%nconsider using `-pg' instead of `-p' with gprof(1) } \ 44148867Spjd %{v:-V} \ 45148456Spjd %{assert*} %{R*} %{rpath*} %{defsym*} \ 46148456Spjd %{shared:-Bshareable %{h*} %{soname*}} \ 47148456Spjd %{!shared: \ 48148456Spjd %{!static: \ 49148456Spjd %{rdynamic: -export-dynamic} \ 50148456Spjd %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ 51148456Spjd %{static:-Bstatic}} \ 52148456Spjd %{symbolic:-Bsymbolic}" 53148456Spjd 54148456Spjd/* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h 55148456Spjd but trashed by config/<cpu>/<file.h>. */ 56148456Spjd 57159307Spjd#undef STARTFILE_SPEC 58159307Spjd#define STARTFILE_SPEC FBSD_STARTFILE_SPEC 59161217Spjd 60211927Spjd/* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386. */ 61211927Spjd 62161220Spjd#undef ENDFILE_SPEC 63213070Spjd#define ENDFILE_SPEC FBSD_ENDFILE_SPEC 64148456Spjd 65213067Spjd 66148456Spjd/************************[ Target stuff ]***********************************/ 67161127Spjd 68148456Spjd/* Define the actual types of some ANSI-mandated types. 69161220Spjd Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c, 70148456Spjd c-common.c, and config/<arch>/<arch>.h. */ 71161220Spjd 72148456Spjd#undef SIZE_TYPE 73161220Spjd#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") 74148456Spjd 75161220Spjd#undef PTRDIFF_TYPE 76159307Spjd#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") 77161220Spjd 78161127Spjd#undef WCHAR_TYPE_SIZE 79161220Spjd#define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD) 80161127Spjd 81148456Spjd#undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */ 82161220Spjd#define SUBTARGET_EXTRA_SPECS \ 83148456Spjd { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER } 84161220Spjd 85161220Spjd#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)"); 86161220Spjd 87213067Spjd#define TARGET_ELF 1 88213067Spjd 89148456Spjd/* Don't default to pcc-struct-return, we want to retain compatibility with 90148456Spjd older gcc versions AND pcc-struct-return is nonreentrant. 91159307Spjd (even though the SVR4 ABI for the i386 says that records and unions are 92148456Spjd returned in memory). */ 93148456Spjd 94148456Spjd#undef DEFAULT_PCC_STRUCT_RETURN 95148456Spjd#define DEFAULT_PCC_STRUCT_RETURN 0 96148456Spjd 97159307Spjd/* FreeBSD sets the rounding precision of the FPU to 53 bits. Let the 98148456Spjd compiler get the contents of <float.h> and std::numeric_limits correct. */ 99148456Spjd#undef TARGET_96_ROUND_53_LONG_DOUBLE 100148456Spjd#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT) 101148456Spjd 102148456Spjd/* Tell final.c that we don't need a label passed to mcount. */ 103213062Spjd#define NO_PROFILE_COUNTERS 1 104213067Spjd 105213067Spjd/* Output assembler code to FILE to begin profiling of the current function. 106148456Spjd LABELNO is an optional label. */ 107148456Spjd 108213165Spjd#undef MCOUNT_NAME 109148456Spjd#define MCOUNT_NAME ".mcount" 110159307Spjd 111148456Spjd/* Output assembler code to FILE to end profiling of the current function. */ 112148456Spjd 113148456Spjd#undef FUNCTION_PROFILER_EPILOGUE /* BDE will need to fix this. */ 114148456Spjd 115148456Spjd 116148456Spjd/************************[ Assembler stuff ]********************************/ 117148456Spjd 118148456Spjd/* Override the default comment-starter of "/" from unix.h. */ 119148456Spjd#undef ASM_COMMENT_START 120148456Spjd#define ASM_COMMENT_START "#" 121148456Spjd 122148456Spjd/* Override the default comment-starter of "/APP" from unix.h. */ 123148456Spjd#undef ASM_APP_ON 124148456Spjd#define ASM_APP_ON "#APP\n" 125148456Spjd#undef ASM_APP_OFF 126148456Spjd#define ASM_APP_OFF "#NO_APP\n" 127148456Spjd 128148456Spjd/* XXX:DEO do we still need this override to defaults.h ?? */ 129148456Spjd/* This is how to output a reference to a user-level label named NAME. */ 130148456Spjd#undef ASM_OUTPUT_LABELREF 131148456Spjd#define ASM_OUTPUT_LABELREF(FILE, NAME) \ 132148456Spjd do { \ 133148456Spjd const char *xname = (NAME); \ 134148456Spjd /* Hack to avoid writing lots of rtl in \ 135148456Spjd FUNCTION_PROFILER_EPILOGUE (). */ \ 136148456Spjd if (*xname == '.' && strcmp(xname + 1, "mexitcount") == 0) \ 137148456Spjd { \ 138148456Spjd if (flag_pic) \ 139148456Spjd fprintf ((FILE), "*%s@GOT(%%ebx)", xname); \ 140148456Spjd else \ 141148456Spjd fprintf ((FILE), "%s", xname); \ 142148456Spjd } \ 143148456Spjd else \ 144148456Spjd { \ 145148456Spjd if (xname[0] == '%') \ 146148456Spjd xname += 2; \ 147213067Spjd if (xname[0] == '*') \ 148213067Spjd xname += 1; \ 149213067Spjd else \ 150213067Spjd fputs (user_label_prefix, FILE); \ 151213067Spjd fputs (xname, FILE); \ 152213067Spjd } \ 153213067Spjd} while (0) 154213067Spjd 155213067Spjd/* This is how to hack on the symbol code of certain relcalcitrant 156213067Spjd symbols to modify their output in output_pic_addr_const (). */ 157213067Spjd 158213067Spjd#undef ASM_HACK_SYMBOLREF_CODE /* BDE will need to fix this. */ 159213067Spjd 160213067Spjd/* A C statement to output to the stdio stream FILE an assembler 161213067Spjd command to advance the location counter to a multiple of 1<<LOG 162213067Spjd bytes if it is within MAX_SKIP bytes. 163213067Spjd 164213067Spjd This is used to align code labels according to Intel recommendations. */ 165213067Spjd 166213067Spjd/* XXX configuration of this is broken in the same way as HAVE_GAS_SHF_MERGE, 167148456Spjd but it is easier to fix in an MD way. */ 168148456Spjd 169148456Spjd#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN 170213067Spjd#undef ASM_OUTPUT_MAX_SKIP_ALIGN 171148456Spjd#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \ 172148456Spjd do { \ 173148456Spjd if ((LOG) != 0) { \ 174148456Spjd if ((MAX_SKIP) == 0) \ 175148456Spjd fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ 176148456Spjd else \ 177148456Spjd fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ 178148456Spjd } \ 179148456Spjd } while (0) 180159307Spjd#endif 181148456Spjd 182159307Spjd/* If defined, a C expression whose value is a string containing the 183148456Spjd assembler operation to identify the following data as 184148456Spjd uninitialized global data. If not defined, and neither 185148456Spjd `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined, 186149303Spjd uninitialized global data will be output in the data section if 187148456Spjd `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be 188148456Spjd used. */ 189148456Spjd#undef BSS_SECTION_ASM_OP 190148456Spjd#define BSS_SECTION_ASM_OP "\t.section\t.bss" 191149323Spjd 192148456Spjd/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a 193148456Spjd separate, explicit argument. If you define this macro, it is used 194148456Spjd in place of `ASM_OUTPUT_BSS', and gives you more flexibility in 195148456Spjd handling the required alignment of the variable. The alignment is 196148456Spjd specified as the number of bits. 197148456Spjd 198148456Spjd Try to use function `asm_output_aligned_bss' defined in file 199148456Spjd `varasm.c' when defining this macro. */ 200148456Spjd#undef ASM_OUTPUT_ALIGNED_BSS 201148456Spjd#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ 202148456Spjd asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) 203159307Spjd 204148456Spjd/************************[ Debugger stuff ]*********************************/ 205159307Spjd 206148456Spjd#undef DBX_REGISTER_NUMBER 207148456Spjd#define DBX_REGISTER_NUMBER(n) (TARGET_64BIT ? dbx64_register_map[n] \ 208148456Spjd : (write_symbols == DWARF2_DEBUG) \ 209148456Spjd ? svr4_dbx_register_map[(n)] \ 210148456Spjd : dbx_register_map[(n)]) 211148456Spjd 212148456Spjd/* The same functions are used to creating the DWARF2 debug info and C++ 213148456Spjd unwind info (except.c). Regardless of the debug format requested, the 214157305Spjd register numbers used in exception unwinding sections still have to be 215148456Spjd DWARF compatible. IMO the GCC folks may be abusing the DBX_REGISTER_NUMBER 216148456Spjd macro to mean too much. */ 217148456Spjd#define DWARF_FRAME_REGNUM(n) (TARGET_64BIT ? dbx64_register_map[n] \ 218148456Spjd : svr4_dbx_register_map[(n)]) 219148456Spjd 220148456Spjd/* stabs-in-elf has offsets relative to function beginning */ 221148456Spjd#undef DBX_OUTPUT_LBRAC 222148456Spjd#define DBX_OUTPUT_LBRAC(FILE, NAME) \ 223148456Spjd do { \ 224148456Spjd fprintf (asm_out_file, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC); \ 225159307Spjd assemble_name (asm_out_file, NAME); \ 226148456Spjd fputc ('-', asm_out_file); \ 227148456Spjd assemble_name (asm_out_file, \ 228148456Spjd XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ 229148456Spjd fprintf (asm_out_file, "\n"); \ 230148456Spjd } while (0) 231148456Spjd 232148456Spjd#undef DBX_OUTPUT_RBRAC 233148456Spjd#define DBX_OUTPUT_RBRAC(FILE, NAME) \ 234148456Spjd do { \ 235157305Spjd fprintf (asm_out_file, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC); \ 236148456Spjd assemble_name (asm_out_file, NAME); \ 237148456Spjd fputc ('-', asm_out_file); \ 238148456Spjd assemble_name (asm_out_file, \ 239148456Spjd XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ 240212845Sbrian fprintf (asm_out_file, "\n"); \ 241148456Spjd } while (0) 242213067Spjd 243159307Spjd#undef NEED_INDICATE_EXEC_STACK 244159307Spjd#define NEED_INDICATE_EXEC_STACK 1 245159307Spjd