freebsd.h revision 204549
1/* Definitions for MIPS varients running FreeBSD with ELF format 2 Copyright (C) 2008 Free Software Foundation, Inc. 3 Continued by David O'Brien <obrien@freebsd.org> 4 5This file is part of GCC. 6 7GCC is free software; you can redistribute it and/or modify 8it under the terms of the GNU General Public License as published by 9the Free Software Foundation; either version 2, or (at your option) 10any later version. 11 12GCC is distributed in the hope that it will be useful, 13but WITHOUT ANY WARRANTY; without even the implied warranty of 14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15GNU General Public License for more details. 16 17You should have received a copy of the GNU General Public License 18along with GCC; see the file COPYING. If not, write to 19the Free Software Foundation, 51 Franklin Street, Fifth Floor, 20Boston, MA 02110-1301, USA. */ 21 22/* $FreeBSD: head/contrib/gcc/config/mips/freebsd.h 204549 2010-03-02 05:59:14Z imp $ */ 23 24/* This defines which switch letters take arguments. -G is a MIPS 25 special. */ 26 27#undef SWITCH_TAKES_ARG 28#define SWITCH_TAKES_ARG(CHAR) \ 29 (FBSD_SWITCH_TAKES_ARG (CHAR) \ 30 || (CHAR) == 'R' \ 31 || (CHAR) == 'G') 32 33#undef SUBTARGET_EXTRA_SPECS /* mips.h bogusly defines it. */ 34#define SUBTARGET_EXTRA_SPECS \ 35 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER}, \ 36 { "fbsd_link_spec", FBSD_LINK_SPEC } 37 38/* config/mips/mips.h defines CC1_SPEC, 39 but gives us an "out" with SUBTARGET_CC1_SPEC. */ 40#undef SUBTARGET_CC1_SPEC 41#define SUBTARGET_CC1_SPEC "%{profile:-p}" 42 43/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support 44 for the special GCC options -static and -shared, which allow us to 45 link things in one of these three modes by applying the appropriate 46 combinations of options at link-time. We like to support here for 47 as many of the other GNU linker options as possible. But I don't 48 have the time to search for those flags. I am sure how to add 49 support for -soname shared_object_name. H.J. 50 51 When the -shared link option is used a final link is not being 52 done. */ 53 54#define FBSD_LINK_SPEC "\ 55 %{p:%nconsider using `-pg' instead of `-p' with gprof(1) } \ 56 %{v:-V} \ 57 %{assert*} %{R*} %{rpath*} %{defsym*} \ 58 %{shared:-Bshareable %{h*} %{soname*}} \ 59 %{!shared: \ 60 %{!static: \ 61 %{rdynamic: -export-dynamic} \ 62 %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ 63 %{static:-Bstatic}} \ 64 %{symbolic:-Bsymbolic} " 65 66#undef LINK_SPEC 67#define LINK_SPEC "\ 68 %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} %{mips64} \ 69 %{bestGnum} %{call_shared} %{no_archive} %{exact_version} \ 70 %(fbsd_link_spec) " 71#if 0 72 %(endian_spec) 73#endif 74 75/* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h 76 but trashed by config/mips/elf.h. */ 77#undef STARTFILE_SPEC 78#define STARTFILE_SPEC FBSD_STARTFILE_SPEC 79 80/* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386. */ 81#undef ENDFILE_SPEC 82#define ENDFILE_SPEC FBSD_ENDFILE_SPEC 83 84/* Reset our LIB_SPEC which was properly set in config/freebsd.h 85 but trashed by config/mips/elf.h. */ 86#undef LIB_SPEC 87#define LIB_SPEC FBSD_LIB_SPEC 88 89/* config/mips/mips.h defines CPP_SPEC, and it expects SUBTARGET_CPP_SPEC. */ 90#undef SUBTARGET_CPP_SPEC 91#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC 92 93 94/************************[ Target stuff ]***********************************/ 95 96/* Define the actual types of some ANSI-mandated types. 97 Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c, 98 c-common.c, and config/<arch>/<arch>.h. */ 99 100#undef TARGET_DEFAULT 101#define TARGET_DEFAULT (MASK_ABICALLS | MASK_SOFT_FLOAT) 102 103#if TARGET_ENDIAN_DEFAULT != 0 104#define TARGET_VERSION fprintf (stderr, " (FreeBSD/mips)"); 105#else 106#define TARGET_VERSION fprintf (stderr, " (FreeBSD/mipsel)"); 107#endif 108 109/* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for FreeBSD. 110 Specifically, they define too many namespace-invasive macros. Override 111 them here. Note this is structured for easy comparison to the version 112 in mips.h. */ 113 114#undef TARGET_CPU_CPP_BUILTINS 115#define TARGET_CPU_CPP_BUILTINS() \ 116 do \ 117 { \ 118 builtin_assert ("machine=mips"); \ 119 builtin_assert ("cpu=mips"); \ 120 builtin_define ("__mips__"); \ 121 \ 122 if (TARGET_64BIT) \ 123 builtin_define ("__mips64__"); \ 124 \ 125 if (TARGET_FLOAT64) \ 126 builtin_define ("__mips_fpr=64"); \ 127 else \ 128 builtin_define ("__mips_fpr=32"); \ 129 \ 130 if (TARGET_MIPS16) \ 131 builtin_define ("__mips16"); \ 132 \ 133 if (mips_abi == ABI_N32) \ 134 { \ 135 builtin_define ("__mips_n32"); \ 136 builtin_define ("_ABIN32=2"); \ 137 builtin_define ("_MIPS_SIM=_ABIN32"); \ 138 builtin_define ("_MIPS_SZLONG=32"); \ 139 builtin_define ("_MIPS_SZPTR=32"); \ 140 } \ 141 else if (mips_abi == ABI_64) \ 142 { \ 143 builtin_define ("__mips_n64"); \ 144 builtin_define ("_ABI64=3"); \ 145 builtin_define ("_MIPS_SIM=_ABI64"); \ 146 builtin_define ("_MIPS_SZLONG=64"); \ 147 builtin_define ("_MIPS_SZPTR=64"); \ 148 } \ 149 else if (mips_abi == ABI_O64) \ 150 { \ 151 builtin_define ("__mips_o64"); \ 152 builtin_define ("_ABIO64=4"); \ 153 builtin_define ("_MIPS_SIM=_ABIO64"); \ 154 builtin_define ("_MIPS_SZLONG=64"); \ 155 builtin_define ("_MIPS_SZPTR=64"); \ 156 } \ 157 else if (mips_abi == ABI_EABI) \ 158 { \ 159 builtin_define ("__mips_eabi"); \ 160 builtin_define ("_ABIEMB=5"); \ 161 builtin_define ("_MIPS_SIM=_ABIEMB"); \ 162 if (TARGET_LONG64) \ 163 builtin_define ("_MIPS_SZLONG=64"); \ 164 else \ 165 builtin_define ("_MIPS_SZLONG=32"); \ 166 if (TARGET_64BIT) \ 167 builtin_define ("_MIPS_SZPTR=64"); \ 168 else \ 169 builtin_define ("_MIPS_SZPTR=32"); \ 170 } \ 171 else \ 172 { \ 173 builtin_define ("__mips_o32"); \ 174 builtin_define ("_ABIO32=1"); \ 175 builtin_define ("_MIPS_SIM=_ABIO32"); \ 176 builtin_define ("_MIPS_SZLONG=32"); \ 177 builtin_define ("_MIPS_SZPTR=32"); \ 178 } \ 179 if (TARGET_FLOAT64) \ 180 builtin_define ("_MIPS_FPSET=32"); \ 181 else \ 182 builtin_define ("_MIPS_FPSET=16"); \ 183 \ 184 builtin_define ("_MIPS_SZINT=32"); \ 185 \ 186 MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \ 187 MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \ 188 \ 189 if (ISA_MIPS1) \ 190 builtin_define ("__mips=1"); \ 191 else if (ISA_MIPS2) \ 192 builtin_define ("__mips=2"); \ 193 else if (ISA_MIPS3) \ 194 builtin_define ("__mips=3"); \ 195 else if (ISA_MIPS4) \ 196 builtin_define ("__mips=4"); \ 197 else if (ISA_MIPS32) \ 198 { \ 199 builtin_define ("__mips=32"); \ 200 builtin_define ("__mips_isa_rev=1"); \ 201 } \ 202 else if (ISA_MIPS32R2) \ 203 { \ 204 builtin_define ("__mips=32"); \ 205 builtin_define ("__mips_isa_rev=2"); \ 206 } \ 207 else if (ISA_MIPS64) \ 208 { \ 209 builtin_define ("__mips=64"); \ 210 builtin_define ("__mips_isa_rev=1"); \ 211 } \ 212/* else if (ISA_MIPS64R2) \ 213 { \ 214 builtin_define ("__mips=64"); \ 215 builtin_define ("__mips_isa_rev=2"); \ 216 } \ 217*/ \ 218 if (TARGET_HARD_FLOAT) \ 219 builtin_define ("__mips_hard_float"); \ 220 else if (TARGET_SOFT_FLOAT) \ 221 builtin_define ("__mips_soft_float"); \ 222 \ 223 if (TARGET_SINGLE_FLOAT) \ 224 builtin_define ("__mips_single_float"); \ 225 \ 226 if (TARGET_BIG_ENDIAN) \ 227 builtin_define ("__MIPSEB__"); \ 228 else \ 229 builtin_define ("__MIPSEL__"); \ 230 \ 231 /* No language dialect defines. */ \ 232 if (TARGET_ABICALLS) \ 233 builtin_define ("__ABICALLS__"); \ 234 } \ 235 while (0) 236 237/* Default to the mips32 ISA */ 238#undef DRIVER_SELF_SPECS 239#define DRIVER_SELF_SPECS \ 240 "%{!march=*: -march=mips32}" 241#if 0 242 "%{!EB:%{!EL:%(endian_spec)}}", 243#endif 244 245#if 0 246/* Don't default to pcc-struct-return, we want to retain compatibility with 247 older gcc versions AND pcc-struct-return is nonreentrant. 248 (even though the SVR4 ABI for the i386 says that records and unions are 249 returned in memory). */ 250 251#undef DEFAULT_PCC_STRUCT_RETURN 252#define DEFAULT_PCC_STRUCT_RETURN 0 253#endif 254 255 256/************************[ Assembler stuff ]********************************/ 257 258#undef SUBTARGET_ASM_SPEC 259#define SUBTARGET_ASM_SPEC \ 260 "%{!mno-abicalls: %{!fno-PIC:%{!fno-pic:-KPIC}}}" 261 262/* -G is incompatible with -KPIC which is the default, so only allow objects 263 in the small data section if the user explicitly asks for it. */ 264 265#undef MIPS_DEFAULT_GVALUE 266#define MIPS_DEFAULT_GVALUE 0 267 268/* If defined, a C expression whose value is a string containing the 269 assembler operation to identify the following data as 270 uninitialized global data. If not defined, and neither 271 `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined, 272 uninitialized global data will be output in the data section if 273 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be 274 used. */ 275#undef BSS_SECTION_ASM_OP 276#define BSS_SECTION_ASM_OP "\t.section\t.bss" 277 278/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a 279 separate, explicit argument. If you define this macro, it is used 280 in place of `ASM_OUTPUT_BSS', and gives you more flexibility in 281 handling the required alignment of the variable. The alignment is 282 specified as the number of bits. 283 284 Try to use function `asm_output_aligned_bss' defined in file 285 `varasm.c' when defining this macro. */ 286#undef ASM_OUTPUT_ALIGNED_BSS 287#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ 288 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) 289 290/* Standard AT&T UNIX 'as' local label spelling. */ 291#undef LOCAL_LABEL_PREFIX 292#define LOCAL_LABEL_PREFIX "." 293 294/* Currently we don't support 128bit long doubles, so for now we force 295 n32 to be 64bit. */ 296#undef LONG_DOUBLE_TYPE_SIZE 297#define LONG_DOUBLE_TYPE_SIZE 64 298 299#ifdef IN_LIBGCC2 300#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE 301#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 302#endif 303 304/************************[ Debugger stuff ]*********************************/ 305 306