1 /* Definitions of target machine for GNU compiler. MIPS R4000 version with
2 GOFAST floating point library.
3 Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
5 This file is part of GNU CC.
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)
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.
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. */
22 #define OBJECT_FORMAT_ELF
24 /* Default to -mips3. */
25 #ifndef TARGET_DEFAULT
26 #define TARGET_DEFAULT MASK_FLOAT64|MASK_64BIT
29 #ifndef MIPS_ISA_DEFAULT
30 #define MIPS_ISA_DEFAULT 3
33 /* This should change to n32 when it is supported in gas. */
34 #ifndef MIPS_ABI_DEFAULT
35 #define MIPS_ABI_DEFAULT ABI_O64
38 /* Until we figure out what MIPS ELF targets normally use, just do
40 #ifndef PREFERRED_DEBUGGING_TYPE
41 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
44 /* US Software GOFAST library support. */
46 #define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
48 #include "mips/mips.h"
51 #define CPP_PREDEFINES "-Dmips -DMIPSEB -DR4000 -D_mips -D_MIPSEB -D_R4000"
53 /* I would rather put this in CPP_PREDEFINES, but the gcc driver
54 doesn't handle -U options in CPP_PREDEFINES. */
55 #undef SUBTARGET_CPP_SPEC
56 #define SUBTARGET_CPP_SPEC "\
57 %{!mips1:%{!mips2:-U__mips -D__mips=3 -D__mips64}}"
59 /* Use memcpy, et. al., rather than bcopy. */
60 #define TARGET_MEM_FUNCTIONS
62 /* Biggest alignment supported by the object file format of this
63 machine. Use this macro to limit the alignment which can be
64 specified using the `__attribute__ ((aligned (N)))' construct. If
65 not defined, the default value is `BIGGEST_ALIGNMENT'. */
67 #undef MAX_OFILE_ALIGNMENT
68 #define MAX_OFILE_ALIGNMENT (32768*8)
70 /* We need to use .esize and .etype instead of .size and .type to
71 avoid conflicting with ELF directives. */
73 #define PUT_SDB_SIZE(a) \
75 extern FILE *asm_out_text_file; \
76 fprintf (asm_out_text_file, "\t.esize\t"); \
77 fprintf (asm_out_text_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) (a)); \
78 fprintf (asm_out_text_file, ";"); \
82 #define PUT_SDB_TYPE(a) \
84 extern FILE *asm_out_text_file; \
85 fprintf (asm_out_text_file, "\t.etype\t0x%x;", (a)); \
88 /* Switch into a generic section. */
89 #undef TARGET_ASM_NAMED_SECTION
90 #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
92 /* Given that Irix has it's own headers, not having TARGET_GAS here
93 seems a mistake. If we actually need to be prepared for file
94 switching, then we need a custom TARGET_ASM_NAMED_SECTION too. */
97 #define TEXT_SECTION() \
99 if (TARGET_FILE_SWITCHING) \
101 fputs (TEXT_SECTION_ASM_OP, asm_out_file); \
102 fputc ('\n', asm_out_file); \
105 /* The following macro defines the format used to output the second
106 operand of the .type assembler directive. Different svr4 assemblers
107 expect various different forms for this operand. The one given here
108 is just a default. You may need to override it in your machine-
109 specific tm.h file (depending upon the particulars of your assembler). */
111 #define TYPE_OPERAND_FMT "@%s"
113 /* Define the strings used for the special svr4 .type and .size directives.
114 These strings generally do not vary from one system running svr4 to
115 another, but if a given system (e.g. m88k running svr) needs to use
116 different pseudo-op names for these, they may be overridden in the
117 file which includes this one. */
121 #define TYPE_ASM_OP "\t.type\t"
122 #define SIZE_ASM_OP "\t.size\t"
124 /* These macros generate the special .type and .size directives which
125 are used to set the corresponding fields of the linker symbol table
126 entries in an ELF object file under SVR4. These macros also output
127 the starting labels for the relevant functions/objects. */
129 /* Write the extra assembler code needed to declare an object properly. */
131 #undef ASM_DECLARE_OBJECT_NAME
132 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
134 fprintf (FILE, "%s", TYPE_ASM_OP); \
135 assemble_name (FILE, NAME); \
137 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
139 size_directive_output = 0; \
140 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
142 size_directive_output = 1; \
143 fprintf (FILE, "%s", SIZE_ASM_OP); \
144 assemble_name (FILE, NAME); \
145 fprintf (FILE, ","); \
146 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \
147 int_size_in_bytes (TREE_TYPE (DECL))); \
148 fprintf (FILE, "\n"); \
150 mips_declare_object (FILE, NAME, "", ":\n", 0); \
153 /* Output the size directive for a decl in rest_of_decl_compilation
154 in the case where we did not do so before the initializer.
155 Once we find the error_mark_node, we know that the value of
156 size_directive_output was set
157 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
159 #undef ASM_FINISH_DECLARE_OBJECT
160 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
162 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
163 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
164 && ! AT_END && TOP_LEVEL \
165 && DECL_INITIAL (DECL) == error_mark_node \
166 && !size_directive_output) \
168 size_directive_output = 1; \
169 fprintf (FILE, "%s", SIZE_ASM_OP); \
170 assemble_name (FILE, name); \
171 fprintf (FILE, ","); \
172 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \
173 int_size_in_bytes (TREE_TYPE (DECL))); \
174 fprintf (FILE, "\n"); \
178 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
179 do { fputc ( '\t', FILE); \
180 assemble_name (FILE, LABEL1); \
181 fputs ( " = ", FILE); \
182 assemble_name (FILE, LABEL2); \
183 fputc ( '\n', FILE); \
186 /* Note about .weak vs. .weakext
187 The mips native assemblers support .weakext, but not .weak.
188 mips-elf gas supports .weak, but not .weakext.
189 mips-elf gas has been changed to support both .weak and .weakext,
190 but until that support is generally available, the 'if' below
193 #undef ASM_WEAKEN_LABEL
194 #define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,0)
195 #define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \
198 fputs ("\t.weak\t", FILE); \
200 fputs ("\t.weakext\t", FILE); \
201 assemble_name (FILE, NAME); \
205 assemble_name (FILE, VALUE); \
207 fputc ('\n', FILE); \
210 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
211 #undef UNIQUE_SECTION
212 #define UNIQUE_SECTION(DECL,RELOC) \
213 mips_unique_section ((DECL), (RELOC))
215 /* A list of other sections which the compiler might be "in" at any
217 #undef EXTRA_SECTIONS
218 #define EXTRA_SECTIONS in_sdata, in_rdata
220 #undef EXTRA_SECTION_FUNCTIONS
221 #define EXTRA_SECTION_FUNCTIONS \
222 SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
223 SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP)
225 #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \
228 if (in_section != ENUM) \
230 fprintf (asm_out_file, "%s\n", OP); \
235 /* On elf, we *do* have support for the .init and .fini sections, and we
236 can put stuff in there to be executed before and after `main'. We let
237 crtstuff.c and other files know this by defining the following symbols.
238 The definitions say how to change sections to the .init and .fini
239 sections. This is the same for all known elf assemblers. */
241 #undef INIT_SECTION_ASM_OP
242 #define INIT_SECTION_ASM_OP "\t.section\t.init"
243 #undef FINI_SECTION_ASM_OP
244 #define FINI_SECTION_ASM_OP "\t.section\t.fini"
246 /* Don't set the target flags, this is done by the linker script */
250 #undef STARTFILE_SPEC
251 #define STARTFILE_SPEC "crti%O%s crtbegin%O%s %{!mno-crt0:crt0%O%s}"
254 #define ENDFILE_SPEC "crtend%O%s crtn%O%s"