xref: /openbsd-src/gnu/usr.bin/gcc/gcc/config/mips/iris5.h (revision c87b03e512fc05ed6e0222f6fb0ae86264b1d05b)
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.
4 
5 This file is part of GNU CC.
6 
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.
11 
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.
16 
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.  */
21 
22 #define TARGET_IRIX5 1
23 
24 #ifndef TARGET_DEFAULT
25 #define	TARGET_DEFAULT	MASK_ABICALLS
26 #endif
27 #define ABICALLS_ASM_OP "\t.option pic2"
28 
29 #include "mips/iris3.h"
30 #include "mips/mips.h"
31 #include "mips/iris4.h"
32 
33 /* Irix 5 doesn't use COFF, so disable special COFF handling in collect2.c.  */
34 #undef OBJECT_FORMAT_COFF
35 
36 /* ??? This is correct, but not very useful, because there is no file that
37    uses this macro.  */
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"
48 
49 /* The linker needs a space after "-o".  */
50 #define SWITCHES_NEED_SPACES "o"
51 
52 /* Specify wchar_t types.  */
53 #undef	WCHAR_TYPE
54 #undef	WCHAR_TYPE_SIZE
55 #undef	MAX_WCHAR_TYPE_SIZE
56 
57 #define WCHAR_TYPE     "int"
58 #define WCHAR_TYPE_SIZE        INT_TYPE_SIZE
59 #define MAX_WCHAR_TYPE_SIZE    64
60 
61 #define WORD_SWITCH_TAKES_ARG(STR)			\
62  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)			\
63   || !strcmp (STR, "rpath"))
64 
65 #define TARGET_OS_CPP_BUILTINS()			\
66     do {						\
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");			\
79 							\
80      if (!TARGET_FLOAT64)                               \
81         builtin_define ("_MIPS_FPSET=16");              \
82      else                                               \
83         builtin_define ("_MIPS_FPSET=32");              \
84 							\
85      if (!TARGET_INT64)                                 \
86         builtin_define ("_MIPS_SZINT=32");              \
87      else                                               \
88         builtin_define ("_MIPS_SZINT=64");              \
89 							\
90      if (!TARGET_LONG64)				\
91 	builtin_define ("_MIPS_SZLONG=32");		\
92      else						\
93 	builtin_define ("_MIPS_SZLONG=64");		\
94 							\
95      if (!flag_iso)					\
96        {						\
97 	 builtin_define ("__EXTENSIONS__");		\
98 	 builtin_define ("_SGI_SOURCE");		\
99        }						\
100 } while (0);
101 
102 #undef SUBTARGET_CC1_SPEC
103 #define SUBTARGET_CC1_SPEC "%{static: -mno-abicalls}"
104 
105 #undef LINK_SPEC
106 #define LINK_SPEC "\
107 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
108 %{bestGnum} %{shared} %{non_shared} \
109 %{call_shared} %{no_archive} %{exact_version} \
110 %{static: -non_shared} \
111 %{!static: \
112   %{!shared:%{!non_shared:%{!call_shared: -call_shared -no_unresolved}}}} \
113 %{rpath} \
114 -_SYSTYPE_SVR4"
115 
116 /* We now support shared libraries.  */
117 #undef STARTFILE_SPEC
118 #define STARTFILE_SPEC "\
119 %{!static: \
120   %{!shared:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}}} \
121 %{static: \
122   %{pg:gcrt1.o%s} \
123   %{!pg:%{p:/usr/lib/nonshared/mcrt1.o%s libprof1.a%s} \
124   %{!p:/usr/lib/nonshared/crt1.o%s}}}"
125 
126 #undef LIB_SPEC
127 #define LIB_SPEC "%{!shared:%{p:-lprof1} %{pg:-lprof1} -lc}"
128 
129 #undef ENDFILE_SPEC
130 #define ENDFILE_SPEC "%{!shared:crtn.o%s}"
131 
132 /* We do not want to run mips-tfile!  */
133 #undef ASM_FINAL_SPEC
134 
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
141    fixing.  */
142 #define NO_IMPLICIT_EXTERN_C 1
143 
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
149 
150 /* Likewise, the assembler doesn't handle DWARF2 directives.  */
151 #define DWARF2_UNWIND_INFO 0
152 
153 #undef MACHINE_TYPE
154 #define MACHINE_TYPE "SGI running IRIX 5.x"
155 
156  /* Dollar signs are OK in Irix5 but not in Irix3.  */
157 #undef DOLLARS_IN_IDENTIFIERS
158 #undef NO_DOLLAR_IN_LABEL
159 
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
164 
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)	\
170 do {						\
171   fputs ("\t.globl ", FILE);			\
172   assemble_name (FILE, NAME);			\
173   fputs (" .text\n", FILE);			\
174 } while (0)
175 
176 /* Also do this for libcalls.  */
177 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)	\
178   mips_output_external_libcall (FILE, XSTR (FUN, 0))
179 
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)	\
183 do {							\
184   tree name_tree = get_identifier (NAME);		\
185   TREE_ASM_WRITTEN (name_tree) = 1;			\
186 } while (0)
187 
188 /* This is how we tell the assembler that a symbol is weak.  */
189 
190 #define ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, VALUE)	\
191   do							\
192     {							\
193       (*targetm.asm_out.globalize_label) (FILE, NAME);  \
194       fputs ("\t.weakext\t", FILE);			\
195       assemble_name (FILE, NAME);			\
196       if (VALUE)					\
197         {						\
198           fputc (' ', FILE);				\
199           assemble_name (FILE, VALUE);			\
200         }						\
201       fputc ('\n', FILE);				\
202     }							\
203   while (0)
204 
205 #define ASM_WEAKEN_LABEL(FILE, NAME) ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, 0)
206 
207 /* Handle #pragma weak and #pragma pack.  */
208 #define HANDLE_SYSV_PRAGMA 1
209