]> gcc.gnu.org Git - gcc.git/blob - gcc/config/mips/linux.h
cppmacro.c (_cpp_backup_tokens): Pop cur_run before decrementing cur_token, not after.
[gcc.git] / gcc / config / mips / linux.h
1 /* Definitions for MIPS running Linux-based GNU systems with ELF format.
2 Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 #include "gofast.h"
22
23 /* US Software GOFAST library support. */
24 #define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
25
26 #include "mips/mips.h"
27
28 #undef WCHAR_TYPE
29 #define WCHAR_TYPE "int"
30
31 #undef WCHAR_TYPE_SIZE
32 #define WCHAR_TYPE_SIZE 32
33
34 /* If defined, a C expression whose value is a string containing the
35 assembler operation to identify the following data as
36 uninitialized global data. If not defined, and neither
37 `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
38 uninitialized global data will be output in the data section if
39 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
40 used. */
41 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
42
43 #define SBSS_SECTION_ASM_OP "\t.section .sbss"
44
45 /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
46 separate, explicit argument. If you define this macro, it is used
47 in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
48 handling the required alignment of the variable. The alignment is
49 specified as the number of bits.
50
51 Try to use function `asm_output_aligned_bss' defined in file
52 `varasm.c' when defining this macro. */
53 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
54 do { \
55 ASM_GLOBALIZE_LABEL (FILE, NAME); \
56 if (SIZE > 0 && SIZE <= mips_section_threshold) \
57 sbss_section (); \
58 else \
59 bss_section (); \
60 ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \
61 last_assemble_variable_decl = DECL; \
62 ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL); \
63 ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1); \
64 } while (0)
65
66 /* These macros generate the special .type and .size directives which
67 are used to set the corresponding fields of the linker symbol table
68 entries in an ELF object file under SVR4. These macros also output
69 the starting labels for the relevant functions/objects. */
70
71 /* Write the extra assembler code needed to declare an object properly. */
72
73 #undef ASM_DECLARE_OBJECT_NAME
74 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
75 do { \
76 fprintf (FILE, "%s", TYPE_ASM_OP); \
77 assemble_name (FILE, NAME); \
78 putc (',', FILE); \
79 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
80 putc ('\n', FILE); \
81 size_directive_output = 0; \
82 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
83 { \
84 size_directive_output = 1; \
85 fprintf (FILE, "%s", SIZE_ASM_OP); \
86 assemble_name (FILE, NAME); \
87 fprintf (FILE, ","); \
88 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \
89 int_size_in_bytes (TREE_TYPE (DECL))); \
90 fprintf (FILE, "\n"); \
91 } \
92 mips_declare_object (FILE, NAME, "", ":\n", 0); \
93 } while (0)
94
95 #undef UNIQUE_SECTION
96 #define UNIQUE_SECTION(DECL,RELOC) \
97 mips_unique_section ((DECL), (RELOC))
98
99 /* A list of other sections which the compiler might be "in" at any
100 given time. */
101 #undef EXTRA_SECTIONS
102 #define EXTRA_SECTIONS in_sdata, in_sbss, in_rdata
103
104 #undef EXTRA_SECTION_FUNCTIONS
105 #define EXTRA_SECTION_FUNCTIONS \
106 SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
107 SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) \
108 SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP)
109
110 #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \
111 void FN () \
112 { \
113 if (in_section != ENUM) \
114 { \
115 fprintf (asm_out_file, "%s\n", OP); \
116 in_section = ENUM; \
117 } \
118 }
119
120 #undef TARGET_VERSION
121 #if TARGET_ENDIAN_DEFAULT == 0
122 #define TARGET_VERSION fprintf (stderr, " (MIPSel GNU/Linux with ELF)");
123 #else
124 #define TARGET_VERSION fprintf (stderr, " (MIPS GNU/Linux with ELF)");
125 #endif
126
127 #undef MD_EXEC_PREFIX
128 #undef MD_STARTFILE_PREFIX
129
130 /* Required to keep collect2.c happy */
131 #undef OBJECT_FORMAT_COFF
132
133 /* If we don't set MASK_ABICALLS, we can't default to PIC. */
134 #undef TARGET_DEFAULT
135 #define TARGET_DEFAULT (MASK_ABICALLS|MASK_GAS)
136
137 /* Specify predefined symbols in preprocessor. */
138 #undef CPP_PREDEFINES
139 #if TARGET_ENDIAN_DEFAULT == 0
140 #define CPP_PREDEFINES "-DMIPSEL -D_MIPSEL -Dunix -Dmips -D_mips \
141 -DR3000 -D_R3000 -Dlinux -Asystem=posix -Acpu=mips \
142 -Amachine=mips -D__ELF__ -D__PIC__ -D__pic__"
143 #else
144 #define CPP_PREDEFINES "-DMIPSEB -D_MIPSEB -Dunix -Dmips -D_mips \
145 -DR3000 -D_R3000 -Dlinux -Asystem=posix -Acpu=mips \
146 -Amachine=mips -D__ELF__ -D__PIC__ -D__pic__"
147 #endif
148
149 #undef SUBTARGET_CPP_SIZE_SPEC
150 #define SUBTARGET_CPP_SIZE_SPEC "\
151 %{mabi=32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
152 %{mabi=n32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
153 %{mabi=64: -D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
154 %{!mabi*: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}"
155
156 /* We must make -mips3 do what -mlong64 used to do. */
157 /* ??? If no mipsX option given, but a mabi=X option is, then should set
158 _MIPS_ISA based on the mabi=X option. */
159 /* ??? If no mabi=X option give, but a mipsX option is, then should set
160 _MIPS_SIM based on the mipsX option. */
161 /* ??? Same for _MIPS_SZINT. */
162 /* ??? Same for _MIPS_SZPTR. */
163 /* ??? Same for __SIZE_TYPE and __PTRDIFF_TYPE. */
164 #undef SUBTARGET_CPP_SPEC
165 #define SUBTARGET_CPP_SPEC "\
166 %{mfp32: -D_MIPS_FPSET=16} \
167 %{mfp64: -D_MIPS_FPSET=32} \
168 %{!mfp*: -D_MIPS_FPSET=32} \
169 %{mips1: -D_MIPS_ISA=_MIPS_ISA_MIPS1} \
170 %{mips2: -D_MIPS_ISA=_MIPS_ISA_MIPS2} \
171 %{mips3: -D_MIPS_ISA=_MIPS_ISA_MIPS3} \
172 %{mips4: -D_MIPS_ISA=_MIPS_ISA_MIPS4} \
173 %{!mips*: -D_MIPS_ISA=_MIPS_ISA_MIPS1} \
174 %{mabi=32: -D_MIPS_SIM=_MIPS_SIM_ABI32} \
175 %{mabi=n32: -D_ABIN32=2 -D_MIPS_SIM=_ABIN32} \
176 %{mabi=64: -D_ABI64=3 -D_MIPS_SIM=_ABI64} \
177 %{!mabi*: -D_MIPS_SIM=_MIPS_SIM_ABI32} \
178 %{!mint64: -D_MIPS_SZINT=32}%{mint64: -D_MIPS_SZINT=64} \
179 %{mabi=32: -D_MIPS_SZLONG=32} \
180 %{mabi=n32: -D_MIPS_SZLONG=32} \
181 %{mabi=64: -D_MIPS_SZLONG=64} \
182 %{!mabi*: -D_MIPS_SZLONG=32} \
183 %{mabi=32: -D_MIPS_SZPTR=32} \
184 %{mabi=n32: -D_MIPS_SZPTR=32} \
185 %{mabi=64: -D_MIPS_SZPTR=64} \
186 %{!mabi*: -D_MIPS_SZPTR=32} \
187 %{!mips*: -U__mips -D__mips} \
188 %{mabi=32: -U__mips64} \
189 %{mabi=n32: -D__mips64} \
190 %{mabi=64: -U__mips64} \
191 %{!mabi*: -U__mips64} \
192 %{fno-PIC:-U__PIC__ -U__pic__} %{fno-pic:-U__PIC__ -U__pic__} \
193 %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} \
194 %{pthread:-D_REENTRANT}"
195
196 /* The GNU C++ standard library requires that these macros be defined. */
197 #undef CPLUSPLUS_CPP_SPEC
198 #define CPLUSPLUS_CPP_SPEC "\
199 -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS \
200 -D_GNU_SOURCE %(cpp) \
201 "
202
203 /* From iris5.h */
204 /* -G is incompatible with -KPIC which is the default, so only allow objects
205 in the small data section if the user explicitly asks for it. */
206 #undef MIPS_DEFAULT_GVALUE
207 #define MIPS_DEFAULT_GVALUE 0
208
209 /* Borrowed from sparc/linux.h */
210 #undef LINK_SPEC
211 #define LINK_SPEC \
212 "%(endian_spec) \
213 %{shared:-shared} \
214 %{!shared: \
215 %{!ibcs: \
216 %{!static: \
217 %{rdynamic:-export-dynamic} \
218 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
219 %{static:-static}}}"
220
221
222 #undef SUBTARGET_ASM_SPEC
223 #define SUBTARGET_ASM_SPEC "\
224 %{mabi=64: -64} \
225 %{!fno-PIC:%{!fno-pic:-KPIC}} \
226 %{fno-PIC:-non_shared} %{fno-pic:-non_shared}"
227
228 /* The MIPS assembler has different syntax for .set. We set it to
229 .dummy to trap any errors. */
230 #undef SET_ASM_OP
231 #define SET_ASM_OP "\t.dummy\t"
232
233 #undef ASM_OUTPUT_DEF
234 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
235 do { \
236 fputc ( '\t', FILE); \
237 assemble_name (FILE, LABEL1); \
238 fputs ( " = ", FILE); \
239 assemble_name (FILE, LABEL2); \
240 fputc ( '\n', FILE); \
241 } while (0)
242
243 #undef ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL
244 #define ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL(FILE, SY, HI, LO) \
245 do { \
246 fputc ('\t', FILE); \
247 assemble_name (FILE, SY); \
248 fputc ('=', FILE); \
249 assemble_name (FILE, HI); \
250 fputc ('-', FILE); \
251 assemble_name (FILE, LO); \
252 } while (0)
253
254 #undef ASM_DECLARE_FUNCTION_NAME
255 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
256 do { \
257 if (!flag_inhibit_size_directive) \
258 { \
259 fputs ("\t.ent\t", STREAM); \
260 assemble_name (STREAM, NAME); \
261 putc ('\n', STREAM); \
262 } \
263 fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \
264 assemble_name (STREAM, NAME); \
265 putc (',', STREAM); \
266 fprintf (STREAM, TYPE_OPERAND_FMT, "function"); \
267 putc ('\n', STREAM); \
268 assemble_name (STREAM, NAME); \
269 fputs (":\n", STREAM); \
270 } while (0)
271
272 #undef ASM_DECLARE_FUNCTION_SIZE
273 #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \
274 do { \
275 if (!flag_inhibit_size_directive) \
276 { \
277 fputs ("\t.end\t", STREAM); \
278 assemble_name (STREAM, NAME); \
279 putc ('\n', STREAM); \
280 } \
281 } while (0)
282
283 /* Tell function_prologue in mips.c that we have already output the .ent/.end
284 pseudo-ops. */
285 #define FUNCTION_NAME_ALREADY_DECLARED
This page took 0.049361 seconds and 5 git commands to generate.