freebsd.h revision 201855
1224102Sphilip/* Definitions for MIPS varients running FreeBSD with ELF format 2224102Sphilip Copyright (C) 2008 Free Software Foundation, Inc. 3224102Sphilip Continued by David O'Brien <obrien@freebsd.org> 4224102Sphilip 5224102SphilipThis file is part of GCC. 6287010Sbapt 7287010SbaptGCC is free software; you can redistribute it and/or modify 8224102Sphilipit under the terms of the GNU General Public License as published by 9224102Sphilipthe Free Software Foundation; either version 2, or (at your option) 10242471Sphilipany later version. 11224102Sphilip 12224102SphilipGCC is distributed in the hope that it will be useful, 13224102Sphilipbut WITHOUT ANY WARRANTY; without even the implied warranty of 14224102SphilipMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15224102SphilipGNU General Public License for more details. 16224102Sphilip 17224102SphilipYou should have received a copy of the GNU General Public License 18224102Sphilipalong with GCC; see the file COPYING. If not, write to 19224102Sphilipthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 20224102SphilipBoston, MA 02110-1301, USA. */ 21224102Sphilip 22224102Sphilip/* $FreeBSD: head/contrib/gcc/config/mips/freebsd.h 201855 2010-01-08 23:37:30Z imp $ */ 23224102Sphilip 24224102Sphilip/* This defines which switch letters take arguments. -G is a MIPS 25224102Sphilip special. */ 26287010Sbapt 27224102Sphilip#undef SWITCH_TAKES_ARG 28224102Sphilip#define SWITCH_TAKES_ARG(CHAR) \ 29224102Sphilip (FBSD_SWITCH_TAKES_ARG (CHAR) \ 30224102Sphilip || (CHAR) == 'R' \ 31224102Sphilip || (CHAR) == 'G') 32224102Sphilip 33224102Sphilip#undef SUBTARGET_EXTRA_SPECS /* mips.h bogusly defines it. */ 34224102Sphilip#define SUBTARGET_EXTRA_SPECS \ 35224102Sphilip { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER}, \ 36224102Sphilip { "fbsd_link_spec", FBSD_LINK_SPEC } 37224102Sphilip 38224102Sphilip/* config/mips/mips.h defines CC1_SPEC, 39224102Sphilip but gives us an "out" with SUBTARGET_CC1_SPEC. */ 40224102Sphilip#undef SUBTARGET_CC1_SPEC 41224102Sphilip#define SUBTARGET_CC1_SPEC "%{profile:-p}" 42224102Sphilip 43224102Sphilip/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support 44224102Sphilip for the special GCC options -static and -shared, which allow us to 45224102Sphilip link things in one of these three modes by applying the appropriate 46224102Sphilip combinations of options at link-time. We like to support here for 47224102Sphilip as many of the other GNU linker options as possible. But I don't 48224102Sphilip have the time to search for those flags. I am sure how to add 49224102Sphilip support for -soname shared_object_name. H.J. 50224102Sphilip 51224102Sphilip When the -shared link option is used a final link is not being 52224102Sphilip done. */ 53224102Sphilip 54224102Sphilip#define FBSD_LINK_SPEC "\ 55242471Sphilip %{p:%nconsider using `-pg' instead of `-p' with gprof(1) } \ 56287010Sbapt %{v:-V} \ 57224102Sphilip %{assert*} %{R*} %{rpath*} %{defsym*} \ 58287010Sbapt %{shared:-Bshareable %{h*} %{soname*}} \ 59224102Sphilip %{!shared: \ 60224102Sphilip %{!static: \ 61224102Sphilip %{rdynamic: -export-dynamic} \ 62224102Sphilip %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ 63224102Sphilip %{static:-Bstatic}} \ 64224102Sphilip %{symbolic:-Bsymbolic} " 65224102Sphilip 66224102Sphilip#undef LINK_SPEC 67224102Sphilip#define LINK_SPEC "\ 68224102Sphilip %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} %{mips64} \ 69224102Sphilip %{bestGnum} %{call_shared} %{no_archive} %{exact_version} \ 70224102Sphilip %(fbsd_link_spec) " 71224102Sphilip#if 0 72224102Sphilip %(endian_spec) 73242471Sphilip#endif 74224102Sphilip 75224102Sphilip/* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h 76224102Sphilip but trashed by config/mips/elf.h. */ 77224102Sphilip#undef STARTFILE_SPEC 78224102Sphilip#define STARTFILE_SPEC FBSD_STARTFILE_SPEC 79224102Sphilip 80224102Sphilip/* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386. */ 81224102Sphilip#undef ENDFILE_SPEC 82224102Sphilip#define ENDFILE_SPEC FBSD_ENDFILE_SPEC 83224102Sphilip 84224102Sphilip/* Reset our LIB_SPEC which was properly set in config/freebsd.h 85224102Sphilip but trashed by config/mips/elf.h. */ 86224102Sphilip#undef LIB_SPEC 87224102Sphilip#define LIB_SPEC FBSD_LIB_SPEC 88224102Sphilip 89224102Sphilip/* config/mips/mips.h defines CPP_SPEC, and it expects SUBTARGET_CPP_SPEC. */ 90224102Sphilip#undef SUBTARGET_CPP_SPEC 91224102Sphilip#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC 92224102Sphilip 93224102Sphilip 94224102Sphilip/************************[ Target stuff ]***********************************/ 95224102Sphilip 96224102Sphilip/* Define the actual types of some ANSI-mandated types. 97224102Sphilip Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c, 98224102Sphilip c-common.c, and config/<arch>/<arch>.h. */ 99224102Sphilip 100224102Sphilip#undef TARGET_DEFAULT 101224102Sphilip#define TARGET_DEFAULT (MASK_ABICALLS | MASK_SOFT_FLOAT) 102224102Sphilip 103224102Sphilip#if TARGET_ENDIAN_DEFAULT != 0 104224102Sphilip#define TARGET_VERSION fprintf (stderr, " (FreeBSD/mips)"); 105224102Sphilip#else 106224102Sphilip#define TARGET_VERSION fprintf (stderr, " (FreeBSD/mipsel)"); 107224102Sphilip#endif 108224102Sphilip 109224102Sphilip/* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for FreeBSD. 110224102Sphilip Specifically, they define too many namespace-invasive macros. Override 111224102Sphilip them here. Note this is structured for easy comparison to the version 112224102Sphilip in mips.h. */ 113224102Sphilip 114224102Sphilip#undef TARGET_CPU_CPP_BUILTINS 115224102Sphilip#define TARGET_CPU_CPP_BUILTINS() \ 116224102Sphilip do \ 117224102Sphilip { \ 118224102Sphilip builtin_assert ("machine=mips"); \ 119224102Sphilip builtin_assert ("cpu=mips"); \ 120224102Sphilip builtin_define ("__mips__"); \ 121224102Sphilip \ 122224102Sphilip if (TARGET_64BIT) \ 123224102Sphilip builtin_define ("__mips64__"); \ 124224102Sphilip \ 125224102Sphilip if (TARGET_FLOAT64) \ 126224102Sphilip builtin_define ("__mips_fpr=64"); \ 127224102Sphilip else \ 128224102Sphilip builtin_define ("__mips_fpr=32"); \ 129224102Sphilip \ 130224102Sphilip if (TARGET_MIPS16) \ 131224102Sphilip builtin_define ("__mips16"); \ 132224102Sphilip \ 133224102Sphilip MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \ 134224102Sphilip MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \ 135224102Sphilip \ 136224102Sphilip if (ISA_MIPS3) \ 137224102Sphilip builtin_define ("__mips=3"); \ 138242471Sphilip else if (ISA_MIPS4) \ 139224102Sphilip builtin_define ("__mips=4"); \ 140224102Sphilip else if (ISA_MIPS32) \ 141224102Sphilip { \ 142224102Sphilip builtin_define ("__mips=32"); \ 143224102Sphilip builtin_define ("__mips_isa_rev=1"); \ 144224102Sphilip } \ 145224102Sphilip else if (ISA_MIPS32R2) \ 146224102Sphilip { \ 147224102Sphilip builtin_define ("__mips=32"); \ 148224102Sphilip builtin_define ("__mips_isa_rev=2"); \ 149224102Sphilip } \ 150224102Sphilip else if (ISA_MIPS64) \ 151224102Sphilip { \ 152224102Sphilip builtin_define ("__mips=64"); \ 153224102Sphilip builtin_define ("__mips_isa_rev=1"); \ 154224102Sphilip } \ 155224102Sphilip \ 156224102Sphilip if (TARGET_HARD_FLOAT) \ 157224102Sphilip builtin_define ("__mips_hard_float"); \ 158224102Sphilip else if (TARGET_SOFT_FLOAT) \ 159224102Sphilip builtin_define ("__mips_soft_float"); \ 160224102Sphilip \ 161224102Sphilip if (TARGET_SINGLE_FLOAT) \ 162224102Sphilip builtin_define ("__mips_single_float"); \ 163224102Sphilip \ 164224102Sphilip if (TARGET_BIG_ENDIAN) \ 165224102Sphilip builtin_define ("__MIPSEB__"); \ 166224102Sphilip else \ 167224102Sphilip builtin_define ("__MIPSEL__"); \ 168224102Sphilip \ 169224102Sphilip /* No language dialect defines. */ \ 170224102Sphilip \ 171224102Sphilip if (mips_abi == ABI_EABI) \ 172224102Sphilip builtin_define ("__mips_eabi"); \ 173224102Sphilip else if (mips_abi == ABI_N32) \ 174224102Sphilip builtin_define ("__mips_n32"); \ 175224102Sphilip else if (mips_abi == ABI_64) \ 176224102Sphilip builtin_define ("__mips_n64"); \ 177224102Sphilip else if (mips_abi == ABI_O64) \ 178224102Sphilip builtin_define ("__mips_o64"); \ 179224102Sphilip else \ 180224102Sphilip builtin_define ("__mips_o32"); \ 181224102Sphilip \ 182224102Sphilip if (TARGET_ABICALLS) \ 183224102Sphilip builtin_define ("__ABICALLS__"); \ 184224102Sphilip } \ 185224102Sphilip while (0) 186224102Sphilip 187224102Sphilip/* Default to the mips32 ISA */ 188224102Sphilip#undef DRIVER_SELF_SPECS 189224102Sphilip#define DRIVER_SELF_SPECS \ 190224102Sphilip "%{!march=*: -march=mips32}" 191224102Sphilip#if 0 192224102Sphilip "%{!EB:%{!EL:%(endian_spec)}}", 193224102Sphilip#endif 194224102Sphilip 195224102Sphilip#if 0 196224102Sphilip/* Don't default to pcc-struct-return, we want to retain compatibility with 197224102Sphilip older gcc versions AND pcc-struct-return is nonreentrant. 198224102Sphilip (even though the SVR4 ABI for the i386 says that records and unions are 199224102Sphilip returned in memory). */ 200224102Sphilip 201224102Sphilip#undef DEFAULT_PCC_STRUCT_RETURN 202224102Sphilip#define DEFAULT_PCC_STRUCT_RETURN 0 203224102Sphilip#endif 204224102Sphilip 205224102Sphilip 206224102Sphilip/************************[ Assembler stuff ]********************************/ 207224102Sphilip 208224102Sphilip#undef SUBTARGET_ASM_SPEC 209224102Sphilip#define SUBTARGET_ASM_SPEC \ 210224102Sphilip "%{!mno-abicalls: %{!fno-PIC:%{!fno-pic:-KPIC}}}" 211224102Sphilip 212224102Sphilip/* -G is incompatible with -KPIC which is the default, so only allow objects 213224102Sphilip in the small data section if the user explicitly asks for it. */ 214224102Sphilip 215224102Sphilip#undef MIPS_DEFAULT_GVALUE 216224102Sphilip#define MIPS_DEFAULT_GVALUE 0 217224102Sphilip 218224102Sphilip/* If defined, a C expression whose value is a string containing the 219224102Sphilip assembler operation to identify the following data as 220224102Sphilip uninitialized global data. If not defined, and neither 221224102Sphilip `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined, 222224102Sphilip uninitialized global data will be output in the data section if 223224102Sphilip `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be 224224102Sphilip used. */ 225224102Sphilip#undef BSS_SECTION_ASM_OP 226224102Sphilip#define BSS_SECTION_ASM_OP "\t.section\t.bss" 227224102Sphilip 228224102Sphilip/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a 229224102Sphilip separate, explicit argument. If you define this macro, it is used 230224102Sphilip in place of `ASM_OUTPUT_BSS', and gives you more flexibility in 231224102Sphilip handling the required alignment of the variable. The alignment is 232224102Sphilip specified as the number of bits. 233224102Sphilip 234224102Sphilip Try to use function `asm_output_aligned_bss' defined in file 235224102Sphilip `varasm.c' when defining this macro. */ 236224102Sphilip#undef ASM_OUTPUT_ALIGNED_BSS 237224102Sphilip#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ 238224102Sphilip asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) 239224102Sphilip 240224102Sphilip/* Standard AT&T UNIX 'as' local label spelling. */ 241224102Sphilip#undef LOCAL_LABEL_PREFIX 242224102Sphilip#define LOCAL_LABEL_PREFIX "." 243224102Sphilip 244224102Sphilip 245224102Sphilip/************************[ Debugger stuff ]*********************************/ 246224102Sphilip 247224102Sphilip