OSDN Git Service

(DWARF_DEBUGGING_INFO, PREFERRED_DEBUGGING_TYPE):
[pf3gnuchains/gcc-fork.git] / gcc / config / mips / iris6.h
1 /* Definitions of target machine for GNU compiler.  Iris version 6.
2    Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 /* Default to -mabi=n32 and -mips3.  */
22 #define MIPS_ISA_DEFAULT 3
23 #define MIPS_ABI_DEFAULT ABI_N32
24 #define MULTILIB_DEFAULTS { "mabi=n32" }
25
26 #include "mips/iris5.h"
27 #include "mips/abi64.h"
28
29 /* Irix 6 uses DWARF.  */
30 #define DWARF_DEBUGGING_INFO
31 #define DWARF_VERSION 2
32 #define MIPS_DEBUGGING_INFO
33 #undef PREFERRED_DEBUGGING_TYPE
34 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
35
36 #undef MACHINE_TYPE
37 #define MACHINE_TYPE "SGI running IRIX 6.x"
38
39 /* The Irix 6.0.1 assembler doesn't like labels in the text section, so
40    just avoid emitting them.  */
41 #define ASM_IDENTIFY_GCC
42 #define ASM_IDENTIFY_LANGUAGE
43
44 /* Irix 5 stuff that we don't need for Irix 6.  */
45 /* ??? We do need this for the -mabi=32 switch though.  */
46 #undef ASM_OUTPUT_UNDEF_FUNCTION
47 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
48 #undef ASM_DECLARE_FUNCTION_SIZE
49
50 /* Stuff we need for Irix 6 that isn't in Irix 5.  */
51
52 /* The SGI assembler doesn't like labels before the .ent, so we must output
53    the .ent and function name here, which is the normal place for it.  */
54
55 #undef ASM_DECLARE_FUNCTION_NAME
56 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL)                   \
57   do {                                                                  \
58     fputs ("\t.ent\t", STREAM);                                         \
59     assemble_name (STREAM, NAME);                                       \
60     fputs ("\n", STREAM);                                               \
61     assemble_name (STREAM, NAME);                                       \
62     fputs (":\n", STREAM);                                              \
63   } while (0)
64
65 /* Likewise, the SGI assembler doesn't like labels after the .end, so we
66    must output the .end here.  */
67 #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL)                   \
68   do {                                                                  \
69     fputs ("\t.end\t", STREAM);                                         \
70     assemble_name (STREAM, NAME);                                       \
71     fputs ("\n", STREAM);                                               \
72   } while (0)
73
74 /* Tell function_prologue in mips.c that we have already output the .ent/.end
75    psuedo-ops.  */
76 #define FUNCTION_NAME_ALREADY_DECLARED
77
78 #undef SET_ASM_OP       /* Has no equivalent.  See ASM_OUTPUT_DEF below.  */
79
80 /* This is how to equate one symbol to another symbol.  The syntax used is
81    `SYM1=SYM2'.  Note that this is different from the way equates are done
82    with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'.  */
83
84 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
85  do {   fprintf ((FILE), "\t");                                         \
86         assemble_name (FILE, LABEL1);                                   \
87         fprintf (FILE, " = ");                                          \
88         assemble_name (FILE, LABEL2);                                   \
89         fprintf (FILE, "\n");                                           \
90   } while (0)
91
92 #define POPSECTION_ASM_OP       ".popsection"
93
94 #define DEBUG_SECTION           ".debug_info,0x7000001e,0,0,1"
95 #define LINE_SECTION            ".debug_line,0x7000001e,0,0,1"
96 #define SFNAMES_SECTION         ".debug_sfnames,0x7000001e,0,0,1"
97 #define SRCINFO_SECTION         ".debug_srcinfo,0x7000001e,0,0,1"
98 #define MACINFO_SECTION         ".debug_macinfo,0x7000001e,0,0,1"
99 #define PUBNAMES_SECTION        ".debug_pubnames,0x7000001e,0,0,1"
100 #define ARANGES_SECTION         ".debug_aranges,0x7000001e,0,0,1"
101 #define FRAME_SECTION           ".debug_frame,0x7000001e,0x08000000,0,1"
102 #define ABBREV_SECTION          ".debug_abbrev,0x7000001e,0,0,1"
103
104 /* ??? If no mabi=X option give, but a mipsX option is, then should depend
105    on the mipsX option.  */
106 #undef ASM_SPEC
107 #if ((TARGET_CPU_DEFAULT | TARGET_DEFAULT) & MASK_GAS) != 0
108 /* GAS */
109 #define ASM_SPEC "\
110 %{mmips-as: \
111         %{!.s:-nocpp} %{.s: %{cpp} %{nocpp}} \
112         %{pipe: %e-pipe is not supported.} \
113         %{K}} \
114 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} %{v} \
115 %{noasmopt:-O0} \
116 %{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}} \
117 %{g} %{g0} %{g1} %{g2} %{g3} \
118 %{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \
119 %{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \
120 %{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \
121 %{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3} \
122 %{membedded-pic} \
123 %{mabi=32:-32}{%mabi=o32:-32}%{mabi=n32:-n32}%{mabi=64:-64}%{mabi=n64:-64} \
124 %{!mabi*:-n32}"
125
126 #else
127 /* not GAS */
128 /* Must pass -g0 to the assembler, otherwise it may overwrite our
129    debug info with its own debug info. */
130 /* Must pass -show instead of -v.  */
131 /* Must pass -G 0 to the assembler, otherwise we may get warnings about
132    GOT overflow.  */
133 #define ASM_SPEC "\
134 %{!mgas: \
135         %{!.s:-nocpp} %{.s: %{cpp} %{nocpp}} \
136         %{pipe: %e-pipe is not supported.} \
137         %{K}} \
138 %{G*} %{EB} %{EL} %{v:-show} \
139 %{mips1} %{mips2} %{mips3} %{mips4} \
140 %{noasmopt:-O0} %{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}} \
141 -g0 -G 0 %{membedded-pic} \
142 %{mabi=32:-32}%{mabi=o32:-32}%{mabi=n32:-n32}%{mabi=64:-64}%{mabi=n64:-64} \
143 %{!mabi*:-n32}"
144
145 #endif
146
147 /* Stuff for constructors.  Start here.  */
148
149 /* The assembler now accepts .section pseudo-ops, but it does not allow
150    one to change the section in the middle of a function.  crtstuff relies
151    on this hack, and thus crtstuff won't work here.  So, we do init and
152    fini sections exactly the same way as they are done for Irix 5, and
153    we ifdef out the ASM_OUTPUT_{CON,DE}STRUCTOR macros below.  */
154
155 #define CONST_SECTION_ASM_OP_32 "\t.rdata"
156 #define CONST_SECTION_ASM_OP_64 ".section\t.rodata"
157 #define CTORS_SECTION_ASM_OP    ".section\t.ctors,1,2,0,4"
158 #define DTORS_SECTION_ASM_OP    ".section\t.dtors,1,2,0,4"
159
160 /* This is the pseudo-op used to generate a 32-bit word of data with a
161    specific value in some section.  This is the same for all known svr4
162    assemblers.  */
163
164 #define INT_ASM_OP              ".word"
165
166 /* A default list of other sections which we might be "in" at any given
167    time.  For targets that use additional sections (e.g. .tdesc) you
168    should override this definition in the target-specific file which
169    includes this file.  */
170
171 #undef EXTRA_SECTIONS
172 #define EXTRA_SECTIONS in_sdata, in_rdata, in_const, in_ctors, in_dtors
173
174 /* A default list of extra section function definitions.  For targets
175    that use additional sections (e.g. .tdesc) you should override this
176    definition in the target-specific file which includes this file.  */
177
178 /* ??? rdata_section is now same as svr4 const_section.  */
179
180 #undef EXTRA_SECTION_FUNCTIONS
181 #define EXTRA_SECTION_FUNCTIONS                                         \
182 void                                                                    \
183 sdata_section ()                                                        \
184 {                                                                       \
185   if (in_section != in_sdata)                                           \
186     {                                                                   \
187       fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP);             \
188       in_section = in_sdata;                                            \
189     }                                                                   \
190 }                                                                       \
191                                                                         \
192 void                                                                    \
193 rdata_section ()                                                        \
194 {                                                                       \
195   if (in_section != in_rdata)                                           \
196     {                                                                   \
197       if (mips_abi != ABI_32)                                           \
198         fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP_64);        \
199       else                                                              \
200         fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP_32);        \
201       in_section = in_rdata;                                            \
202     }                                                                   \
203 }                                                                       \
204   CTORS_SECTION_FUNCTION                                                \
205   DTORS_SECTION_FUNCTION
206
207 #define CTORS_SECTION_FUNCTION                                          \
208 void                                                                    \
209 ctors_section ()                                                        \
210 {                                                                       \
211   if (in_section != in_ctors)                                           \
212     {                                                                   \
213       fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);             \
214       in_section = in_ctors;                                            \
215     }                                                                   \
216 }
217
218 #define DTORS_SECTION_FUNCTION                                          \
219 void                                                                    \
220 dtors_section ()                                                        \
221 {                                                                       \
222   if (in_section != in_dtors)                                           \
223     {                                                                   \
224       fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);             \
225       in_section = in_dtors;                                            \
226     }                                                                   \
227 }
228
229 #if 0
230
231 /* A C statement (sans semicolon) to output an element in the table of
232    global constructors.  */
233 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)                               \
234   do {                                                                  \
235     ctors_section ();                                                   \
236     fprintf (FILE, "\t%s\t ", INT_ASM_OP);                              \
237     assemble_name (FILE, NAME);                                         \
238     fprintf (FILE, "\n");                                               \
239   } while (0)
240
241 /* A C statement (sans semicolon) to output an element in the table of
242    global destructors.  */
243 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)                                \
244   do {                                                                  \
245     dtors_section ();                                                   \
246     fprintf (FILE, "\t%s\t ", INT_ASM_OP);                              \
247     assemble_name (FILE, NAME);                                         \
248     fprintf (FILE, "\n");                                               \
249   } while (0)
250
251 #endif
252
253 /* Stuff for constructors.  End here.  */
254
255 /* ??? Perhaps just include svr4.h in this file?  */
256
257 /* ??? SGI assembler may core dump when compiling with -g.
258    Sometimes as succeeds, but then we get a linker error. (cmds.c in 072.sc)
259    Getting rid of .file solves both problems.  */
260 #undef ASM_OUTPUT_FILENAME
261 #define ASM_OUTPUT_FILENAME(STREAM, NUM_SOURCE_FILENAMES, NAME) \
262 do                                                              \
263   {                                                             \
264     fprintf (STREAM, "\t#.file\t%d ", NUM_SOURCE_FILENAMES);    \
265     output_quoted_string (STREAM, NAME);                        \
266     fputs ("\n", STREAM);                                       \
267   }                                                             \
268 while (0)
269
270 /* ??? SGI assembler gives warning whenever .lcomm is used.  */
271 #undef ASM_OUTPUT_LOCAL
272 #define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN)     \
273 do                                                              \
274   {                                                             \
275     if (mips_abi != ABI_32)                                     \
276       {                                                         \
277         fputs ("\t.section\t.bss\n", STREAM);                   \
278         ASM_DECLARE_OBJECT_NAME (STREAM, NAME, 0);              \
279         ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT));  \
280         ASM_OUTPUT_SKIP (STREAM, SIZE);                         \
281         fprintf (STREAM, "\t%s\n", POPSECTION_ASM_OP);          \
282       }                                                         \
283     else                                                        \
284       mips_declare_object (STREAM, NAME, "\n\t.lcomm\t", ",%u\n", (SIZE)); \
285   }                                                             \
286 while (0)
287
288 #undef LOCAL_LABEL_PREFIX
289 #define LOCAL_LABEL_PREFIX (mips_abi == ABI_32 ? "$" : ".")
290
291 /* Profiling is supported via libprof1.a not -lc_p as in Irix 3.  */
292 /* ??? If no mabi=X option give, but a mipsX option is, then should depend
293    on the mipsX option.  */
294 #undef STARTFILE_SPEC
295 #undef STARTFILE_SPEC
296 #define STARTFILE_SPEC \
297   "%{mabi=32:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \
298    %{mabi=n32:%{pg:/usr/lib32/gcrt1.o%s}%{!pg:%{p:/usr/lib32/mcrt1.o%s /usr/lib32/libprof1.a%s}%{!p:/usr/lib32/crt1.o%s}}} \
299    %{mabi=64:%{pg:/usr/lib64/gcrt1.o}%{!pg:%{p:/usr/lib64/mcrt1.o /usr/lib64/libprof1.a}%{!p:/usr/lib64/crt1.o}}} \
300    %{!mabi=32:%{!mabi=n32:%{!mabi=64:%{pg:/usr/lib32/gcrt1.o%s}%{!pg:%{p:/usr/lib32/mcrt1.o%s /usr/lib32/libprof1.a%s}%{!p:/usr/lib32/crt1.o%s}}}}}"
301
302 #undef LIB_SPEC
303 #define LIB_SPEC "%{p:libprof1.a%s}%{pg:libprof1.a%s} -lc"
304
305 /* ??? If no mabi=X option give, but a mipsX option is, then should depend
306    on the mipsX option.  */
307 #undef ENDFILE_SPEC
308 #define ENDFILE_SPEC \
309   "%{mabi=32:crtn.o%s}%{mabi=n32:/usr/lib32/crtn.o%s}\
310    %{mabi=64:/usr/lib64/crtn.o}\
311    %{!mabi=32:%{!mabi=n32:%{!mabi=64:/usr/lib32/crtn.o%s}}}"
312
313 /* ??? If no mabi=X option give, but a mipsX option is, then should depend
314    on the mipsX option.  */
315 /* ??? We use the -woff 84 option to disable the warning about linking
316    with libraries that are unnecessary.  This message is currently more of
317    a hassle than a benefit, because we get two warnings for libgcc.a everytime
318    we link.  If we added the proper -dont_warn_unused/-warn_unused options
319    around libgcc.a, then we can take out the -woff 84 option.  */
320 #undef LINK_SPEC
321 #define LINK_SPEC "\
322 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
323 %{bestGnum} %{shared} %{non_shared} \
324 %{call_shared} %{no_archive} %{exact_version} \
325 %{!shared: %{!non_shared: %{!call_shared: -call_shared -no_unresolved}}} \
326 %{rpath} \
327 -_SYSTYPE_SVR4 -woff 84 \
328 %{mabi=32: -32}%{mabi=n32: -n32}%{mabi=64: -64} \
329 %{!mabi=32:%{!mabi=n32:%{!mabi=64: -n32}}}"