| 1 |
282 |
jeremybenn |
/* Definitions of target machine for GNU compiler, for MIPS NetBSD systems.
|
| 2 |
|
|
Copyright (C) 1993, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
|
| 3 |
|
|
2007 Free Software Foundation, Inc.
|
| 4 |
|
|
|
| 5 |
|
|
This file is part of GCC.
|
| 6 |
|
|
|
| 7 |
|
|
GCC is free software; you can redistribute it and/or modify
|
| 8 |
|
|
it under the terms of the GNU General Public License as published by
|
| 9 |
|
|
the Free Software Foundation; either version 3, or (at your option)
|
| 10 |
|
|
any later version.
|
| 11 |
|
|
|
| 12 |
|
|
GCC is distributed in the hope that it will be useful,
|
| 13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 |
|
|
GNU General Public License for more details.
|
| 16 |
|
|
|
| 17 |
|
|
You should have received a copy of the GNU General Public License
|
| 18 |
|
|
along with GCC; see the file COPYING3. If not see
|
| 19 |
|
|
<http://www.gnu.org/licenses/>. */
|
| 20 |
|
|
|
| 21 |
|
|
|
| 22 |
|
|
/* Define default target values. */
|
| 23 |
|
|
|
| 24 |
|
|
#undef MACHINE_TYPE
|
| 25 |
|
|
#if TARGET_ENDIAN_DEFAULT != 0
|
| 26 |
|
|
#define MACHINE_TYPE "NetBSD/mipseb ELF"
|
| 27 |
|
|
#else
|
| 28 |
|
|
#define MACHINE_TYPE "NetBSD/mipsel ELF"
|
| 29 |
|
|
#endif
|
| 30 |
|
|
|
| 31 |
|
|
#define TARGET_OS_CPP_BUILTINS() \
|
| 32 |
|
|
do \
|
| 33 |
|
|
{ \
|
| 34 |
|
|
NETBSD_OS_CPP_BUILTINS_ELF(); \
|
| 35 |
|
|
builtin_define ("__NO_LEADING_UNDERSCORES__"); \
|
| 36 |
|
|
builtin_define ("__GP_SUPPORT__"); \
|
| 37 |
|
|
if (TARGET_LONG64) \
|
| 38 |
|
|
builtin_define ("__LONG64"); \
|
| 39 |
|
|
\
|
| 40 |
|
|
if (TARGET_ABICALLS) \
|
| 41 |
|
|
builtin_define ("__ABICALLS__"); \
|
| 42 |
|
|
\
|
| 43 |
|
|
if (mips_abi == ABI_EABI) \
|
| 44 |
|
|
builtin_define ("__mips_eabi"); \
|
| 45 |
|
|
else if (mips_abi == ABI_N32) \
|
| 46 |
|
|
builtin_define ("__mips_n32"); \
|
| 47 |
|
|
else if (mips_abi == ABI_64) \
|
| 48 |
|
|
builtin_define ("__mips_n64"); \
|
| 49 |
|
|
else if (mips_abi == ABI_O64) \
|
| 50 |
|
|
builtin_define ("__mips_o64"); \
|
| 51 |
|
|
} \
|
| 52 |
|
|
while (0)
|
| 53 |
|
|
|
| 54 |
|
|
/* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for NetBSD.
|
| 55 |
|
|
Specifically, they define too many namespace-invasive macros. Override
|
| 56 |
|
|
them here. Note this is structured for easy comparison to the version
|
| 57 |
|
|
in mips.h.
|
| 58 |
|
|
|
| 59 |
|
|
FIXME: This probably isn't the best solution. But in the absence
|
| 60 |
|
|
of something better, it will have to do, for now. */
|
| 61 |
|
|
|
| 62 |
|
|
#undef TARGET_CPU_CPP_BUILTINS
|
| 63 |
|
|
#define TARGET_CPU_CPP_BUILTINS() \
|
| 64 |
|
|
do \
|
| 65 |
|
|
{ \
|
| 66 |
|
|
builtin_assert ("cpu=mips"); \
|
| 67 |
|
|
builtin_define ("__mips__"); \
|
| 68 |
|
|
builtin_define ("_mips"); \
|
| 69 |
|
|
\
|
| 70 |
|
|
/* No _R3000 or _R4000. */ \
|
| 71 |
|
|
if (TARGET_64BIT) \
|
| 72 |
|
|
builtin_define ("__mips64"); \
|
| 73 |
|
|
\
|
| 74 |
|
|
if (TARGET_FLOAT64) \
|
| 75 |
|
|
builtin_define ("__mips_fpr=64"); \
|
| 76 |
|
|
else \
|
| 77 |
|
|
builtin_define ("__mips_fpr=32"); \
|
| 78 |
|
|
\
|
| 79 |
|
|
if (TARGET_MIPS16) \
|
| 80 |
|
|
builtin_define ("__mips16"); \
|
| 81 |
|
|
\
|
| 82 |
|
|
MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \
|
| 83 |
|
|
MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \
|
| 84 |
|
|
\
|
| 85 |
|
|
if (ISA_MIPS1) \
|
| 86 |
|
|
builtin_define ("__mips=1"); \
|
| 87 |
|
|
else if (ISA_MIPS2) \
|
| 88 |
|
|
builtin_define ("__mips=2"); \
|
| 89 |
|
|
else if (ISA_MIPS3) \
|
| 90 |
|
|
builtin_define ("__mips=3"); \
|
| 91 |
|
|
else if (ISA_MIPS4) \
|
| 92 |
|
|
builtin_define ("__mips=4"); \
|
| 93 |
|
|
else if (ISA_MIPS32) \
|
| 94 |
|
|
{ \
|
| 95 |
|
|
builtin_define ("__mips=32"); \
|
| 96 |
|
|
builtin_define ("__mips_isa_rev=1"); \
|
| 97 |
|
|
} \
|
| 98 |
|
|
else if (ISA_MIPS32R2) \
|
| 99 |
|
|
{ \
|
| 100 |
|
|
builtin_define ("__mips=32"); \
|
| 101 |
|
|
builtin_define ("__mips_isa_rev=2"); \
|
| 102 |
|
|
} \
|
| 103 |
|
|
else if (ISA_MIPS64) \
|
| 104 |
|
|
{ \
|
| 105 |
|
|
builtin_define ("__mips=64"); \
|
| 106 |
|
|
builtin_define ("__mips_isa_rev=1"); \
|
| 107 |
|
|
} \
|
| 108 |
|
|
\
|
| 109 |
|
|
if (TARGET_HARD_FLOAT) \
|
| 110 |
|
|
builtin_define ("__mips_hard_float"); \
|
| 111 |
|
|
else if (TARGET_SOFT_FLOAT) \
|
| 112 |
|
|
builtin_define ("__mips_soft_float"); \
|
| 113 |
|
|
\
|
| 114 |
|
|
if (TARGET_SINGLE_FLOAT) \
|
| 115 |
|
|
builtin_define ("__mips_single_float"); \
|
| 116 |
|
|
\
|
| 117 |
|
|
if (TARGET_BIG_ENDIAN) \
|
| 118 |
|
|
builtin_define ("__MIPSEB__"); \
|
| 119 |
|
|
else \
|
| 120 |
|
|
builtin_define ("__MIPSEL__"); \
|
| 121 |
|
|
\
|
| 122 |
|
|
/* No language dialect defines. */ \
|
| 123 |
|
|
\
|
| 124 |
|
|
/* ABIs handled in TARGET_OS_CPP_BUILTINS. */ \
|
| 125 |
|
|
} \
|
| 126 |
|
|
while (0)
|
| 127 |
|
|
|
| 128 |
|
|
|
| 129 |
|
|
/* Clean up after the generic MIPS/ELF configuration. */
|
| 130 |
|
|
#undef MD_EXEC_PREFIX
|
| 131 |
|
|
#undef MD_STARTFILE_PREFIX
|
| 132 |
|
|
|
| 133 |
|
|
/* Extra specs we need. */
|
| 134 |
|
|
#undef SUBTARGET_EXTRA_SPECS
|
| 135 |
|
|
#define SUBTARGET_EXTRA_SPECS \
|
| 136 |
|
|
{ "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \
|
| 137 |
|
|
{ "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
|
| 138 |
|
|
{ "netbsd_entry_point", NETBSD_ENTRY_POINT },
|
| 139 |
|
|
|
| 140 |
|
|
/* Provide a SUBTARGET_CPP_SPEC appropriate for NetBSD. */
|
| 141 |
|
|
|
| 142 |
|
|
#undef SUBTARGET_CPP_SPEC
|
| 143 |
|
|
#define SUBTARGET_CPP_SPEC "%(netbsd_cpp_spec)"
|
| 144 |
|
|
|
| 145 |
|
|
/* Provide a LINK_SPEC appropriate for a NetBSD/mips target.
|
| 146 |
|
|
This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for
|
| 147 |
|
|
the MIPS target. */
|
| 148 |
|
|
|
| 149 |
|
|
#undef LINK_SPEC
|
| 150 |
|
|
#define LINK_SPEC \
|
| 151 |
|
|
"%{EL:-m elf32lmip} \
|
| 152 |
|
|
%{EB:-m elf32bmip} \
|
| 153 |
|
|
%(endian_spec) \
|
| 154 |
|
|
%{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} %{mips64} \
|
| 155 |
|
|
%{bestGnum} %{call_shared} %{no_archive} %{exact_version} \
|
| 156 |
|
|
%(netbsd_link_spec)"
|
| 157 |
|
|
|
| 158 |
|
|
#define NETBSD_ENTRY_POINT "__start"
|
| 159 |
|
|
|
| 160 |
|
|
#undef SUBTARGET_ASM_SPEC
|
| 161 |
|
|
#define SUBTARGET_ASM_SPEC \
|
| 162 |
|
|
"%{!mno-abicalls: \
|
| 163 |
|
|
%{!fno-PIC:%{!fno-pic:-KPIC}}}"
|
| 164 |
|
|
|
| 165 |
|
|
|
| 166 |
|
|
/* -G is incompatible with -KPIC which is the default, so only allow objects
|
| 167 |
|
|
in the small data section if the user explicitly asks for it. */
|
| 168 |
|
|
|
| 169 |
|
|
#undef MIPS_DEFAULT_GVALUE
|
| 170 |
|
|
#define MIPS_DEFAULT_GVALUE 0
|
| 171 |
|
|
|
| 172 |
|
|
|
| 173 |
|
|
/* This defines which switch letters take arguments. -G is a MIPS
|
| 174 |
|
|
special. */
|
| 175 |
|
|
|
| 176 |
|
|
#undef SWITCH_TAKES_ARG
|
| 177 |
|
|
#define SWITCH_TAKES_ARG(CHAR) \
|
| 178 |
|
|
(DEFAULT_SWITCH_TAKES_ARG (CHAR) \
|
| 179 |
|
|
|| (CHAR) == 'R' \
|
| 180 |
|
|
|| (CHAR) == 'G')
|
| 181 |
|
|
|
| 182 |
|
|
|
| 183 |
|
|
#undef ASM_FINAL_SPEC
|
| 184 |
|
|
#undef SET_ASM_OP
|
| 185 |
|
|
|
| 186 |
|
|
|
| 187 |
|
|
/* NetBSD hasn't historically provided _flush_cache(), but rather
|
| 188 |
|
|
_cacheflush(), which takes the same arguments as the former. */
|
| 189 |
|
|
#undef CACHE_FLUSH_FUNC
|
| 190 |
|
|
#define CACHE_FLUSH_FUNC "_cacheflush"
|
| 191 |
|
|
|
| 192 |
|
|
|
| 193 |
|
|
/* Make gcc agree with <machine/ansi.h> */
|
| 194 |
|
|
|
| 195 |
|
|
#undef WCHAR_TYPE
|
| 196 |
|
|
#define WCHAR_TYPE "int"
|
| 197 |
|
|
|
| 198 |
|
|
#undef WCHAR_TYPE_SIZE
|
| 199 |
|
|
#define WCHAR_TYPE_SIZE 32
|
| 200 |
|
|
|
| 201 |
|
|
#undef WINT_TYPE
|
| 202 |
|
|
#define WINT_TYPE "int"
|