1 /* Definitions of target machine for GNU compiler. Iris version 5.
2 Copyright (C) 1993, 1995, 1996, 1998, 2000,
3 2001, 2002 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)
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 #define TARGET_IRIX5 1
24 #ifndef TARGET_DEFAULT
25 #define TARGET_DEFAULT MASK_ABICALLS
27 #define ABICALLS_ASM_OP "\t.option pic2"
29 #include "mips/iris3.h"
30 #include "mips/mips.h"
31 #include "mips/iris4.h"
33 /* Irix 5 doesn't use COFF, so disable special COFF handling in collect2.c. */
34 #undef OBJECT_FORMAT_COFF
36 /* ??? This is correct, but not very useful, because there is no file that
38 /* ??? The best way to handle global constructors under ELF is to use .init
39 and .fini sections. Unfortunately, there is apparently no way to get
40 the Irix 5.x (x <= 2) assembler to create these sections. So we instead
41 use collect. The linker can create these sections via -init and -fini
42 options, but using this would require modifying how crtstuff works, and
43 I will leave that for another time (or someone else). */
44 #define OBJECT_FORMAT_ELF
45 #define HAS_INIT_SECTION
46 #define LD_INIT_SWITCH "-init"
47 #define LD_FINI_SWITCH "-fini"
49 /* The linker needs a space after "-o". */
50 #define SWITCHES_NEED_SPACES "o"
52 /* Specify wchar_t types. */
54 #undef WCHAR_TYPE_SIZE
55 #undef MAX_WCHAR_TYPE_SIZE
57 #define WCHAR_TYPE "int"
58 #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
59 #define MAX_WCHAR_TYPE_SIZE 64
61 #define WORD_SWITCH_TAKES_ARG(STR) \
62 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
63 || !strcmp (STR, "rpath"))
65 #define TARGET_OS_CPP_BUILTINS() \
67 builtin_define_std ("host_mips"); \
68 builtin_define_std ("sgi"); \
69 builtin_define_std ("unix"); \
70 builtin_define_std ("SYSTYPE_SVR4"); \
71 builtin_define ("_MODERN_C"); \
72 builtin_define ("_SVR4_SOURCE"); \
73 builtin_define ("__DSO__"); \
74 builtin_define ("_MIPS_SIM=_MIPS_SIM_ABI32"); \
75 builtin_define ("_MIPS_SZPTR=32"); \
76 builtin_assert ("system=unix"); \
77 builtin_assert ("system=svr4"); \
78 builtin_assert ("machine=sgi"); \
80 if (!TARGET_FLOAT64) \
81 builtin_define ("_MIPS_FPSET=16"); \
83 builtin_define ("_MIPS_FPSET=32"); \
86 builtin_define ("_MIPS_SZINT=32"); \
88 builtin_define ("_MIPS_SZINT=64"); \
91 builtin_define ("_MIPS_SZLONG=32"); \
93 builtin_define ("_MIPS_SZLONG=64"); \
97 builtin_define ("__EXTENSIONS__"); \
98 builtin_define ("_SGI_SOURCE"); \
102 #undef SUBTARGET_CC1_SPEC
103 #define SUBTARGET_CC1_SPEC "%{static: -mno-abicalls}"
107 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
108 %{bestGnum} %{shared} %{non_shared} \
109 %{call_shared} %{no_archive} %{exact_version} \
110 %{static: -non_shared} \
112 %{!shared:%{!non_shared:%{!call_shared: -call_shared -no_unresolved}}}} \
116 /* We now support shared libraries. */
117 #undef STARTFILE_SPEC
118 #define STARTFILE_SPEC "\
120 %{!shared:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}}} \
123 %{!pg:%{p:/usr/lib/nonshared/mcrt1.o%s libprof1.a%s} \
124 %{!p:/usr/lib/nonshared/crt1.o%s}}}"
127 #define LIB_SPEC "%{!shared:%{p:-lprof1} %{pg:-lprof1} -lc}"
130 #define ENDFILE_SPEC "%{!shared:crtn.o%s}"
132 /* We do not want to run mips-tfile! */
133 #undef ASM_FINAL_SPEC
135 /* The system header files are C++ aware. */
136 /* ??? Unfortunately, most but not all of the headers are C++ aware.
137 Specifically, curses.h is not, and as a consequence, defining this
138 used to prevent libg++ building. This is no longer the case so
139 define it again to prevent other problems, e.g. with getopt in
140 unistd.h. We still need some way to fix just those files that need
142 #define NO_IMPLICIT_EXTERN_C 1
144 /* We don't support debugging info for now. */
145 #undef DBX_DEBUGGING_INFO
146 #undef SDB_DEBUGGING_INFO
147 #undef MIPS_DEBUGGING_INFO
148 #undef PREFERRED_DEBUGGING_TYPE
150 /* Likewise, the assembler doesn't handle DWARF2 directives. */
151 #define DWARF2_UNWIND_INFO 0
154 #define MACHINE_TYPE "SGI running IRIX 5.x"
156 /* Dollar signs are OK in Irix5 but not in Irix3. */
157 #undef DOLLARS_IN_IDENTIFIERS
158 #undef NO_DOLLAR_IN_LABEL
160 /* -G is incompatible with -KPIC which is the default, so only allow objects
161 in the small data section if the user explicitly asks for it. */
162 #undef MIPS_DEFAULT_GVALUE
163 #define MIPS_DEFAULT_GVALUE 0
165 /* In Irix 5, we must output a `.global name .text' directive for every used
166 but undefined function. If we don't, the linker may perform an optimization
167 (skipping over the insns that set $gp) when it is unsafe. This is used
168 indirectly by ASM_OUTPUT_EXTERNAL. */
169 #define ASM_OUTPUT_UNDEF_FUNCTION(FILE, NAME) \
171 fputs ("\t.globl ", FILE); \
172 assemble_name (FILE, NAME); \
173 fputs (" .text\n", FILE); \
176 /* Also do this for libcalls. */
177 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
178 mips_output_external_libcall (FILE, XSTR (FUN, 0))
180 /* This does for functions what ASM_DECLARE_OBJECT_NAME does for variables.
181 This is used indirectly by ASM_OUTPUT_EXTERNAL. */
182 #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \
184 tree name_tree = get_identifier (NAME); \
185 TREE_ASM_WRITTEN (name_tree) = 1; \
188 /* This is how we tell the assembler that a symbol is weak. */
190 #define ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, VALUE) \
193 (*targetm.asm_out.globalize_label) (FILE, NAME); \
194 fputs ("\t.weakext\t", FILE); \
195 assemble_name (FILE, NAME); \
199 assemble_name (FILE, VALUE); \
201 fputc ('\n', FILE); \
205 #define ASM_WEAKEN_LABEL(FILE, NAME) ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, 0)
207 /* Handle #pragma weak and #pragma pack. */
208 #undef HANDLE_SYSV_PRAGMA
209 #define HANDLE_SYSV_PRAGMA 1