OSDN Git Service

2002-04-12 Eric Norum <eric.norum@usask.ca>
[pf3gnuchains/gcc-fork.git] / gcc / config / mips / netbsd.h
1 /* Definitions of target machine for GNU compiler, for MIPS NetBSD systems.
2    Copyright (C) 1993, 1995, 1996, 1997, 1999, 2000, 2001, 2002
3    Free Software Foundation, Inc.
4
5 This file is part of GNU CC.
6
7 GNU CC 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 2, or (at your option)
10 any later version.
11
12 GNU CC 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 GNU CC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22
23 /* Define default target values. */
24
25 #ifndef TARGET_ENDIAN_DEFAULT
26 #define TARGET_ENDIAN_DEFAULT MASK_BIG_ENDIAN
27 #endif
28
29 #ifndef MACHINE_TYPE
30 #if TARGET_ENDIAN_DEFAULT != 0
31 #define MACHINE_TYPE "NetBSD/mipseb ELF"
32 #else
33 #define MACHINE_TYPE "NetBSD/mipsel ELF"
34 #endif
35 #endif
36
37 #define TARGET_DEFAULT (MASK_GAS|MASK_ABICALLS)
38
39
40 /* XXX Don't use DWARF-2 debugging info, for now.  */
41 #undef DBX_DEBUGGING_INFO
42 #define DBX_DEBUGGING_INFO
43 #undef PREFERRED_DEBUGGING_TYPE
44 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
45
46
47 /* Include the generic MIPS ELF configuration.  */
48 #include <mips/elf.h>
49
50 /* Now clean up after it.  */
51 #undef OBJECT_FORMAT_COFF
52 #undef MD_EXEC_PREFIX
53 #undef MD_STARTFILE_PREFIX
54 #undef US_SOFTWARE_GOFAST
55 #undef INIT_SUBTARGET_OPTABS
56 #define INIT_SUBTARGET_OPTABS
57
58
59 /* Get generic NetBSD definitions.  */
60 #include <netbsd.h>
61
62
63 /* Get generic NetBSD ELF definitions.  */
64 #include <netbsd-elf.h>
65
66
67 /* Provide CPP predefines appropriate for NetBSD.  We default to
68    MIPS-I.  */
69
70 #undef CPP_PREDEFINES
71 #if TARGET_ENDIAN_DEFAULT != 0 
72 #define CPP_PREDEFINES                                                  \
73   "-D__NetBSD__ -D__ELF__ -D__mips__ -D__mips=1 -D__MIPSEB__            \
74    -D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__                        \
75    -Asystem=unix -Asystem=NetBSD -Amachine=mips"
76 #else
77 #define CPP_PREDEFINES                                                  \
78   "-D__NetBSD__ -D__ELF__ -D__mips__ -D__mips=1 -D__MIPSEL__            \
79    -D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__                        \
80    -Asystem=unix -Asystem=NetBSD -Amachine=mips"
81 #endif
82
83
84 /* Provide a CPP_SPEC appropriate for NetBSD.  This is a simplified
85    CPP_SPEC from <mips/mips.h>.  We use the SUBTARGET_CPP_SPEC to
86    deal with NetBSD-specific CPP options.  */
87
88 #undef CPP_SPEC
89 #define CPP_SPEC                                                        \
90   "%(subtarget_cpp_size_spec)                                           \
91    %{mips3:-U__mips -D__mips=3 -D__mips64}                              \
92    %{mips4:-U__mips -D__mips=4 -D__mips64}                              \
93    %{mips32:-U__mips -D__mips=32}                                       \
94    %{mips64:-U__mips -D__mips=64 -D__mips64}                            \
95    %{mgp32:-U__mips64} %{mgp64:-D__mips64}                              \
96    %{mfp32:-D__mips_fpr=32} %{mfp64:-D__mips_fpr=64}                    \
97    %{!mfp32:                                                            \
98      %{!mfp64:                                                          \
99        %{mgp32:-D__mips_fpr=32}                                         \
100        %{!mgp32: %(cpp_fpr_spec)}}}                                     \
101    %{msingle-float:                                                     \
102      %{!msoft-float:-D__mips_single_float}}                             \
103    %{m4650:                                                             \
104      %{!msoft-float:-D__mips_single_float}}                             \
105    %{msoft-float:-D__mips_soft_float}                                   \
106    %{mabi=eabi:-D__mips_eabi}                                           \
107    %{mips16:%{!mno-mips16:-D__mips16}}                                  \
108    %{EB:-U__MIPSEL__ -D__MIPSEB__}                                      \
109    %{EL:-U__MIPSEB__ -D__MIPSEL__}                                      \
110    %(subtarget_cpp_spec) "
111
112
113 /* Provide a SUBTARGET_CPP_SIZE_SPEC appropriate for NetBSD.  In
114    addition to the normal work done by this spec, we also define
115    __LONG64 or not (so that <machine/ansi.h> can tell).  */
116
117 #undef SUBTARGET_CPP_SIZE_SPEC
118 #define SUBTARGET_CPP_SIZE_SPEC                                         \
119   "%{mlong64:                                                           \
120      %{!mips1:                                                          \
121        %{!mips2:                                                        \
122          %{!mips32:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int -D__LONG64}}}} \
123    %{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int -U__LONG64}"
124
125
126 /* Provide a SUBTARGET_CPP_SPEC appropriate for NetBSD.  Currently,
127    we just deal with the GCC option '-posix'.  */
128
129 #undef SUBTARGET_CPP_SPEC
130 #define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
131
132
133 /* Provide a LINK_SPEC appropriate for a NetBSD/mips target.
134    This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for
135    the MIPS target.  */
136
137 #undef LINK_SPEC
138 #define LINK_SPEC                                                       \
139   "%{assert*} %{R*} %{rpath*}                                           \
140    %{EL:-m elf32lmip}                                                   \
141    %{EB:-m elf32bmip}                                                   \
142    %(endian_spec)                                                       \
143    %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips64}        \
144    %{bestGnum} %{call_shared} %{no_archive} %{exact_version}            \
145    %{shared:-shared}                                                    \
146    %{!shared:                                                           \
147      -dc -dp                                                            \
148      %{!nostdlib:                                                       \
149        %{!r*:                                                           \
150          %{!e*:-e __start}}}                                            \
151      %{!static:                                                         \
152        %{rdynamic:-export-dynamic}                                      \
153        %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}       \
154      %{static:-static}}"
155
156
157 #undef SUBTARGET_ASM_SPEC
158 #define SUBTARGET_ASM_SPEC                                              \
159   "%{fpic:-KPIC} %{fPIC:-KPIC}"
160
161
162 /* -G is incompatible with -KPIC which is the default, so only allow objects
163    in the small data section if the user explicitly asks for it.  */
164
165 #undef MIPS_DEFAULT_GVALUE 
166 #define MIPS_DEFAULT_GVALUE 0 
167
168
169 /* This defines which switch letters take arguments.  -G is a MIPS
170    special.  */
171
172 #undef SWITCH_TAKES_ARG
173 #define SWITCH_TAKES_ARG(CHAR)                                          \
174   (DEFAULT_SWITCH_TAKES_ARG (CHAR)                                      \
175    || (CHAR) == 'R'                                                     \
176    || (CHAR) == 'G')
177
178
179 #undef ASM_FINAL_SPEC
180 #undef SET_ASM_OP
181
182
183 /* Make gcc agree with <machine/ansi.h> */
184
185 #undef WCHAR_TYPE
186 #define WCHAR_TYPE "int"
187
188 #undef WCHAR_UNSIGNED
189 #define WCHAR_UNSIGNED 0
190
191 #undef WCHAR_TYPE_SIZE
192 #define WCHAR_TYPE_SIZE 32
193
194 #undef WINT_TYPE
195 #define WINT_TYPE "int"