OSDN Git Service

Change FSF address.
[pf3gnuchains/gcc-fork.git] / gcc / config / mips / iris6.h
1 /* Definitions of target machine for GNU compiler.  Iris version 6.
2    Copyright (C) 1994 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 /* Irix 6 uses DWARF.  */
22 #define DWARF_DEBUGGING_INFO
23 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
24
25 /* Default to -mips4.  */
26 #define TARGET_DEFAULT MASK_ABICALLS|MASK_FLOAT64|MASK_64BIT
27 #define MIPS_ISA_DEFAULT 4
28
29 #include "mips/iris5gas.h"
30 #include "mips/abi64.h"
31
32 /* The Irix 6.0.1 assembler doesn't like labels in the text section, so
33    just avoid emitting them.  */
34 #define ASM_IDENTIFY_GCC
35 #define ASM_IDENTIFY_LANGUAGE
36
37 /* Irix 5 stuff that we don't need for Irix 6.  */
38 #undef ASM_OUTPUT_UNDEF_FUNCTION
39 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
40 #undef ASM_DECLARE_FUNCTION_SIZE
41
42 /* Stuff we need for Irix 6 that isn't in Irix 5.  */
43
44 #undef SET_ASM_OP       /* Has no equivalent.  See ASM_OUTPUT_DEF below.  */
45
46 /* This is how to equate one symbol to another symbol.  The syntax used is
47    `SYM1=SYM2'.  Note that this is different from the way equates are done
48    with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'.  */
49
50 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
51  do {   fprintf ((FILE), "\t");                                         \
52         assemble_name (FILE, LABEL1);                                   \
53         fprintf (FILE, " = ");                                          \
54         assemble_name (FILE, LABEL2);                                   \
55         fprintf (FILE, "\n");                                           \
56   } while (0)
57
58 #define POPSECTION_ASM_OP       ".popsection"
59
60 /* To enable use of init and fini sections.  */
61 #define INIT_SECTION_ASM_OP     ".section\t.init"
62 #undef LD_INIT_SWITCH
63 #undef LD_FINI_SWITCH
64 #undef HAS_INIT_SECTION
65
66 #define DEBUG_SECTION           ".debug,1,0,0,1"
67 #define LINE_SECTION            ".line,1,0,0,1"
68 #define SFNAMES_SECTION         ".debug_sfnames,1,0,0,1"
69 #define SRCINFO_SECTION         ".debug_srcinfo,1,0,0,1"
70 #define MACINFO_SECTION         ".debug_macinfo,1,0,0,1"
71 #define PUBNAMES_SECTION        ".debug_pubnames,1,0,0,1"
72 #define ARANGES_SECTION         ".debug_aranges,1,0,0,1"
73
74 #undef ASM_SPEC
75 #if ((TARGET_CPU_DEFAULT | TARGET_DEFAULT) & MASK_GAS) != 0
76 /* GAS */
77 #define ASM_SPEC "\
78 %{mmips-as: \
79         %{!.s:-nocpp} %{.s: %{cpp} %{nocpp}} \
80         %{pipe: %e-pipe is not supported.} \
81         %{K}} \
82 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} %{v} \
83 %{noasmopt:-O0} \
84 %{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}} \
85 %{g} %{g0} %{g1} %{g2} %{g3} \
86 %{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \
87 %{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \
88 %{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \
89 %{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3} \
90 %{membedded-pic}"
91
92 #else
93 /* not GAS */
94 /* Must pass -g0 to the assembler, otherwise it may overwrite our
95    debug info with its own debug info. */
96 /* Must pass -show instead of -v.  */
97 /* Must pass -G 0 to the assembler, otherwise we may get warnings about
98    GOT overflow.  */
99 #define ASM_SPEC "\
100 %{!mgas: \
101         %{!.s:-nocpp} %{.s: %{cpp} %{nocpp}} \
102         %{pipe: %e-pipe is not supported.} \
103         %{K}} \
104 %{G*} %{EB} %{EL} %{v:-show} \
105 %{mips1} %{mips2} %{mips3} %{mips4} \
106 %{!mips1: %{!mips2: %{!mips3: %{!mips4: -mips4}}}} \
107 %{noasmopt:-O0} %{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}} \
108 -g0 -G 0 %{membedded-pic}"
109
110 #endif
111
112 /* Stuff for constructors.  Start here.  */
113
114 #define CONST_SECTION_ASM_OP_32 "\t.rdata"
115 #define CONST_SECTION_ASM_OP_64 ".section\t.rodata"
116 #define CTORS_SECTION_ASM_OP    ".section\t.ctors,1,2,0,4"
117 #define DTORS_SECTION_ASM_OP    ".section\t.dtors,1,2,0,4"
118
119 /* This is the pseudo-op used to generate a 32-bit word of data with a
120    specific value in some section.  This is the same for all known svr4
121    assemblers.  */
122
123 #define INT_ASM_OP              ".word"
124
125 /* A default list of other sections which we might be "in" at any given
126    time.  For targets that use additional sections (e.g. .tdesc) you
127    should override this definition in the target-specific file which
128    includes this file.  */
129
130 #undef EXTRA_SECTIONS
131 #define EXTRA_SECTIONS in_sdata, in_rdata, in_const, in_ctors, in_dtors, in_bss
132
133 /* A default list of extra section function definitions.  For targets
134    that use additional sections (e.g. .tdesc) you should override this
135    definition in the target-specific file which includes this file.  */
136
137 /* ??? rdata_section is now same as svr4 const_section.  */
138
139 #undef EXTRA_SECTION_FUNCTIONS
140 #define EXTRA_SECTION_FUNCTIONS                                         \
141 void                                                                    \
142 sdata_section ()                                                        \
143 {                                                                       \
144   if (in_section != in_sdata)                                           \
145     {                                                                   \
146       fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP);             \
147       in_section = in_sdata;                                            \
148     }                                                                   \
149 }                                                                       \
150                                                                         \
151 void                                                                    \
152 rdata_section ()                                                        \
153 {                                                                       \
154   if (in_section != in_rdata)                                           \
155     {                                                                   \
156       if (mips_isa >= 3)                                                \
157         fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP_64);        \
158       else                                                              \
159         fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP_32);        \
160       in_section = in_rdata;                                            \
161     }                                                                   \
162 }                                                                       \
163   CTORS_SECTION_FUNCTION                                                \
164   DTORS_SECTION_FUNCTION
165
166 #define CTORS_SECTION_FUNCTION                                          \
167 void                                                                    \
168 ctors_section ()                                                        \
169 {                                                                       \
170   if (in_section != in_ctors)                                           \
171     {                                                                   \
172       fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);             \
173       in_section = in_ctors;                                            \
174     }                                                                   \
175 }
176
177 #define DTORS_SECTION_FUNCTION                                          \
178 void                                                                    \
179 dtors_section ()                                                        \
180 {                                                                       \
181   if (in_section != in_dtors)                                           \
182     {                                                                   \
183       fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);             \
184       in_section = in_dtors;                                            \
185     }                                                                   \
186 }
187
188 /* A C statement (sans semicolon) to output an element in the table of
189    global constructors.  */
190 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)                               \
191   do {                                                                  \
192     ctors_section ();                                                   \
193     fprintf (FILE, "\t%s\t ", INT_ASM_OP);                              \
194     assemble_name (FILE, NAME);                                         \
195     fprintf (FILE, "\n");                                               \
196   } while (0)
197
198 /* A C statement (sans semicolon) to output an element in the table of
199    global destructors.  */
200 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)                                \
201   do {                                                                  \
202     dtors_section ();                                                   \
203     fprintf (FILE, "\t%s\t ", INT_ASM_OP);                              \
204     assemble_name (FILE, NAME);                                         \
205     fprintf (FILE, "\n");                                               \
206   } while (0)
207
208 /* Stuff for constructors.  End here.  */
209
210 /* ??? Perhaps just include svr4.h in this file?  */
211
212 /* ??? SGI assembler may core dump when compiling with -g.
213    Sometimes as succeeds, but then we get a linker error. (cmds.c in 072.sc)
214    Getting rid of .file solves both problems.  */
215 #undef ASM_OUTPUT_FILENAME
216 #define ASM_OUTPUT_FILENAME(STREAM, NUM_SOURCE_FILENAMES, NAME) \
217 do                                                              \
218   {                                                             \
219     fprintf (STREAM, "\t#.file\t%d ", NUM_SOURCE_FILENAMES);    \
220     output_quoted_string (STREAM, NAME);                        \
221     fputs ("\n", STREAM);                                       \
222   }                                                             \
223 while (0)
224
225 /* ??? SGI assembler gives warning whenever .lcomm is used.  */
226 #undef ASM_OUTPUT_LOCAL
227 #define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN)     \
228 do                                                              \
229   {                                                             \
230     if (mips_isa >= 3)                                          \
231       {                                                         \
232         fputs ("\t.section\t.bss\n", STREAM);                   \
233         ASM_DECLARE_OBJECT_NAME (STREAM, NAME, 0);              \
234         ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT));  \
235         ASM_OUTPUT_SKIP (STREAM, SIZE);                         \
236         fprintf (STREAM, "\t%s\n", POPSECTION_ASM_OP);          \
237       }                                                         \
238     else                                                        \
239       mips_declare_object (STREAM, NAME, "\n\t.lcomm\t", ",%u\n", (SIZE)); \
240   }                                                             \
241 while (0)
242
243 #undef ASM_OUTPUT_INTERNAL_LABEL
244 #define ASM_OUTPUT_INTERNAL_LABEL(STREAM,PREFIX,NUM)                    \
245   fprintf (STREAM, ".%s%d:\n", PREFIX, NUM)
246
247 /* This is how to store into the string LABEL
248    the symbol_ref name of an internal numbered label where
249    PREFIX is the class of label and NUM is the number within the class.
250    This is suitable for output with `assemble_name'.  */
251
252 #undef ASM_GENERATE_INTERNAL_LABEL
253 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)                   \
254   sprintf (LABEL, "*.%s%d", PREFIX, NUM)
255
256 #undef STARTFILE_SPEC
257 /* Profiling is supported via libprof1.a not -lc_p as in Irix 3.  */
258 #undef STARTFILE_SPEC
259 #define STARTFILE_SPEC \
260   "%{mips1:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \
261    %{mips2:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \
262    %{!mips1:%{!mips2:%{pg:/usr/lib64/gcrt1.o}%{!pg:%{p:/usr/lib64/mcrt1.o /usr/lib64/libprof1.a}%{!p:/usr/lib64/crt1.o}}}}"
263
264 #undef LIB_SPEC
265 #define LIB_SPEC "%{p:libprof1.a%s}%{pg:libprof1.a%s} -lc"
266
267 #undef ENDFILE_SPEC
268 #define ENDFILE_SPEC \
269   "%{mips1:crtn.o%s}%{mips2:crtn.o%s}%{!mips1:%{!mips2:/usr/lib64/crtn.o}}"
270
271 #undef LINK_SPEC
272 #define LINK_SPEC "\
273 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
274 %{bestGnum} %{shared} %{non_shared} \
275 %{call_shared} %{no_archive} %{exact_version} \
276 %{!shared: %{!non_shared: %{!call_shared: -call_shared -no_unresolved}}} \
277 -_SYSTYPE_SVR4"
278
279 /* ??? Debugging does not work.  We get many assembler core dumps,
280    and even some linker core dumps.  */
281 #undef DBX_DEBUGGING_INFO
282 #undef SDB_DEBUGGING_INFO
283 #undef MIPS_DEBUGGING_INFO
284 #undef DWARF_DEBUGGING_INFO
285 #undef PREFERRED_DEBUGGING_TYPE