1169689Skan/* Definitions of target machine for GNU compiler.  Generic IRIX version.
2169689Skan   Copyright (C) 1993, 1995, 1996, 1998, 2000,
3169689Skan   2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4169689Skan
5169689SkanThis file is part of GCC.
6169689Skan
7169689SkanGCC is free software; you can redistribute it and/or modify
8169689Skanit under the terms of the GNU General Public License as published by
9169689Skanthe Free Software Foundation; either version 2, or (at your option)
10169689Skanany later version.
11169689Skan
12169689SkanGCC is distributed in the hope that it will be useful,
13169689Skanbut WITHOUT ANY WARRANTY; without even the implied warranty of
14169689SkanMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15169689SkanGNU General Public License for more details.
16169689Skan
17169689SkanYou should have received a copy of the GNU General Public License
18169689Skanalong with GCC; see the file COPYING.  If not, write to
19169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor,
20169689SkanBoston, MA 02110-1301, USA.  */
21169689Skan
22169689Skan/* We are compiling for IRIX now.  */
23169689Skan#undef TARGET_IRIX
24169689Skan#define TARGET_IRIX 1
25169689Skan
26169689Skan/* The size in bytes of a DWARF field indicating an offset or length
27169689Skan   relative to a debug info section, specified to be 4 bytes in the DWARF-2
28169689Skan   specification.  The SGI/MIPS ABI defines it to be the same as PTR_SIZE.  */
29169689Skan#define DWARF_OFFSET_SIZE PTR_SIZE
30169689Skan
31169689Skan/* The size in bytes of the initial length field in a debug info
32169689Skan   section.  The DWARF 3 (draft) specification defines this to be
33169689Skan   either 4 or 12 (with a 4-byte "escape" word when it's 12), but the
34169689Skan   SGI/MIPS ABI predates this standard and defines it to be the same
35169689Skan   as DWARF_OFFSET_SIZE.  */
36169689Skan#define DWARF_INITIAL_LENGTH_SIZE DWARF_OFFSET_SIZE
37169689Skan
38169689Skan/* MIPS assemblers don't have the usual .set foo,bar construct;
39169689Skan   .set is used for assembler options instead.  */
40169689Skan#undef SET_ASM_OP
41169689Skan#define ASM_OUTPUT_DEF(FILE, LABEL1, LABEL2)			\
42169689Skan  do								\
43169689Skan    {								\
44169689Skan      fputc ('\t', FILE);					\
45169689Skan      assemble_name (FILE, LABEL1);				\
46169689Skan      fputs (" = ", FILE);					\
47169689Skan      assemble_name (FILE, LABEL2);				\
48169689Skan      fputc ('\n', FILE);					\
49169689Skan    }								\
50169689Skan  while (0)
51169689Skan
52169689Skan/* The MIPSpro o32 linker warns about not linking .comment sections.  */
53169689Skan#undef IDENT_ASM_OP
54169689Skan
55169689Skan#undef LOCAL_LABEL_PREFIX
56169689Skan#define LOCAL_LABEL_PREFIX (TARGET_NEWABI ? "." : "$")
57169689Skan
58169689Skan#undef ASM_DECLARE_OBJECT_NAME
59169689Skan#define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
60169689Skan
61169689Skan#undef ASM_FINISH_DECLARE_OBJECT
62169689Skan#define ASM_FINISH_DECLARE_OBJECT mips_finish_declare_object
63169689Skan
64169689Skan/* Also do this for libcalls.  */
65169689Skan#undef TARGET_ASM_EXTERNAL_LIBCALL
66169689Skan#define TARGET_ASM_EXTERNAL_LIBCALL irix_output_external_libcall
67169689Skan
68169689Skan/* The linker needs a space after "-o".  */
69169689Skan#define SWITCHES_NEED_SPACES "o"
70169689Skan
71169689Skan/* Specify wchar_t types.  */
72169689Skan#undef WCHAR_TYPE
73169689Skan#define WCHAR_TYPE (Pmode == DImode ? "int" : "long int")
74169689Skan
75169689Skan#undef WCHAR_TYPE_SIZE
76169689Skan#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
77169689Skan
78169689Skan/* Same for wint_t.  */
79169689Skan#undef WINT_TYPE
80169689Skan#define WINT_TYPE (Pmode == DImode ? "int" : "long int")
81169689Skan
82169689Skan#undef WINT_TYPE_SIZE
83169689Skan#define WINT_TYPE_SIZE 32
84169689Skan
85169689Skan/* Plain char is unsigned in the SGI compiler.  */
86169689Skan#undef DEFAULT_SIGNED_CHAR
87169689Skan#define DEFAULT_SIGNED_CHAR 0
88169689Skan
89169689Skan#define WORD_SWITCH_TAKES_ARG(STR)			\
90169689Skan  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)			\
91169689Skan   || strcmp (STR, "rpath") == 0)
92169689Skan
93169689Skan#define TARGET_OS_CPP_BUILTINS()				\
94169689Skan  do								\
95169689Skan    {								\
96169689Skan      builtin_define_std ("host_mips");				\
97169689Skan      builtin_define_std ("sgi");				\
98169689Skan      builtin_define_std ("unix");				\
99169689Skan      builtin_define_std ("SYSTYPE_SVR4");			\
100169689Skan      builtin_define ("_MODERN_C");				\
101169689Skan      builtin_define ("_SVR4_SOURCE");				\
102169689Skan      builtin_define ("__DSO__");				\
103169689Skan      builtin_assert ("system=unix");				\
104169689Skan      builtin_assert ("system=svr4");				\
105169689Skan      builtin_assert ("machine=sgi");				\
106169689Skan								\
107169689Skan      if (mips_abi == ABI_32)					\
108169689Skan	{							\
109169689Skan	  builtin_define ("_ABIO32=1");				\
110169689Skan	  builtin_define ("_MIPS_SIM=_ABIO32");			\
111169689Skan	  builtin_define ("_MIPS_SZINT=32");			\
112169689Skan	  builtin_define ("_MIPS_SZLONG=32");			\
113169689Skan	  builtin_define ("_MIPS_SZPTR=32");			\
114169689Skan	}							\
115169689Skan      else if (mips_abi == ABI_64)				\
116169689Skan	{							\
117169689Skan	  builtin_define ("_ABI64=3");				\
118169689Skan	  builtin_define ("_MIPS_SIM=_ABI64");			\
119169689Skan	  builtin_define ("_MIPS_SZINT=32");			\
120169689Skan	  builtin_define ("_MIPS_SZLONG=64");			\
121169689Skan	  builtin_define ("_MIPS_SZPTR=64");			\
122169689Skan	}							\
123169689Skan      else							\
124169689Skan	{							\
125169689Skan	  builtin_define ("_ABIN32=2");				\
126169689Skan	  builtin_define ("_MIPS_SIM=_ABIN32");			\
127169689Skan	  builtin_define ("_MIPS_SZINT=32");			\
128169689Skan	  builtin_define ("_MIPS_SZLONG=32");			\
129169689Skan	  builtin_define ("_MIPS_SZPTR=32");			\
130169689Skan        }							\
131169689Skan								\
132169689Skan      if (!ISA_MIPS1 && !ISA_MIPS2)				\
133169689Skan	builtin_define ("_COMPILER_VERSION=601");		\
134169689Skan								\
135169689Skan      if (!TARGET_FLOAT64)					\
136169689Skan	builtin_define ("_MIPS_FPSET=16");			\
137169689Skan      else							\
138169689Skan	builtin_define ("_MIPS_FPSET=32");			\
139169689Skan								\
140169689Skan      /* We must always define _LONGLONG, even when -ansi is	\
141169689Skan	 used, because IRIX 5 system header files require it.	\
142169689Skan	 This is OK, because gcc never warns when long long	\
143169689Skan	 is used in system header files.			\
144169689Skan								\
145169689Skan	 An alternative would be to support the SGI builtin	\
146169689Skan	 type __long_long.  */					\
147169689Skan      builtin_define ("_LONGLONG");				\
148169689Skan								\
149169689Skan      /* IRIX 6.5.18 and above provide many ISO C99		\
150169689Skan	 features protected by the __c99 macro.			\
151169689Skan	 libstdc++ v3 needs them as well.  */			\
152169689Skan      if (TARGET_IRIX6)						\
153169689Skan	if (flag_isoc99 || c_dialect_cxx ())			\
154169689Skan	  builtin_define ("__c99");				\
155169689Skan								\
156169689Skan      /* The GNU C++ standard library requires that		\
157169689Skan	 __EXTENSIONS__ and _SGI_SOURCE be defined on at	\
158169689Skan	 least IRIX 6.2 and probably all IRIX 6 prior to 6.5.	\
159169689Skan	 We don't need this on IRIX 6.5 itself, but it		\
160169689Skan	 shouldn't hurt other than the namespace pollution.  */	\
161169689Skan      if (!flag_iso || (TARGET_IRIX6 && c_dialect_cxx ()))	\
162169689Skan	{							\
163169689Skan	  builtin_define ("__EXTENSIONS__");			\
164169689Skan	  builtin_define ("_SGI_SOURCE");			\
165169689Skan	}							\
166169689Skan    }								\
167169689Skan  while (0)
168169689Skan
169169689Skan#undef SUBTARGET_CC1_SPEC
170169689Skan#define SUBTARGET_CC1_SPEC "%{static: -mno-abicalls}"
171169689Skan
172169689Skan#undef INIT_SECTION_ASM_OP
173169689Skan#define INIT_SECTION_ASM_OP "\t.section\t.gcc_init,\"ax\",@progbits"
174169689Skan
175169689Skan#undef FINI_SECTION_ASM_OP
176169689Skan#define FINI_SECTION_ASM_OP "\t.section\t.gcc_fini,\"ax\",@progbits"
177169689Skan
178169689Skan#ifdef IRIX_USING_GNU_LD
179169689Skan#define IRIX_NO_UNRESOLVED ""
180169689Skan#else
181169689Skan#define IRIX_NO_UNRESOLVED "-no_unresolved"
182169689Skan#endif
183169689Skan
184169689Skan/* Generic part of the LINK_SPEC.  */
185169689Skan#undef LINK_SPEC
186169689Skan#define LINK_SPEC "\
187169689Skan%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
188169689Skan%{bestGnum} %{shared} %{non_shared} \
189169689Skan%{call_shared} %{no_archive} %{exact_version} \
190169689Skan%{!shared: \
191169689Skan  %{!non_shared: %{!call_shared:%{!r: -call_shared " IRIX_NO_UNRESOLVED "}}}} \
192169689Skan%{rpath} -init __gcc_init -fini __gcc_fini " IRIX_SUBTARGET_LINK_SPEC
193169689Skan
194169689Skan/* A linker error can empirically be avoided by removing duplicate
195169689Skan   library search directories.  */
196169689Skan#define LINK_ELIMINATE_DUPLICATE_LDIRECTORIES 1
197169689Skan
198169689Skan/* Add -g to mips.h default to avoid confusing gas with local symbols
199169689Skan   generated from stabs info.  */
200169689Skan#undef NM_FLAGS
201169689Skan#define NM_FLAGS "-Bng"
202169689Skan
203169689Skan/* The system header files are C++ aware.  */
204169689Skan/* ??? Unfortunately, most but not all of the headers are C++ aware.
205169689Skan   Specifically, curses.h is not, and as a consequence, defining this
206169689Skan   used to prevent libg++ building.  This is no longer the case so
207169689Skan   define it again to prevent other problems, e.g. with getopt in
208169689Skan   unistd.h.  We still need some way to fix just those files that need
209169689Skan   fixing.  */
210169689Skan#define NO_IMPLICIT_EXTERN_C 1
211169689Skan
212169689Skan/* -G is incompatible with -KPIC which is the default, so only allow objects
213169689Skan   in the small data section if the user explicitly asks for it.  */
214169689Skan#undef MIPS_DEFAULT_GVALUE
215169689Skan#define MIPS_DEFAULT_GVALUE 0
216169689Skan
217169689Skan/* The native o32 IRIX linker does not support merging without a
218169689Skan   special elspec(5) file.  */
219169689Skan#ifndef IRIX_USING_GNU_LD
220169689Skan#undef HAVE_GAS_SHF_MERGE
221169689Skan#define HAVE_GAS_SHF_MERGE 0
222169689Skan#endif
223