freebsd.h revision 182627
1182627Sobrien/* Definitions for MIPS varients running FreeBSD with ELF format 2182627Sobrien Copyright (C) 2008 Free Software Foundation, Inc. 3182627Sobrien Continued by David O'Brien <obrien@freebsd.org> 4182627Sobrien 5182627SobrienThis file is part of GCC. 6182627Sobrien 7182627SobrienGCC is free software; you can redistribute it and/or modify 8182627Sobrienit under the terms of the GNU General Public License as published by 9182627Sobrienthe Free Software Foundation; either version 2, or (at your option) 10182627Sobrienany later version. 11182627Sobrien 12182627SobrienGCC is distributed in the hope that it will be useful, 13182627Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 14182627SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15182627SobrienGNU General Public License for more details. 16182627Sobrien 17182627SobrienYou should have received a copy of the GNU General Public License 18182627Sobrienalong with GCC; see the file COPYING. If not, write to 19182627Sobrienthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 20182627SobrienBoston, MA 02110-1301, USA. */ 21182627Sobrien 22182627Sobrien/* $FreeBSD$ */ 23182627Sobrien 24182627Sobrien/* This defines which switch letters take arguments. -G is a MIPS 25182627Sobrien special. */ 26182627Sobrien 27182627Sobrien#undef SWITCH_TAKES_ARG 28182627Sobrien#define SWITCH_TAKES_ARG(CHAR) \ 29182627Sobrien (FBSD_SWITCH_TAKES_ARG (CHAR) \ 30182627Sobrien || (CHAR) == 'R' \ 31182627Sobrien || (CHAR) == 'G') 32182627Sobrien 33182627Sobrien#undef SUBTARGET_EXTRA_SPECS /* mips.h bogusly defines it. */ 34182627Sobrien#define SUBTARGET_EXTRA_SPECS \ 35182627Sobrien { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER}, \ 36182627Sobrien { "fbsd_link_spec", FBSD_LINK_SPEC } 37182627Sobrien 38182627Sobrien/* config/mips/mips.h defines CC1_SPEC, 39182627Sobrien but gives us an "out" with SUBTARGET_CC1_SPEC. */ 40182627Sobrien#undef SUBTARGET_CC1_SPEC 41182627Sobrien#define SUBTARGET_CC1_SPEC "%{profile:-p}" 42182627Sobrien 43182627Sobrien/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support 44182627Sobrien for the special GCC options -static and -shared, which allow us to 45182627Sobrien link things in one of these three modes by applying the appropriate 46182627Sobrien combinations of options at link-time. We like to support here for 47182627Sobrien as many of the other GNU linker options as possible. But I don't 48182627Sobrien have the time to search for those flags. I am sure how to add 49182627Sobrien support for -soname shared_object_name. H.J. 50182627Sobrien 51182627Sobrien When the -shared link option is used a final link is not being 52182627Sobrien done. */ 53182627Sobrien 54182627Sobrien#define FBSD_LINK_SPEC "\ 55182627Sobrien %{p:%nconsider using `-pg' instead of `-p' with gprof(1) } \ 56182627Sobrien %{v:-V} \ 57182627Sobrien %{assert*} %{R*} %{rpath*} %{defsym*} \ 58182627Sobrien %{shared:-Bshareable %{h*} %{soname*}} \ 59182627Sobrien %{!shared: \ 60182627Sobrien %{!static: \ 61182627Sobrien %{rdynamic: -export-dynamic} \ 62182627Sobrien %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ 63182627Sobrien %{static:-Bstatic}} \ 64182627Sobrien %{symbolic:-Bsymbolic} " 65182627Sobrien 66182627Sobrien#undef LINK_SPEC 67182627Sobrien#define LINK_SPEC "\ 68182627Sobrien %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} %{mips64} \ 69182627Sobrien %{bestGnum} %{call_shared} %{no_archive} %{exact_version} \ 70182627Sobrien %(fbsd_link_spec) " 71182627Sobrien#if 0 72182627Sobrien %(endian_spec) 73182627Sobrien#endif 74182627Sobrien 75182627Sobrien/* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h 76182627Sobrien but trashed by config/mips/elf.h. */ 77182627Sobrien#undef STARTFILE_SPEC 78182627Sobrien#define STARTFILE_SPEC FBSD_STARTFILE_SPEC 79182627Sobrien 80182627Sobrien/* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386. */ 81182627Sobrien#undef ENDFILE_SPEC 82182627Sobrien#define ENDFILE_SPEC FBSD_ENDFILE_SPEC 83182627Sobrien 84182627Sobrien/* Reset our LIB_SPEC which was properly set in config/freebsd.h 85182627Sobrien but trashed by config/mips/elf.h. */ 86182627Sobrien#undef LIB_SPEC 87182627Sobrien#define LIB_SPEC FBSD_LIB_SPEC 88182627Sobrien 89182627Sobrien/* config/mips/mips.h defines CPP_SPEC, and it expects SUBTARGET_CPP_SPEC. */ 90182627Sobrien#undef SUBTARGET_CPP_SPEC 91182627Sobrien#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC 92182627Sobrien 93182627Sobrien 94182627Sobrien/************************[ Target stuff ]***********************************/ 95182627Sobrien 96182627Sobrien/* Define the actual types of some ANSI-mandated types. 97182627Sobrien Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c, 98182627Sobrien c-common.c, and config/<arch>/<arch>.h. */ 99182627Sobrien 100182627Sobrien#if TARGET_ENDIAN_DEFAULT != 0 101182627Sobrien#define TARGET_VERSION fprintf (stderr, " (FreeBSD/mips)"); 102182627Sobrien#else 103182627Sobrien#define TARGET_VERSION fprintf (stderr, " (FreeBSD/mipsel)"); 104182627Sobrien#endif 105182627Sobrien 106182627Sobrien/* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for FreeBSD. 107182627Sobrien Specifically, they define too many namespace-invasive macros. Override 108182627Sobrien them here. Note this is structured for easy comparison to the version 109182627Sobrien in mips.h. */ 110182627Sobrien 111182627Sobrien#undef TARGET_CPU_CPP_BUILTINS 112182627Sobrien#define TARGET_CPU_CPP_BUILTINS() \ 113182627Sobrien do \ 114182627Sobrien { \ 115182627Sobrien builtin_assert ("machine=mips"); \ 116182627Sobrien builtin_assert ("cpu=mips"); \ 117182627Sobrien builtin_define ("__mips__"); \ 118182627Sobrien \ 119182627Sobrien if (TARGET_64BIT) \ 120182627Sobrien builtin_define ("__mips64__"); \ 121182627Sobrien \ 122182627Sobrien if (TARGET_FLOAT64) \ 123182627Sobrien builtin_define ("__mips_fpr=64"); \ 124182627Sobrien else \ 125182627Sobrien builtin_define ("__mips_fpr=32"); \ 126182627Sobrien \ 127182627Sobrien if (TARGET_MIPS16) \ 128182627Sobrien builtin_define ("__mips16"); \ 129182627Sobrien \ 130182627Sobrien MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \ 131182627Sobrien MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \ 132182627Sobrien \ 133182627Sobrien if (ISA_MIPS3) \ 134182627Sobrien builtin_define ("__mips=3"); \ 135182627Sobrien else if (ISA_MIPS4) \ 136182627Sobrien builtin_define ("__mips=4"); \ 137182627Sobrien else if (ISA_MIPS32) \ 138182627Sobrien { \ 139182627Sobrien builtin_define ("__mips=32"); \ 140182627Sobrien builtin_define ("__mips_isa_rev=1"); \ 141182627Sobrien } \ 142182627Sobrien else if (ISA_MIPS32R2) \ 143182627Sobrien { \ 144182627Sobrien builtin_define ("__mips=32"); \ 145182627Sobrien builtin_define ("__mips_isa_rev=2"); \ 146182627Sobrien } \ 147182627Sobrien else if (ISA_MIPS64) \ 148182627Sobrien { \ 149182627Sobrien builtin_define ("__mips=64"); \ 150182627Sobrien builtin_define ("__mips_isa_rev=1"); \ 151182627Sobrien } \ 152182627Sobrien \ 153182627Sobrien if (TARGET_HARD_FLOAT) \ 154182627Sobrien builtin_define ("__mips_hard_float"); \ 155182627Sobrien else if (TARGET_SOFT_FLOAT) \ 156182627Sobrien builtin_define ("__mips_soft_float"); \ 157182627Sobrien \ 158182627Sobrien if (TARGET_SINGLE_FLOAT) \ 159182627Sobrien builtin_define ("__mips_single_float"); \ 160182627Sobrien \ 161182627Sobrien if (TARGET_BIG_ENDIAN) \ 162182627Sobrien builtin_define ("__MIPSEB__"); \ 163182627Sobrien else \ 164182627Sobrien builtin_define ("__MIPSEL__"); \ 165182627Sobrien \ 166182627Sobrien /* No language dialect defines. */ \ 167182627Sobrien \ 168182627Sobrien if (mips_abi == ABI_EABI) \ 169182627Sobrien builtin_define ("__mips_eabi"); \ 170182627Sobrien else if (mips_abi == ABI_N32) \ 171182627Sobrien builtin_define ("__mips_n32"); \ 172182627Sobrien else if (mips_abi == ABI_64) \ 173182627Sobrien builtin_define ("__mips_n64"); \ 174182627Sobrien else if (mips_abi == ABI_O64) \ 175182627Sobrien builtin_define ("__mips_o64"); \ 176182627Sobrien else \ 177182627Sobrien builtin_define ("__mips_o32"); \ 178182627Sobrien \ 179182627Sobrien if (TARGET_ABICALLS) \ 180182627Sobrien builtin_define ("__ABICALLS__"); \ 181182627Sobrien } \ 182182627Sobrien while (0) 183182627Sobrien 184182627Sobrien/* Default to the mips32 ISA */ 185182627Sobrien#undef DRIVER_SELF_SPECS 186182627Sobrien#define DRIVER_SELF_SPECS \ 187182627Sobrien "%{!EB:%{!EL:%(endian_spec)}}", \ 188182627Sobrien "%{!march=*: -march=mips32}" 189182627Sobrien 190182627Sobrien#if 0 191182627Sobrien/* Don't default to pcc-struct-return, we want to retain compatibility with 192182627Sobrien older gcc versions AND pcc-struct-return is nonreentrant. 193182627Sobrien (even though the SVR4 ABI for the i386 says that records and unions are 194182627Sobrien returned in memory). */ 195182627Sobrien 196182627Sobrien#undef DEFAULT_PCC_STRUCT_RETURN 197182627Sobrien#define DEFAULT_PCC_STRUCT_RETURN 0 198182627Sobrien#endif 199182627Sobrien 200182627Sobrien 201182627Sobrien/************************[ Assembler stuff ]********************************/ 202182627Sobrien 203182627Sobrien#undef SUBTARGET_ASM_SPEC 204182627Sobrien#define SUBTARGET_ASM_SPEC \ 205182627Sobrien "%{!mno-abicalls: %{!fno-PIC:%{!fno-pic:-KPIC}}}" 206182627Sobrien 207182627Sobrien/* -G is incompatible with -KPIC which is the default, so only allow objects 208182627Sobrien in the small data section if the user explicitly asks for it. */ 209182627Sobrien 210182627Sobrien#undef MIPS_DEFAULT_GVALUE 211182627Sobrien#define MIPS_DEFAULT_GVALUE 0 212182627Sobrien 213182627Sobrien/* If defined, a C expression whose value is a string containing the 214182627Sobrien assembler operation to identify the following data as 215182627Sobrien uninitialized global data. If not defined, and neither 216182627Sobrien `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined, 217182627Sobrien uninitialized global data will be output in the data section if 218182627Sobrien `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be 219182627Sobrien used. */ 220182627Sobrien#undef BSS_SECTION_ASM_OP 221182627Sobrien#define BSS_SECTION_ASM_OP "\t.section\t.bss" 222182627Sobrien 223182627Sobrien/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a 224182627Sobrien separate, explicit argument. If you define this macro, it is used 225182627Sobrien in place of `ASM_OUTPUT_BSS', and gives you more flexibility in 226182627Sobrien handling the required alignment of the variable. The alignment is 227182627Sobrien specified as the number of bits. 228182627Sobrien 229182627Sobrien Try to use function `asm_output_aligned_bss' defined in file 230182627Sobrien `varasm.c' when defining this macro. */ 231182627Sobrien#undef ASM_OUTPUT_ALIGNED_BSS 232182627Sobrien#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ 233182627Sobrien asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) 234182627Sobrien 235182627Sobrien/* Standard AT&T UNIX 'as' local label spelling. */ 236182627Sobrien#undef LOCAL_LABEL_PREFIX 237182627Sobrien#define LOCAL_LABEL_PREFIX "." 238182627Sobrien 239182627Sobrien 240182627Sobrien/************************[ Debugger stuff ]*********************************/ 241182627Sobrien 242