xref: /openbsd/gnu/gcc/gcc/config/mips/iris.h (revision 404b540a)
1*404b540aSrobert /* Definitions of target machine for GNU compiler.  Generic IRIX version.
2*404b540aSrobert    Copyright (C) 1993, 1995, 1996, 1998, 2000,
3*404b540aSrobert    2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4*404b540aSrobert 
5*404b540aSrobert This file is part of GCC.
6*404b540aSrobert 
7*404b540aSrobert GCC is free software; you can redistribute it and/or modify
8*404b540aSrobert it under the terms of the GNU General Public License as published by
9*404b540aSrobert the Free Software Foundation; either version 2, or (at your option)
10*404b540aSrobert any later version.
11*404b540aSrobert 
12*404b540aSrobert GCC is distributed in the hope that it will be useful,
13*404b540aSrobert but WITHOUT ANY WARRANTY; without even the implied warranty of
14*404b540aSrobert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*404b540aSrobert GNU General Public License for more details.
16*404b540aSrobert 
17*404b540aSrobert You should have received a copy of the GNU General Public License
18*404b540aSrobert along with GCC; see the file COPYING.  If not, write to
19*404b540aSrobert the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20*404b540aSrobert Boston, MA 02110-1301, USA.  */
21*404b540aSrobert 
22*404b540aSrobert /* We are compiling for IRIX now.  */
23*404b540aSrobert #undef TARGET_IRIX
24*404b540aSrobert #define TARGET_IRIX 1
25*404b540aSrobert 
26*404b540aSrobert /* The size in bytes of a DWARF field indicating an offset or length
27*404b540aSrobert    relative to a debug info section, specified to be 4 bytes in the DWARF-2
28*404b540aSrobert    specification.  The SGI/MIPS ABI defines it to be the same as PTR_SIZE.  */
29*404b540aSrobert #define DWARF_OFFSET_SIZE PTR_SIZE
30*404b540aSrobert 
31*404b540aSrobert /* The size in bytes of the initial length field in a debug info
32*404b540aSrobert    section.  The DWARF 3 (draft) specification defines this to be
33*404b540aSrobert    either 4 or 12 (with a 4-byte "escape" word when it's 12), but the
34*404b540aSrobert    SGI/MIPS ABI predates this standard and defines it to be the same
35*404b540aSrobert    as DWARF_OFFSET_SIZE.  */
36*404b540aSrobert #define DWARF_INITIAL_LENGTH_SIZE DWARF_OFFSET_SIZE
37*404b540aSrobert 
38*404b540aSrobert /* MIPS assemblers don't have the usual .set foo,bar construct;
39*404b540aSrobert    .set is used for assembler options instead.  */
40*404b540aSrobert #undef SET_ASM_OP
41*404b540aSrobert #define ASM_OUTPUT_DEF(FILE, LABEL1, LABEL2)			\
42*404b540aSrobert   do								\
43*404b540aSrobert     {								\
44*404b540aSrobert       fputc ('\t', FILE);					\
45*404b540aSrobert       assemble_name (FILE, LABEL1);				\
46*404b540aSrobert       fputs (" = ", FILE);					\
47*404b540aSrobert       assemble_name (FILE, LABEL2);				\
48*404b540aSrobert       fputc ('\n', FILE);					\
49*404b540aSrobert     }								\
50*404b540aSrobert   while (0)
51*404b540aSrobert 
52*404b540aSrobert /* The MIPSpro o32 linker warns about not linking .comment sections.  */
53*404b540aSrobert #undef IDENT_ASM_OP
54*404b540aSrobert 
55*404b540aSrobert #undef LOCAL_LABEL_PREFIX
56*404b540aSrobert #define LOCAL_LABEL_PREFIX (TARGET_NEWABI ? "." : "$")
57*404b540aSrobert 
58*404b540aSrobert #undef ASM_DECLARE_OBJECT_NAME
59*404b540aSrobert #define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
60*404b540aSrobert 
61*404b540aSrobert #undef ASM_FINISH_DECLARE_OBJECT
62*404b540aSrobert #define ASM_FINISH_DECLARE_OBJECT mips_finish_declare_object
63*404b540aSrobert 
64*404b540aSrobert /* Also do this for libcalls.  */
65*404b540aSrobert #undef TARGET_ASM_EXTERNAL_LIBCALL
66*404b540aSrobert #define TARGET_ASM_EXTERNAL_LIBCALL irix_output_external_libcall
67*404b540aSrobert 
68*404b540aSrobert /* The linker needs a space after "-o".  */
69*404b540aSrobert #define SWITCHES_NEED_SPACES "o"
70*404b540aSrobert 
71*404b540aSrobert /* Specify wchar_t types.  */
72*404b540aSrobert #undef WCHAR_TYPE
73*404b540aSrobert #define WCHAR_TYPE (Pmode == DImode ? "int" : "long int")
74*404b540aSrobert 
75*404b540aSrobert #undef WCHAR_TYPE_SIZE
76*404b540aSrobert #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
77*404b540aSrobert 
78*404b540aSrobert /* Same for wint_t.  */
79*404b540aSrobert #undef WINT_TYPE
80*404b540aSrobert #define WINT_TYPE (Pmode == DImode ? "int" : "long int")
81*404b540aSrobert 
82*404b540aSrobert #undef WINT_TYPE_SIZE
83*404b540aSrobert #define WINT_TYPE_SIZE 32
84*404b540aSrobert 
85*404b540aSrobert /* Plain char is unsigned in the SGI compiler.  */
86*404b540aSrobert #undef DEFAULT_SIGNED_CHAR
87*404b540aSrobert #define DEFAULT_SIGNED_CHAR 0
88*404b540aSrobert 
89*404b540aSrobert #define WORD_SWITCH_TAKES_ARG(STR)			\
90*404b540aSrobert   (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)			\
91*404b540aSrobert    || strcmp (STR, "rpath") == 0)
92*404b540aSrobert 
93*404b540aSrobert #define TARGET_OS_CPP_BUILTINS()				\
94*404b540aSrobert   do								\
95*404b540aSrobert     {								\
96*404b540aSrobert       builtin_define_std ("host_mips");				\
97*404b540aSrobert       builtin_define_std ("sgi");				\
98*404b540aSrobert       builtin_define_std ("unix");				\
99*404b540aSrobert       builtin_define_std ("SYSTYPE_SVR4");			\
100*404b540aSrobert       builtin_define ("_MODERN_C");				\
101*404b540aSrobert       builtin_define ("_SVR4_SOURCE");				\
102*404b540aSrobert       builtin_define ("__DSO__");				\
103*404b540aSrobert       builtin_assert ("system=unix");				\
104*404b540aSrobert       builtin_assert ("system=svr4");				\
105*404b540aSrobert       builtin_assert ("machine=sgi");				\
106*404b540aSrobert 								\
107*404b540aSrobert       if (mips_abi == ABI_32)					\
108*404b540aSrobert 	{							\
109*404b540aSrobert 	  builtin_define ("_ABIO32=1");				\
110*404b540aSrobert 	  builtin_define ("_MIPS_SIM=_ABIO32");			\
111*404b540aSrobert 	  builtin_define ("_MIPS_SZINT=32");			\
112*404b540aSrobert 	  builtin_define ("_MIPS_SZLONG=32");			\
113*404b540aSrobert 	  builtin_define ("_MIPS_SZPTR=32");			\
114*404b540aSrobert 	}							\
115*404b540aSrobert       else if (mips_abi == ABI_64)				\
116*404b540aSrobert 	{							\
117*404b540aSrobert 	  builtin_define ("_ABI64=3");				\
118*404b540aSrobert 	  builtin_define ("_MIPS_SIM=_ABI64");			\
119*404b540aSrobert 	  builtin_define ("_MIPS_SZINT=32");			\
120*404b540aSrobert 	  builtin_define ("_MIPS_SZLONG=64");			\
121*404b540aSrobert 	  builtin_define ("_MIPS_SZPTR=64");			\
122*404b540aSrobert 	}							\
123*404b540aSrobert       else							\
124*404b540aSrobert 	{							\
125*404b540aSrobert 	  builtin_define ("_ABIN32=2");				\
126*404b540aSrobert 	  builtin_define ("_MIPS_SIM=_ABIN32");			\
127*404b540aSrobert 	  builtin_define ("_MIPS_SZINT=32");			\
128*404b540aSrobert 	  builtin_define ("_MIPS_SZLONG=32");			\
129*404b540aSrobert 	  builtin_define ("_MIPS_SZPTR=32");			\
130*404b540aSrobert         }							\
131*404b540aSrobert 								\
132*404b540aSrobert       if (!ISA_MIPS1 && !ISA_MIPS2)				\
133*404b540aSrobert 	builtin_define ("_COMPILER_VERSION=601");		\
134*404b540aSrobert 								\
135*404b540aSrobert       if (!TARGET_FLOAT64)					\
136*404b540aSrobert 	builtin_define ("_MIPS_FPSET=16");			\
137*404b540aSrobert       else							\
138*404b540aSrobert 	builtin_define ("_MIPS_FPSET=32");			\
139*404b540aSrobert 								\
140*404b540aSrobert       /* We must always define _LONGLONG, even when -ansi is	\
141*404b540aSrobert 	 used, because IRIX 5 system header files require it.	\
142*404b540aSrobert 	 This is OK, because gcc never warns when long long	\
143*404b540aSrobert 	 is used in system header files.			\
144*404b540aSrobert 								\
145*404b540aSrobert 	 An alternative would be to support the SGI builtin	\
146*404b540aSrobert 	 type __long_long.  */					\
147*404b540aSrobert       builtin_define ("_LONGLONG");				\
148*404b540aSrobert 								\
149*404b540aSrobert       /* IRIX 6.5.18 and above provide many ISO C99		\
150*404b540aSrobert 	 features protected by the __c99 macro.			\
151*404b540aSrobert 	 libstdc++ v3 needs them as well.  */			\
152*404b540aSrobert       if (TARGET_IRIX6)						\
153*404b540aSrobert 	if (flag_isoc99 || c_dialect_cxx ())			\
154*404b540aSrobert 	  builtin_define ("__c99");				\
155*404b540aSrobert 								\
156*404b540aSrobert       /* The GNU C++ standard library requires that		\
157*404b540aSrobert 	 __EXTENSIONS__ and _SGI_SOURCE be defined on at	\
158*404b540aSrobert 	 least IRIX 6.2 and probably all IRIX 6 prior to 6.5.	\
159*404b540aSrobert 	 We don't need this on IRIX 6.5 itself, but it		\
160*404b540aSrobert 	 shouldn't hurt other than the namespace pollution.  */	\
161*404b540aSrobert       if (!flag_iso || (TARGET_IRIX6 && c_dialect_cxx ()))	\
162*404b540aSrobert 	{							\
163*404b540aSrobert 	  builtin_define ("__EXTENSIONS__");			\
164*404b540aSrobert 	  builtin_define ("_SGI_SOURCE");			\
165*404b540aSrobert 	}							\
166*404b540aSrobert     }								\
167*404b540aSrobert   while (0)
168*404b540aSrobert 
169*404b540aSrobert #undef SUBTARGET_CC1_SPEC
170*404b540aSrobert #define SUBTARGET_CC1_SPEC "%{static: -mno-abicalls}"
171*404b540aSrobert 
172*404b540aSrobert #undef INIT_SECTION_ASM_OP
173*404b540aSrobert #define INIT_SECTION_ASM_OP "\t.section\t.gcc_init,\"ax\",@progbits"
174*404b540aSrobert 
175*404b540aSrobert #undef FINI_SECTION_ASM_OP
176*404b540aSrobert #define FINI_SECTION_ASM_OP "\t.section\t.gcc_fini,\"ax\",@progbits"
177*404b540aSrobert 
178*404b540aSrobert #ifdef IRIX_USING_GNU_LD
179*404b540aSrobert #define IRIX_NO_UNRESOLVED ""
180*404b540aSrobert #else
181*404b540aSrobert #define IRIX_NO_UNRESOLVED "-no_unresolved"
182*404b540aSrobert #endif
183*404b540aSrobert 
184*404b540aSrobert /* Generic part of the LINK_SPEC.  */
185*404b540aSrobert #undef LINK_SPEC
186*404b540aSrobert #define LINK_SPEC "\
187*404b540aSrobert %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
188*404b540aSrobert %{bestGnum} %{shared} %{non_shared} \
189*404b540aSrobert %{call_shared} %{no_archive} %{exact_version} \
190*404b540aSrobert %{!shared: \
191*404b540aSrobert   %{!non_shared: %{!call_shared:%{!r: -call_shared " IRIX_NO_UNRESOLVED "}}}} \
192*404b540aSrobert %{rpath} -init __gcc_init -fini __gcc_fini " IRIX_SUBTARGET_LINK_SPEC
193*404b540aSrobert 
194*404b540aSrobert /* A linker error can empirically be avoided by removing duplicate
195*404b540aSrobert    library search directories.  */
196*404b540aSrobert #define LINK_ELIMINATE_DUPLICATE_LDIRECTORIES 1
197*404b540aSrobert 
198*404b540aSrobert /* Add -g to mips.h default to avoid confusing gas with local symbols
199*404b540aSrobert    generated from stabs info.  */
200*404b540aSrobert #undef NM_FLAGS
201*404b540aSrobert #define NM_FLAGS "-Bng"
202*404b540aSrobert 
203*404b540aSrobert /* The system header files are C++ aware.  */
204*404b540aSrobert /* ??? Unfortunately, most but not all of the headers are C++ aware.
205*404b540aSrobert    Specifically, curses.h is not, and as a consequence, defining this
206*404b540aSrobert    used to prevent libg++ building.  This is no longer the case so
207*404b540aSrobert    define it again to prevent other problems, e.g. with getopt in
208*404b540aSrobert    unistd.h.  We still need some way to fix just those files that need
209*404b540aSrobert    fixing.  */
210*404b540aSrobert #define NO_IMPLICIT_EXTERN_C 1
211*404b540aSrobert 
212*404b540aSrobert /* -G is incompatible with -KPIC which is the default, so only allow objects
213*404b540aSrobert    in the small data section if the user explicitly asks for it.  */
214*404b540aSrobert #undef MIPS_DEFAULT_GVALUE
215*404b540aSrobert #define MIPS_DEFAULT_GVALUE 0
216*404b540aSrobert 
217*404b540aSrobert /* The native o32 IRIX linker does not support merging without a
218*404b540aSrobert    special elspec(5) file.  */
219*404b540aSrobert #ifndef IRIX_USING_GNU_LD
220*404b540aSrobert #undef HAVE_GAS_SHF_MERGE
221*404b540aSrobert #define HAVE_GAS_SHF_MERGE 0
222*404b540aSrobert #endif
223