1 /* Definitions of target machine for GNU compiler. IRIX 6.5 version.
2 Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2000,
3 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 /* We are compiling for IRIX 6 now. */
24 #define TARGET_IRIX6 1
27 #define MACHINE_TYPE "SGI running IRIX 6.5"
29 /* Default to -mabi=n32 and -mips3. */
30 #undef MULTILIB_DEFAULTS
31 #define MULTILIB_DEFAULTS { "mabi=n32" }
33 /* Force the default ABI onto the command line in order to make the specs
35 #undef DRIVER_SELF_SPECS
36 #define DRIVER_SELF_SPECS \
37 "%{!mabi=*: -mabi=n32}", \
38 /* Configuration-independent MIPS rules. */ \
39 BASE_DRIVER_SELF_SPECS
41 /* MIPS specific debugging info */
42 #define MIPS_DEBUGGING_INFO 1
44 /* Force the generation of dwarf .debug_frame sections even if not
45 compiling -g. This guarantees that we can unwind the stack. */
46 #define DWARF2_FRAME_INFO 1
48 /* The system unwinder in libexc requires a specific dwarf return address
50 #undef DWARF_FRAME_RETURN_COLUMN
51 #define DWARF_FRAME_RETURN_COLUMN (FP_REG_LAST + 1)
53 /* The size in bytes of a DWARF field indicating an offset or length
54 relative to a debug info section, specified to be 4 bytes in the DWARF-2
55 specification. The SGI/MIPS ABI defines it to be the same as PTR_SIZE. */
56 #define DWARF_OFFSET_SIZE PTR_SIZE
58 /* The size in bytes of the initial length field in a debug info
59 section. The DWARF 3 (draft) specification defines this to be
60 either 4 or 12 (with a 4-byte "escape" word when it's 12), but the
61 SGI/MIPS ABI predates this standard and defines it to be the same
62 as DWARF_OFFSET_SIZE. */
63 #define DWARF_INITIAL_LENGTH_SIZE DWARF_OFFSET_SIZE
65 /* MIPS assemblers don't have the usual .set foo,bar construct;
66 .set is used for assembler options instead. */
68 #define ASM_OUTPUT_DEF(FILE, LABEL1, LABEL2) \
72 assemble_name (FILE, LABEL1); \
73 fputs (" = ", FILE); \
74 assemble_name (FILE, LABEL2); \
79 #undef LOCAL_LABEL_PREFIX
80 #define LOCAL_LABEL_PREFIX (TARGET_NEWABI ? "." : "$")
82 #undef ASM_DECLARE_OBJECT_NAME
83 #define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
85 #undef ASM_FINISH_DECLARE_OBJECT
86 #define ASM_FINISH_DECLARE_OBJECT mips_finish_declare_object
88 /* The native IRIX 6 linker does not support merging without a special
90 #ifndef IRIX_USING_GNU_LD
91 #undef HAVE_GAS_SHF_MERGE
92 #define HAVE_GAS_SHF_MERGE 0
95 /* Specify wchar_t types. */
97 #define WCHAR_TYPE (Pmode == DImode ? "int" : "long int")
99 #undef WCHAR_TYPE_SIZE
100 #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
102 /* Same for wint_t. */
104 #define WINT_TYPE (Pmode == DImode ? "int" : "long int")
106 #undef WINT_TYPE_SIZE
107 #define WINT_TYPE_SIZE 32
109 /* C99 stdint.h types. */
110 #define INT8_TYPE "signed char"
111 #define INT16_TYPE "short int"
112 #define INT32_TYPE "int"
113 #define INT64_TYPE "long long int"
114 #define UINT8_TYPE "unsigned char"
115 #define UINT16_TYPE "short unsigned int"
116 #define UINT32_TYPE "unsigned int"
117 #define UINT64_TYPE "long long unsigned int"
119 #define INT_LEAST8_TYPE "signed char"
120 #define INT_LEAST16_TYPE "short int"
121 #define INT_LEAST32_TYPE "int"
122 #define INT_LEAST64_TYPE "long long int"
123 #define UINT_LEAST8_TYPE "unsigned char"
124 #define UINT_LEAST16_TYPE "short unsigned int"
125 #define UINT_LEAST32_TYPE "unsigned int"
126 #define UINT_LEAST64_TYPE "long long unsigned int"
128 #define INT_FAST8_TYPE "signed char"
129 #define INT_FAST16_TYPE "short int"
130 #define INT_FAST32_TYPE "int"
131 #define INT_FAST64_TYPE "long long int"
132 #define UINT_FAST8_TYPE "unsigned char"
133 #define UINT_FAST16_TYPE "short unsigned int"
134 #define UINT_FAST32_TYPE "unsigned int"
135 #define UINT_FAST64_TYPE "long long unsigned int"
137 #define INTMAX_TYPE "long long int"
138 #define UINTMAX_TYPE "long long unsigned int"
140 #define INTPTR_TYPE "long int"
141 #define UINTPTR_TYPE "long unsigned int"
143 #define SIG_ATOMIC_TYPE "int"
145 /* Plain char is unsigned in the SGI compiler. */
146 #undef DEFAULT_SIGNED_CHAR
147 #define DEFAULT_SIGNED_CHAR 0
149 #define WORD_SWITCH_TAKES_ARG(STR) \
150 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
151 || strcmp (STR, "rpath") == 0)
153 #define TARGET_OS_CPP_BUILTINS() \
156 builtin_define_std ("host_mips"); \
157 builtin_define_std ("sgi"); \
158 builtin_define_std ("unix"); \
159 builtin_define_std ("SYSTYPE_SVR4"); \
160 builtin_define ("_MODERN_C"); \
161 builtin_define ("_SVR4_SOURCE"); \
162 builtin_define ("__DSO__"); \
163 builtin_assert ("system=unix"); \
164 builtin_assert ("system=svr4"); \
165 builtin_assert ("machine=sgi"); \
167 if (!ISA_MIPS1 && !ISA_MIPS2) \
168 builtin_define ("_COMPILER_VERSION=601"); \
170 /* We must always define _LONGLONG, even when -ansi is \
171 used, because IRIX 5 system header files require it. \
172 This is OK, because gcc never warns when long long \
173 is used in system header files. \
175 An alternative would be to support the SGI builtin \
176 type __long_long. */ \
177 builtin_define ("_LONGLONG"); \
179 /* IRIX 6.5.18 and above provide many ISO C99 \
180 features protected by the __c99 macro. \
181 libstdc++ v3 needs them as well. */ \
183 if (flag_isoc99 || c_dialect_cxx ()) \
184 builtin_define ("__c99"); \
186 /* The GNU C++ standard library requires that \
187 __EXTENSIONS__ and _SGI_SOURCE be defined on at \
188 least IRIX 6.2 and probably all IRIX 6 prior to 6.5. \
189 We don't need this on IRIX 6.5 itself, but it \
190 shouldn't hurt other than the namespace pollution. */ \
191 if (!flag_iso || (TARGET_IRIX6 && c_dialect_cxx ())) \
193 builtin_define ("__EXTENSIONS__"); \
194 builtin_define ("_SGI_SOURCE"); \
199 #undef SUBTARGET_CC1_SPEC
200 #define SUBTARGET_CC1_SPEC "%{static: -mno-abicalls}"
202 #undef SUBTARGET_CPP_SPEC
203 #define SUBTARGET_CPP_SPEC "%{pthread:-D_REENTRANT}"
205 #undef INIT_SECTION_ASM_OP
206 #define INIT_SECTION_ASM_OP "\t.section\t.gcc_init,\"ax\",@progbits"
208 #undef FINI_SECTION_ASM_OP
209 #define FINI_SECTION_ASM_OP "\t.section\t.gcc_fini,\"ax\",@progbits"
211 #ifdef IRIX_USING_GNU_LD
212 #define IRIX_NO_UNRESOLVED ""
214 #define IRIX_NO_UNRESOLVED "-no_unresolved"
217 #ifdef IRIX_USING_GNU_LD
218 #define SUBTARGET_DONT_WARN_UNUSED_SPEC ""
219 #define SUBTARGET_WARN_UNUSED_SPEC ""
221 #define SUBTARGET_DONT_WARN_UNUSED_SPEC "-dont_warn_unused"
222 #define SUBTARGET_WARN_UNUSED_SPEC "-warn_unused"
225 /* Profiling is supported via libprof1.a not -lc_p as in IRIX 3. */
226 #undef STARTFILE_SPEC
227 #define STARTFILE_SPEC \
230 %{mips4:%{pg:/usr/lib32/mips4/gcrt1.o%s} \
231 %{!pg:%{p:/usr/lib32/mips4/mcrt1.o%s /usr/lib32/mips4/libprof1.a%s} \
232 %{!p:/usr/lib32/mips4/crt1.o%s}}} \
233 %{!mips4:%{pg:/usr/lib32/mips3/gcrt1.o%s} \
234 %{!pg:%{p:/usr/lib32/mips3/mcrt1.o%s /usr/lib32/mips3/libprof1.a%s} \
235 %{!p:/usr/lib32/mips3/crt1.o%s}}}} \
237 %{mips4:%{pg:/usr/lib64/mips4/gcrt1.o} \
238 %{!pg:%{p:/usr/lib64/mips4/mcrt1.o /usr/lib64/mips4/libprof1.a} \
239 %{!p:/usr/lib64/mips4/crt1.o}}} \
240 %{!mips4:%{pg:/usr/lib64/mips3/gcrt1.o} \
241 %{!pg:%{p:/usr/lib64/mips3/mcrt1.o /usr/lib64/mips3/libprof1.a} \
242 %{!p:/usr/lib64/mips3/crt1.o}}}}} \
243 irix-crti.o%s crtbegin.o%s"
247 "%{mabi=n32: %{mips4:-L/usr/lib32/mips4} %{!mips4:-L/usr/lib32/mips3} \
249 %{mabi=64: %{mips4:-L/usr/lib64/mips4} %{!mips4:-L/usr/lib64/mips3} \
252 SUBTARGET_DONT_WARN_UNUSED_SPEC \
253 " %{pthread:-lpthread} %{p:libprof1.a%s}%{pg:libprof1.a%s} -lc " \
254 SUBTARGET_WARN_UNUSED_SPEC "}"
256 /* Avoid getting two warnings for libgcc.a everytime we link. libgcc.a
257 contains references to copysignl, so link with libm to resolve them. */
259 #define LIBGCC_SPEC \
260 SUBTARGET_DONT_WARN_UNUSED_SPEC " -lgcc -lm " SUBTARGET_WARN_UNUSED_SPEC
263 #define ENDFILE_SPEC \
264 "crtend.o%s irix-crtn.o%s \
266 %{mabi=n32:%{mips4:/usr/lib32/mips4/crtn.o%s}\
267 %{!mips4:/usr/lib32/mips3/crtn.o%s}}\
268 %{mabi=64:%{mips4:/usr/lib64/mips4/crtn.o%s}\
269 %{!mips4:/usr/lib64/mips3/crtn.o%s}}}"
271 /* Generic part of the LINK_SPEC. */
274 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
275 %{bestGnum} %{shared} %{non_shared} \
276 %{call_shared} %{no_archive} %{exact_version} \
278 %{!non_shared: %{!call_shared:%{!r: -call_shared " IRIX_NO_UNRESOLVED "}}}} \
279 %{rpath} %{!r: -init __gcc_init -fini __gcc_fini} " IRIX_SUBTARGET_LINK_SPEC
281 #ifdef IRIX_USING_GNU_LD
282 #define IRIX_SUBTARGET_LINK_SPEC \
283 "%{mabi=n32: -melf32bmipn32}%{mabi=64: -melf64bmip}"
285 /* Explicitly hide crt symbols that would normally be marked with
286 a "hidden" visibility attribute.
288 We have traditionally disabled this attribute when using the
289 native linker because the native linker's visibility support is
290 not fully-compatible with the GNU linker's. In particular, the
291 native linker does not pull in archive objects purely to resolve
292 references to the object's hidden symbols, whereas the GNU
295 The gcc build system currently hides symbols in some static
296 libraries (typically libgcov.a or libgcc.a) whenever visibility
297 attributes are supported. On targets with GNU semantics, this
298 makes sure that uses of libx.so symbols in one dynamic object are
299 not resolved to libx.a symbols in another dynamic object. But
300 on targets with IRIX semantics, hiding the symbols prevents the
301 static archive from working at all.
303 It would probably be better to enable visiblity attributes for
304 IRIX ld and disable the static archives versioning. It shouldn't
305 make anything worse, since libx.a symbols are global by default
306 anyway. However, no-one has volunteered to do this yet. */
308 #define IRIX_SUBTARGET_LINK_SPEC \
309 "%{w} -_SYSTYPE_SVR4 -woff 131 \
310 %{shared:-hidden_symbol __dso_handle} \
311 %{mabi=n32: -n32}%{mabi=64: -64}%{!mabi*: -n32}"
314 /* A linker error can empirically be avoided by removing duplicate
315 library search directories. */
316 #define LINK_ELIMINATE_DUPLICATE_LDIRECTORIES 1
318 /* Add -g to mips.h default to avoid confusing gas with local symbols
319 generated from stabs info. */
321 #define NM_FLAGS "-Bng"
323 /* The system header files are C++ aware. */
324 /* ??? Unfortunately, most but not all of the headers are C++ aware.
325 Specifically, curses.h is not, and as a consequence, defining this
326 used to prevent libg++ building. This is no longer the case so
327 define it again to prevent other problems, e.g. with getopt in
328 unistd.h. We still need some way to fix just those files that need
330 #define NO_IMPLICIT_EXTERN_C 1
332 /* -G is incompatible with -KPIC which is the default, so only allow objects
333 in the small data section if the user explicitly asks for it. */
334 #undef MIPS_DEFAULT_GVALUE
335 #define MIPS_DEFAULT_GVALUE 0
337 #define MIPS_TFMODE_FORMAT mips_extended_format