1169689Skan/* Definitions of target machine for GNU compiler, for MIPS NetBSD systems. 2169689Skan Copyright (C) 1993, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004 3169689Skan Free Software Foundation, Inc. 4169689Skan 5169689SkanThis file is part of GCC. 6169689Skan 7169689SkanGCC is free software; you can redistribute it and/or modify 8169689Skanit under the terms of the GNU General Public License as published by 9169689Skanthe Free Software Foundation; either version 2, or (at your option) 10169689Skanany later version. 11169689Skan 12169689SkanGCC is distributed in the hope that it will be useful, 13169689Skanbut WITHOUT ANY WARRANTY; without even the implied warranty of 14169689SkanMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15169689SkanGNU General Public License for more details. 16169689Skan 17169689SkanYou should have received a copy of the GNU General Public License 18169689Skanalong with GCC; see the file COPYING. If not, write to 19169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 20169689SkanBoston, MA 02110-1301, USA. */ 21169689Skan 22169689Skan 23169689Skan/* Define default target values. */ 24169689Skan 25169689Skan#undef MACHINE_TYPE 26169689Skan#if TARGET_ENDIAN_DEFAULT != 0 27169689Skan#define MACHINE_TYPE "NetBSD/mipseb ELF" 28169689Skan#else 29169689Skan#define MACHINE_TYPE "NetBSD/mipsel ELF" 30169689Skan#endif 31169689Skan 32169689Skan#define TARGET_OS_CPP_BUILTINS() \ 33169689Skan do \ 34169689Skan { \ 35169689Skan NETBSD_OS_CPP_BUILTINS_ELF(); \ 36169689Skan builtin_define ("__NO_LEADING_UNDERSCORES__"); \ 37169689Skan builtin_define ("__GP_SUPPORT__"); \ 38169689Skan if (TARGET_LONG64) \ 39169689Skan builtin_define ("__LONG64"); \ 40169689Skan \ 41169689Skan if (TARGET_ABICALLS) \ 42169689Skan builtin_define ("__ABICALLS__"); \ 43169689Skan \ 44169689Skan if (mips_abi == ABI_EABI) \ 45169689Skan builtin_define ("__mips_eabi"); \ 46169689Skan else if (mips_abi == ABI_N32) \ 47169689Skan builtin_define ("__mips_n32"); \ 48169689Skan else if (mips_abi == ABI_64) \ 49169689Skan builtin_define ("__mips_n64"); \ 50169689Skan else if (mips_abi == ABI_O64) \ 51169689Skan builtin_define ("__mips_o64"); \ 52169689Skan } \ 53169689Skan while (0) 54169689Skan 55169689Skan/* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for NetBSD. 56169689Skan Specifically, they define too many namespace-invasive macros. Override 57169689Skan them here. Note this is structured for easy comparison to the version 58169689Skan in mips.h. 59169689Skan 60169689Skan FIXME: This probably isn't the best solution. But in the absence 61169689Skan of something better, it will have to do, for now. */ 62169689Skan 63169689Skan#undef TARGET_CPU_CPP_BUILTINS 64169689Skan#define TARGET_CPU_CPP_BUILTINS() \ 65169689Skan do \ 66169689Skan { \ 67169689Skan builtin_assert ("cpu=mips"); \ 68169689Skan builtin_define ("__mips__"); \ 69169689Skan builtin_define ("_mips"); \ 70169689Skan \ 71169689Skan /* No _R3000 or _R4000. */ \ 72169689Skan if (TARGET_64BIT) \ 73169689Skan builtin_define ("__mips64"); \ 74169689Skan \ 75169689Skan if (TARGET_FLOAT64) \ 76169689Skan builtin_define ("__mips_fpr=64"); \ 77169689Skan else \ 78169689Skan builtin_define ("__mips_fpr=32"); \ 79169689Skan \ 80169689Skan if (TARGET_MIPS16) \ 81169689Skan builtin_define ("__mips16"); \ 82169689Skan \ 83169689Skan MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \ 84169689Skan MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \ 85169689Skan \ 86169689Skan if (ISA_MIPS1) \ 87169689Skan builtin_define ("__mips=1"); \ 88169689Skan else if (ISA_MIPS2) \ 89169689Skan builtin_define ("__mips=2"); \ 90169689Skan else if (ISA_MIPS3) \ 91169689Skan builtin_define ("__mips=3"); \ 92169689Skan else if (ISA_MIPS4) \ 93169689Skan builtin_define ("__mips=4"); \ 94169689Skan else if (ISA_MIPS32) \ 95169689Skan { \ 96169689Skan builtin_define ("__mips=32"); \ 97169689Skan builtin_define ("__mips_isa_rev=1"); \ 98169689Skan } \ 99169689Skan else if (ISA_MIPS32R2) \ 100169689Skan { \ 101169689Skan builtin_define ("__mips=32"); \ 102169689Skan builtin_define ("__mips_isa_rev=2"); \ 103169689Skan } \ 104169689Skan else if (ISA_MIPS64) \ 105169689Skan { \ 106169689Skan builtin_define ("__mips=64"); \ 107169689Skan builtin_define ("__mips_isa_rev=1"); \ 108169689Skan } \ 109169689Skan \ 110169689Skan if (TARGET_HARD_FLOAT) \ 111169689Skan builtin_define ("__mips_hard_float"); \ 112169689Skan else if (TARGET_SOFT_FLOAT) \ 113169689Skan builtin_define ("__mips_soft_float"); \ 114169689Skan \ 115169689Skan if (TARGET_SINGLE_FLOAT) \ 116169689Skan builtin_define ("__mips_single_float"); \ 117169689Skan \ 118169689Skan if (TARGET_BIG_ENDIAN) \ 119169689Skan builtin_define ("__MIPSEB__"); \ 120169689Skan else \ 121169689Skan builtin_define ("__MIPSEL__"); \ 122169689Skan \ 123169689Skan /* No language dialect defines. */ \ 124169689Skan \ 125169689Skan /* ABIs handled in TARGET_OS_CPP_BUILTINS. */ \ 126169689Skan } \ 127169689Skan while (0) 128169689Skan 129169689Skan 130169689Skan/* Clean up after the generic MIPS/ELF configuration. */ 131169689Skan#undef MD_EXEC_PREFIX 132169689Skan#undef MD_STARTFILE_PREFIX 133169689Skan 134169689Skan/* Extra specs we need. */ 135169689Skan#undef SUBTARGET_EXTRA_SPECS 136169689Skan#define SUBTARGET_EXTRA_SPECS \ 137169689Skan { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \ 138169689Skan { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \ 139169689Skan { "netbsd_entry_point", NETBSD_ENTRY_POINT }, 140169689Skan 141169689Skan/* Provide a SUBTARGET_CPP_SPEC appropriate for NetBSD. */ 142169689Skan 143169689Skan#undef SUBTARGET_CPP_SPEC 144169689Skan#define SUBTARGET_CPP_SPEC "%(netbsd_cpp_spec)" 145169689Skan 146169689Skan/* Provide a LINK_SPEC appropriate for a NetBSD/mips target. 147169689Skan This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for 148169689Skan the MIPS target. */ 149169689Skan 150169689Skan#undef LINK_SPEC 151169689Skan#define LINK_SPEC \ 152169689Skan "%{EL:-m elf32lmip} \ 153169689Skan %{EB:-m elf32bmip} \ 154169689Skan %(endian_spec) \ 155169689Skan %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} %{mips64} \ 156169689Skan %{bestGnum} %{call_shared} %{no_archive} %{exact_version} \ 157169689Skan %(netbsd_link_spec)" 158169689Skan 159169689Skan#define NETBSD_ENTRY_POINT "__start" 160169689Skan 161169689Skan#undef SUBTARGET_ASM_SPEC 162169689Skan#define SUBTARGET_ASM_SPEC \ 163169689Skan "%{!mno-abicalls: \ 164169689Skan %{!fno-PIC:%{!fno-pic:-KPIC}}}" 165169689Skan 166169689Skan 167169689Skan/* -G is incompatible with -KPIC which is the default, so only allow objects 168169689Skan in the small data section if the user explicitly asks for it. */ 169169689Skan 170169689Skan#undef MIPS_DEFAULT_GVALUE 171169689Skan#define MIPS_DEFAULT_GVALUE 0 172169689Skan 173169689Skan 174169689Skan/* This defines which switch letters take arguments. -G is a MIPS 175169689Skan special. */ 176169689Skan 177169689Skan#undef SWITCH_TAKES_ARG 178169689Skan#define SWITCH_TAKES_ARG(CHAR) \ 179169689Skan (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ 180169689Skan || (CHAR) == 'R' \ 181169689Skan || (CHAR) == 'G') 182169689Skan 183169689Skan 184169689Skan#undef ASM_FINAL_SPEC 185169689Skan#undef SET_ASM_OP 186169689Skan 187169689Skan 188169689Skan/* NetBSD hasn't historically provided _flush_cache(), but rather 189169689Skan _cacheflush(), which takes the same arguments as the former. */ 190169689Skan#undef CACHE_FLUSH_FUNC 191169689Skan#define CACHE_FLUSH_FUNC "_cacheflush" 192169689Skan 193169689Skan 194169689Skan/* Make gcc agree with <machine/ansi.h> */ 195169689Skan 196169689Skan#undef WCHAR_TYPE 197169689Skan#define WCHAR_TYPE "int" 198169689Skan 199169689Skan#undef WCHAR_TYPE_SIZE 200169689Skan#define WCHAR_TYPE_SIZE 32 201169689Skan 202169689Skan#undef WINT_TYPE 203169689Skan#define WINT_TYPE "int" 204