Add x prefix to v850e case for handling --with-cpu=v850e.
[official-gcc.git] / gcc / config / mips / iris6.h
blobddfea8f147357db7fb82cb93104eb65b87042ddb
1 /* Definitions of target machine for GNU compiler. Iris version 6.
2 Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002
3 Free Software Foundation, Inc.
5 This file is part of GNU CC.
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.
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.
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. */
22 /* Let mips.c know we need the Irix6 functions. */
23 #define TARGET_IRIX6 1
25 /* Default to -mabi=n32 and -mips3. */
26 #define MIPS_ISA_DEFAULT 3
27 #define MIPS_ABI_DEFAULT ABI_N32
28 #define MULTILIB_DEFAULTS { "mabi=n32" }
30 #ifndef TARGET_DEFAULT
31 #define TARGET_DEFAULT (MASK_ABICALLS|MASK_FLOAT64|MASK_64BIT)
32 #endif
34 #include "mips/iris5.h"
36 /* Irix6 assembler does handle DWARF2 directives. Override setting in
37 irix5.h file. */
38 #undef DWARF2_UNWIND_INFO
40 /* The Irix6 assembler will sometimes assign labels to the wrong
41 section unless the labels are within .ent/.end blocks. Therefore,
42 we avoid creating such labels. */
43 #define DWARF2_GENERATE_TEXT_SECTION_LABEL 0
45 /* wchar_t is defined differently with and without -mabi=64. */
47 #undef WCHAR_TYPE
48 #define WCHAR_TYPE (Pmode == DImode ? "int" : "long int")
50 #undef WCHAR_TYPE_SIZE
51 #define WCHAR_TYPE_SIZE 32
53 /* Same for wint_t. */
55 #undef WINT_TYPE
56 #define WINT_TYPE (Pmode == DImode ? "int" : "long int")
58 #undef WINT_TYPE_SIZE
59 #define WINT_TYPE_SIZE 32
61 /* For Irix 6, -mabi=64 implies TARGET_LONG64. */
62 /* This is handled in override_options. */
64 #undef SUBTARGET_CC1_SPEC
65 #define SUBTARGET_CC1_SPEC ""
67 /* We must pass -D_LONGLONG always, even when -ansi is used, because irix6
68 system header files require it. This is OK, because gcc never warns
69 when long long is used in system header files. Alternatively, we can
70 add support for the SGI builtin type __long_long. */
72 /* The GNU C++ standard library requires that __EXTENSIONS__ and
73 _SGI_SOURCE be defined on at least irix6.2 and probably all IRIX 6
74 prior to 6.5. They normally get defined if !ansi, for g++ we want
75 them regardless. We don't need this on IRIX 6.5 itself, but it
76 shouldn't hurt other than the namespace pollution. */
78 /* Undefine because this includes iris5.h. */
79 #undef TARGET_OS_CPP_BUILTINS
80 #define TARGET_OS_CPP_BUILTINS() \
81 do { \
82 builtin_define_std ("host_mips"); \
83 builtin_define ("_LONGLONG"); \
84 builtin_define ("_MODERN_C"); \
85 builtin_define ("_SVR4_SOURCE"); \
86 builtin_define_std ("SYSTYPE_SVR4"); \
87 builtin_define ("__DSO__"); \
88 builtin_define_std ("unix"); \
89 builtin_define_std ("sgi"); \
90 builtin_assert ("system=svr4"); \
91 builtin_assert ("system=unix"); \
92 builtin_assert ("machine=sgi"); \
94 if (mips_abi == ABI_32) \
95 { \
96 builtin_define ("_MIPS_SIM=_MIPS_SIM_ABI32"); \
97 builtin_define ("_MIPS_SZLONG=32"); \
98 builtin_define ("_MIPS_SZPTR=32"); \
99 } \
100 else if (mips_abi == ABI_64) \
102 builtin_define ("_ABI64=3"); \
103 builtin_define ("_MIPS_SIM=_ABI64"); \
104 builtin_define ("_MIPS_SZLONG=64"); \
105 builtin_define ("_MIPS_SZPTR=64"); \
107 else \
109 builtin_define ("_ABIN32=2"); \
110 builtin_define ("_MIPS_SIM=_ABIN32"); \
111 builtin_define ("_MIPS_SZLONG=32"); \
112 builtin_define ("_MIPS_SZPTR=32"); \
115 if (!TARGET_FLOAT64) \
116 builtin_define ("_MIPS_FPSET=16"); \
117 else \
118 builtin_define ("_MIPS_FPSET=32"); \
120 if (!TARGET_INT64) \
121 builtin_define ("_MIPS_SZINT=32"); \
122 else \
123 builtin_define ("_MIPS_SZINT=64"); \
125 if (!ISA_MIPS1 && !ISA_MIPS2) \
126 builtin_define ("_COMPILER_VERSION=601"); \
128 if (c_language == clk_cplusplus) \
130 builtin_define ("__EXTENSIONS__"); \
131 builtin_define ("_SGI_SOURCE"); \
134 if (!flag_iso) \
136 builtin_define ("__EXTENSIONS__"); \
137 builtin_define ("_SGI_SOURCE"); \
139 } while (0)
141 /* Irix 6 uses DWARF-2. */
142 #define DWARF2_DEBUGGING_INFO 1
143 #define MIPS_DEBUGGING_INFO 1
144 #undef PREFERRED_DEBUGGING_TYPE
145 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
147 /* Force the generation of dwarf .debug_frame sections even if not
148 compiling -g. This guarantees that we can unwind the stack. */
149 #define DWARF2_FRAME_INFO 1
151 /* The size in bytes of a DWARF field indicating an offset or length
152 relative to a debug info section, specified to be 4 bytes in the DWARF-2
153 specification. The SGI/MIPS ABI defines it to be the same as PTR_SIZE. */
154 #define DWARF_OFFSET_SIZE PTR_SIZE
156 /* There is no GNU as port for Irix6 yet, so we set MD_EXEC_PREFIX so that
157 gcc will automatically find SGI as instead of searching the user's path.
158 The latter can fail when building a cross compiler if the user has . in
159 the path before /usr/bin, since then gcc will find and try to use the link
160 to the cross assembler which can't possibly work. */
162 #undef MD_EXEC_PREFIX
163 #define MD_EXEC_PREFIX "/usr/bin/"
165 /* We have no need for MD_STARTFILE_PREFIX. */
166 #undef MD_STARTFILE_PREFIX
168 #undef MACHINE_TYPE
169 #define MACHINE_TYPE "SGI running IRIX 6.x"
171 /* Irix 5 stuff that we don't need for Irix 6. */
172 /* ??? We do need this for the -mabi=32 switch though. */
173 #undef ASM_OUTPUT_UNDEF_FUNCTION
174 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
175 #undef ASM_DECLARE_FUNCTION_SIZE
177 /* Stuff we need for Irix 6 that isn't in Irix 5. */
179 /* The SGI assembler doesn't like labels before the .ent, so we must output
180 the .ent and function name here, which is the normal place for it. */
182 #undef ASM_DECLARE_FUNCTION_NAME
183 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
184 do { \
185 fputs ("\t.ent\t", STREAM); \
186 assemble_name (STREAM, NAME); \
187 fputs ("\n", STREAM); \
188 assemble_name (STREAM, NAME); \
189 fputs (":\n", STREAM); \
190 } while (0)
192 /* Likewise, the SGI assembler doesn't like labels after the .end, so we
193 must output the .end here. */
194 #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \
195 do { \
196 fputs ("\t.end\t", STREAM); \
197 assemble_name (STREAM, NAME); \
198 fputs ("\n", STREAM); \
199 } while (0)
201 /* Tell function_prologue in mips.c that we have already output the .ent/.end
202 pseudo-ops. */
203 #define FUNCTION_NAME_ALREADY_DECLARED
205 #undef SET_ASM_OP /* Has no equivalent. See ASM_OUTPUT_DEF below. */
207 #if 0
208 /* This is *NOT* how to equate one symbol to another symbol. The assembler
209 '=' syntax just equates a name to a constant expression.
210 See ASM_OUTPUT_WEAK_ALIAS. */
212 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
213 do { fprintf ((FILE), "\t"); \
214 assemble_name (FILE, LABEL1); \
215 fprintf (FILE, " = "); \
216 assemble_name (FILE, LABEL2); \
217 fprintf (FILE, "\n"); \
218 } while (0)
219 #endif
221 /* Define the strings used for the special svr4 .type and .size directives. */
223 #define TYPE_ASM_OP "\t.type\t"
224 #define SIZE_ASM_OP "\t.size\t"
226 /* Irix assembler does not support the init_priority C++ attribute. */
227 #undef SUPPORTS_INIT_PRIORITY
228 #define SUPPORTS_INIT_PRIORITY 0
230 /* A linker error can empirically be avoided by removing duplicate
231 library search directories. */
232 #define LINK_ELIMINATE_DUPLICATE_LDIRECTORIES 1
234 #define POPSECTION_ASM_OP "\t.popsection"
236 /* ??? If no mabi=X option give, but a mipsX option is, then should depend
237 on the mipsX option. */
238 /* If no mips[3,4] option given, give the appropriate default for mabi=X */
239 #undef SUBTARGET_ASM_SPEC
240 #define SUBTARGET_ASM_SPEC "%{!mabi*:-n32} %{!mips*: %{!mabi*:-mips3} %{mabi=n32|mabi=64:-mips3}}"
242 /* Must pass -g0 to the assembler, otherwise it may overwrite our
243 debug info with its own debug info. */
244 /* Must pass -show instead of -v. */
245 /* Must pass -G 0 to the assembler, otherwise we may get warnings about
246 GOT overflow. */
247 /* ??? We pass -w to disable all assembler warnings. The `label should be
248 inside .ent/.end block' warning that we get for DWARF II debug info labels
249 is particularly annoying. */
250 #undef SUBTARGET_MIPS_AS_ASM_SPEC
251 #define SUBTARGET_MIPS_AS_ASM_SPEC "%{v:-show} -G 0 -w"
253 #undef SUBTARGET_ASM_DEBUGGING_SPEC
254 #define SUBTARGET_ASM_DEBUGGING_SPEC "-g0"
256 /* The MIPS assembler occasionally misoptimizes. Since GCC should be
257 doing scheduling anyhow, just turn off optimization in the assembler. */
258 #undef SUBTARGET_ASM_OPTIMIZING_SPEC
259 #define SUBTARGET_ASM_OPTIMIZING_SPEC "-O0"
261 /* The assembler now accepts .section pseudo-ops, but it does not allow
262 one to change the section in the middle of a function, so we can't use
263 the INIT_SECTION_ASM_OP code in crtstuff. But we can build up the ctor
264 and dtor lists this way, so we use -init and -fini to invoke the
265 do_global_* functions instead of running collect2. */
267 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
269 #undef READONLY_DATA_SECTION_ASM_OP
270 #define READONLY_DATA_SECTION_ASM_OP_32 "\t.rdata"
271 #define READONLY_DATA_SECTION_ASM_OP_64 "\t.section\t.rodata"
272 #define READONLY_DATA_SECTION_ASM_OP \
273 (mips_abi != ABI_32 && mips_abi != ABI_O64 \
274 ? READONLY_DATA_SECTION_ASM_OP_64 \
275 : READONLY_DATA_SECTION_ASM_OP_32)
277 /* A default list of other sections which we might be "in" at any given
278 time. For targets that use additional sections (e.g. .tdesc) you
279 should override this definition in the target-specific file which
280 includes this file. */
282 #undef EXTRA_SECTIONS
283 #define EXTRA_SECTIONS in_sdata
285 /* A default list of extra section function definitions. For targets
286 that use additional sections (e.g. .tdesc) you should override this
287 definition in the target-specific file which includes this file. */
289 #undef EXTRA_SECTION_FUNCTIONS
290 #define EXTRA_SECTION_FUNCTIONS \
291 void \
292 sdata_section () \
294 if (in_section != in_sdata) \
296 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
297 in_section = in_sdata; \
301 const char * \
302 current_section_name () \
304 switch (in_section) \
306 case no_section: return NULL; \
307 case in_text: return ".text"; \
308 case in_data: return ".data"; \
309 case in_sdata: return ".sdata"; \
310 case in_bss: return ".bss"; \
311 case in_readonly_data: \
312 if (mips_abi != ABI_32 && mips_abi != ABI_O64) \
313 return ".rodata"; \
314 else \
315 return ".rdata"; \
316 case in_named: \
317 return in_named_name; \
319 abort (); \
322 unsigned int \
323 current_section_flags () \
325 switch (in_section) \
327 case no_section: return 0; \
328 case in_text: return SECTION_CODE; \
329 case in_data: return SECTION_WRITE; \
330 case in_sdata: return SECTION_WRITE | SECTION_SMALL; \
331 case in_bss: return SECTION_WRITE | SECTION_BSS; \
332 case in_readonly_data: return 0; \
333 case in_named: return get_named_section_flags (in_named_name); \
335 abort (); \
338 /* Switch into a generic section. */
339 #undef TARGET_ASM_NAMED_SECTION
340 #define TARGET_ASM_NAMED_SECTION iris6_asm_named_section
342 /* SGI assembler needs all sorts of extra help to do alignment properly. */
343 #undef ASM_OUTPUT_ALIGN
344 #define ASM_OUTPUT_ALIGN iris6_asm_output_align
345 #undef ASM_FILE_START
346 #define ASM_FILE_START iris6_asm_file_start
347 #undef ASM_FILE_END
348 #define ASM_FILE_END iris6_asm_file_end
350 #undef MAX_OFILE_ALIGNMENT
351 #define MAX_OFILE_ALIGNMENT (32768*8)
353 /* ??? SGI assembler may core dump when compiling with -g.
354 Sometimes as succeeds, but then we get a linker error. (cmds.c in 072.sc)
355 Getting rid of .file solves both problems. */
356 #undef ASM_OUTPUT_FILENAME
357 #define ASM_OUTPUT_FILENAME(STREAM, NUM_SOURCE_FILENAMES, NAME) \
358 do \
360 fprintf (STREAM, "\t#.file\t%d ", NUM_SOURCE_FILENAMES); \
361 output_quoted_string (STREAM, NAME); \
362 fputs ("\n", STREAM); \
364 while (0)
366 /* ??? SGI assembler gives warning whenever .lcomm is used. */
367 #undef ASM_OUTPUT_LOCAL
368 #define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN) \
369 do \
371 if (mips_abi != ABI_32 && mips_abi != ABI_O64) \
373 bss_section (); \
374 mips_declare_object (STREAM, NAME, "", ":\n", 0); \
375 ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \
376 ASM_OUTPUT_SKIP (STREAM, SIZE); \
378 else \
379 mips_declare_object (STREAM, NAME, "\n\t.lcomm\t", ",%u\n", (SIZE)); \
381 while (0)
383 /* A C statement (sans semicolon) to output to the stdio stream
384 FILE the assembler definition of uninitialized global DECL named
385 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
386 Try to use asm_output_aligned_bss to implement this macro. */
388 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
389 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
391 /* Write the extra assembler code needed to declare an object properly. */
393 #undef ASM_DECLARE_OBJECT_NAME
394 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
395 do \
397 HOST_WIDE_INT size; \
398 size_directive_output = 0; \
399 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
401 size_directive_output = 1; \
402 size = int_size_in_bytes (TREE_TYPE (DECL)); \
403 ASM_OUTPUT_SIZE_DIRECTIVE (STREAM, NAME, size); \
405 mips_declare_object (STREAM, NAME, "", ":\n", 0); \
407 while (0)
409 /* Define the `__builtin_va_list' type for the ABI. On Irix6, this
410 type is `char *'. */
411 #undef BUILD_VA_LIST_TYPE
412 #define BUILD_VA_LIST_TYPE(VALIST) \
413 (VALIST) = build_pointer_type (char_type_node)
415 /* Output the size directive for a decl in rest_of_decl_compilation
416 in the case where we did not do so before the initializer.
417 Once we find the error_mark_node, we know that the value of
418 size_directive_output was set
419 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
421 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
422 do { \
423 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
424 HOST_WIDE_INT size; \
425 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
426 && ! AT_END && TOP_LEVEL \
427 && DECL_INITIAL (DECL) == error_mark_node \
428 && !size_directive_output) \
430 size_directive_output = 1; \
431 size = int_size_in_bytes (TREE_TYPE (DECL)); \
432 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
434 } while (0)
436 #undef LOCAL_LABEL_PREFIX
437 #define LOCAL_LABEL_PREFIX ((mips_abi == ABI_32 || mips_abi == ABI_O64) \
438 ? "$" : ".")
440 /* Profiling is supported via libprof1.a not -lc_p as in Irix 3. */
441 /* ??? If no mabi=X option give, but a mipsX option is, then should depend
442 on the mipsX option. */
443 #undef STARTFILE_SPEC
444 #define STARTFILE_SPEC \
445 "%{!shared: \
446 %{mabi=32:%{pg:gcrt1.o%s} \
447 %{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \
448 %{mabi=n32: \
449 %{mips4:%{pg:/usr/lib32/mips4/gcrt1.o%s} \
450 %{!pg:%{p:/usr/lib32/mips4/mcrt1.o%s /usr/lib32/mips4/libprof1.a%s} \
451 %{!p:/usr/lib32/mips4/crt1.o%s}}} \
452 %{!mips4:%{pg:/usr/lib32/mips3/gcrt1.o%s} \
453 %{!pg:%{p:/usr/lib32/mips3/mcrt1.o%s /usr/lib32/mips3/libprof1.a%s} \
454 %{!p:/usr/lib32/mips3/crt1.o%s}}}} \
455 %{mabi=64: \
456 %{mips4:%{pg:/usr/lib64/mips4/gcrt1.o} \
457 %{!pg:%{p:/usr/lib64/mips4/mcrt1.o /usr/lib64/mips4/libprof1.a} \
458 %{!p:/usr/lib64/mips4/crt1.o}}} \
459 %{!mips4:%{pg:/usr/lib64/mips3/gcrt1.o} \
460 %{!pg:%{p:/usr/lib64/mips3/mcrt1.o /usr/lib64/mips3/libprof1.a} \
461 %{!p:/usr/lib64/mips3/crt1.o}}}} \
462 %{!mabi*: \
463 %{mips4:%{pg:/usr/lib32/mips4/gcrt1.o%s} \
464 %{!pg:%{p:/usr/lib32/mips4/mcrt1.o%s /usr/lib32/mips4/libprof1.a%s} \
465 %{!p:/usr/lib32/mips4/crt1.o%s}}} \
466 %{!mips4:%{pg:/usr/lib32/mips3/gcrt1.o%s} \
467 %{!pg:%{p:/usr/lib32/mips3/mcrt1.o%s /usr/lib32/mips3/libprof1.a%s} \
468 %{!p:/usr/lib32/mips3/crt1.o%s}}}}} \
469 crtbegin.o%s"
471 #undef LIB_SPEC
472 #define LIB_SPEC \
473 "%{mabi=n32: %{mips4:-L/usr/lib32/mips4} %{!mips4:-L/usr/lib32/mips3} \
474 -L/usr/lib32} \
475 %{mabi=64: %{mips4:-L/usr/lib64/mips4} %{!mips4:-L/usr/lib64/mips3} \
476 -L/usr/lib64} \
477 %{!mabi*: %{mips4:-L/usr/lib32/mips4} %{!mips4:-L/usr/lib32/mips3} \
478 -L/usr/lib32} \
479 %{!shared: \
480 -dont_warn_unused %{p:libprof1.a%s}%{pg:libprof1.a%s} -lc -warn_unused}"
482 /* Avoid getting two warnings for libgcc.a everytime we link. */
483 #undef LIBGCC_SPEC
484 #define LIBGCC_SPEC "-dont_warn_unused -lgcc -warn_unused"
486 /* ??? If no mabi=X option give, but a mipsX option is, then should depend
487 on the mipsX option. */
488 #undef ENDFILE_SPEC
489 #define ENDFILE_SPEC \
490 "crtend.o%s \
491 %{!shared: \
492 %{mabi=32:crtn.o%s}\
493 %{mabi=n32:%{mips4:/usr/lib32/mips4/crtn.o%s}\
494 %{!mips4:/usr/lib32/mips3/crtn.o%s}}\
495 %{mabi=64:%{mips4:/usr/lib64/mips4/crtn.o%s}\
496 %{!mips4:/usr/lib64/mips3/crtn.o%s}}\
497 %{!mabi*:%{mips4:/usr/lib32/mips4/crtn.o%s}\
498 %{!mips4:/usr/lib32/mips3/crtn.o%s}}}"
500 /* ??? If no mabi=X option give, but a mipsX option is, then should depend
501 on the mipsX option. */
502 #undef LINK_SPEC
503 #define LINK_SPEC "\
504 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
505 %{bestGnum} %{shared} %{non_shared} \
506 %{call_shared} %{no_archive} %{exact_version} %{w} \
507 %{!shared: %{!non_shared: %{!call_shared: -call_shared -no_unresolved}}} \
508 %{rpath} -init __do_global_ctors -fini __do_global_dtors \
509 %{shared:-hidden_symbol __do_global_ctors,__do_global_ctors_1,__do_global_dtors} \
510 -_SYSTYPE_SVR4 -woff 131 \
511 %{mabi=32: -32}%{mabi=n32: -n32}%{mabi=64: -64}%{!mabi*: -n32}"