2012-08-04 Sandra Loosemore <sandra@codesourcery.com>
[official-gcc.git] / gcc / config / mips / netbsd.h
blob4a9bd152fce3f95c8f36cbda0d2fc11fdc7b652c
1 /* 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, 2010, 2011 Free Software Foundation, Inc.
5 This file is part of GCC.
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.
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.
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/>. */
22 /* Define default target values. */
24 #define TARGET_OS_CPP_BUILTINS() \
25 do \
26 { \
27 NETBSD_OS_CPP_BUILTINS_ELF(); \
28 builtin_define ("__NO_LEADING_UNDERSCORES__"); \
29 builtin_define ("__GP_SUPPORT__"); \
30 if (TARGET_LONG64) \
31 builtin_define ("__LONG64"); \
33 if (TARGET_ABICALLS) \
34 builtin_define ("__ABICALLS__"); \
36 if (mips_abi == ABI_EABI) \
37 builtin_define ("__mips_eabi"); \
38 else if (mips_abi == ABI_N32) \
39 builtin_define ("__mips_n32"); \
40 else if (mips_abi == ABI_64) \
41 builtin_define ("__mips_n64"); \
42 else if (mips_abi == ABI_O64) \
43 builtin_define ("__mips_o64"); \
44 } \
45 while (0)
47 /* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for NetBSD.
48 Specifically, they define too many namespace-invasive macros. Override
49 them here. Note this is structured for easy comparison to the version
50 in mips.h.
52 FIXME: This probably isn't the best solution. But in the absence
53 of something better, it will have to do, for now. */
55 #undef TARGET_CPU_CPP_BUILTINS
56 #define TARGET_CPU_CPP_BUILTINS() \
57 do \
58 { \
59 builtin_assert ("cpu=mips"); \
60 builtin_define ("__mips__"); \
61 builtin_define ("_mips"); \
63 /* No _R3000 or _R4000. */ \
64 if (TARGET_64BIT) \
65 builtin_define ("__mips64"); \
67 if (TARGET_FLOAT64) \
68 builtin_define ("__mips_fpr=64"); \
69 else \
70 builtin_define ("__mips_fpr=32"); \
72 if (TARGET_MIPS16) \
73 builtin_define ("__mips16"); \
75 MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \
76 MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \
78 if (ISA_MIPS1) \
79 builtin_define ("__mips=1"); \
80 else if (ISA_MIPS2) \
81 builtin_define ("__mips=2"); \
82 else if (ISA_MIPS3) \
83 builtin_define ("__mips=3"); \
84 else if (ISA_MIPS4) \
85 builtin_define ("__mips=4"); \
86 else if (ISA_MIPS32) \
87 { \
88 builtin_define ("__mips=32"); \
89 builtin_define ("__mips_isa_rev=1"); \
90 } \
91 else if (ISA_MIPS32R2) \
92 { \
93 builtin_define ("__mips=32"); \
94 builtin_define ("__mips_isa_rev=2"); \
95 } \
96 else if (ISA_MIPS64) \
97 { \
98 builtin_define ("__mips=64"); \
99 builtin_define ("__mips_isa_rev=1"); \
102 if (TARGET_HARD_FLOAT) \
103 builtin_define ("__mips_hard_float"); \
104 else if (TARGET_SOFT_FLOAT) \
105 builtin_define ("__mips_soft_float"); \
107 if (TARGET_SINGLE_FLOAT) \
108 builtin_define ("__mips_single_float"); \
110 if (TARGET_BIG_ENDIAN) \
111 builtin_define ("__MIPSEB__"); \
112 else \
113 builtin_define ("__MIPSEL__"); \
115 /* No language dialect defines. */ \
117 /* ABIs handled in TARGET_OS_CPP_BUILTINS. */ \
119 while (0)
122 /* Extra specs we need. */
123 #undef SUBTARGET_EXTRA_SPECS
124 #define SUBTARGET_EXTRA_SPECS \
125 { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \
126 { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
127 { "netbsd_entry_point", NETBSD_ENTRY_POINT },
129 /* Provide a SUBTARGET_CPP_SPEC appropriate for NetBSD. */
131 #undef SUBTARGET_CPP_SPEC
132 #define SUBTARGET_CPP_SPEC "%(netbsd_cpp_spec)"
134 /* Provide a LINK_SPEC appropriate for a NetBSD/mips target.
135 This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for
136 the MIPS target. */
138 #undef LINK_SPEC
139 #define LINK_SPEC \
140 "%{EL:-m elf32lmip} \
141 %{EB:-m elf32bmip} \
142 %(endian_spec) \
143 %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} %{mips64} \
144 %(netbsd_link_spec)"
146 #define NETBSD_ENTRY_POINT "__start"
148 #undef SUBTARGET_ASM_SPEC
149 #define SUBTARGET_ASM_SPEC \
150 "%{!mno-abicalls: \
151 %{!fno-PIC:%{!fno-pic:-KPIC}}}"
154 /* -G is incompatible with -KPIC which is the default, so only allow objects
155 in the small data section if the user explicitly asks for it. */
157 #undef MIPS_DEFAULT_GVALUE
158 #define MIPS_DEFAULT_GVALUE 0
161 #undef ASM_FINAL_SPEC
162 #undef SET_ASM_OP
165 /* NetBSD hasn't historically provided _flush_cache(), but rather
166 _cacheflush(), which takes the same arguments as the former. */
167 #undef CACHE_FLUSH_FUNC
168 #define CACHE_FLUSH_FUNC "_cacheflush"
171 /* Make gcc agree with <machine/ansi.h> */
173 #undef WCHAR_TYPE
174 #define WCHAR_TYPE "int"
176 #undef WCHAR_TYPE_SIZE
177 #define WCHAR_TYPE_SIZE 32
179 #undef WINT_TYPE
180 #define WINT_TYPE "int"