1 /* Definitions of target machine for GNU compiler. MIPS R3000 version with
2 GOFAST floating point library.
3 Copyright (C) 1994, 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. */
23 #define OBJECT_FORMAT_ELF
25 /* Until we figure out what MIPS ELF targets normally use, just do
27 #ifndef PREFERRED_DEBUGGING_TYPE
28 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
31 /* Mostly like ECOFF. */
33 #include "mips/ecoff.h"
35 /* We need to use .esize and .etype instead of .size and .type to
36 avoid conflicting with ELF directives. */
38 #define PUT_SDB_SIZE(a) \
40 extern FILE *asm_out_text_file; \
41 fprintf (asm_out_text_file, "\t.esize\t%d;", (a)); \
45 #define PUT_SDB_TYPE(a) \
47 extern FILE *asm_out_text_file; \
48 fprintf (asm_out_text_file, "\t.etype\t0x%x;", (a)); \
51 /* Biggest alignment supported by the object file format of this
52 machine. Use this macro to limit the alignment which can be
53 specified using the `__attribute__ ((aligned (N)))' construct. If
54 not defined, the default value is `BIGGEST_ALIGNMENT'. */
56 #undef MAX_OFILE_ALIGNMENT
57 #define MAX_OFILE_ALIGNMENT (32768*8)
59 /* Switch into a generic section. */
60 #undef TARGET_ASM_NAMED_SECTION
61 #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
63 /* The following macro defines the format used to output the second
64 operand of the .type assembler directive. Different svr4 assemblers
65 expect various different forms for this operand. The one given here
66 is just a default. You may need to override it in your machine-
67 specific tm.h file (depending upon the particulars of your assembler). */
69 #define TYPE_OPERAND_FMT "@%s"
71 /* Define the strings used for the special svr4 .type and .size directives.
72 These strings generally do not vary from one system running svr4 to
73 another, but if a given system (e.g. m88k running svr) needs to use
74 different pseudo-op names for these, they may be overridden in the
75 file which includes this one. */
79 #define TYPE_ASM_OP "\t.type\t"
80 #define SIZE_ASM_OP "\t.size\t"
82 /* If defined, a C expression whose value is a string containing the
83 assembler operation to identify the following data as
84 uninitialized global data. If not defined, and neither
85 `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
86 uninitialized global data will be output in the data section if
87 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
89 #ifndef BSS_SECTION_ASM_OP
90 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
93 #define SBSS_SECTION_ASM_OP "\t.section .sbss"
95 /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
96 separate, explicit argument. If you define this macro, it is used
97 in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
98 handling the required alignment of the variable. The alignment is
99 specified as the number of bits.
101 Try to use function `asm_output_aligned_bss' defined in file
102 `varasm.c' when defining this macro. */
103 #ifndef ASM_OUTPUT_ALIGNED_BSS
104 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
106 ASM_GLOBALIZE_LABEL (FILE, NAME); \
107 if (SIZE > 0 && SIZE <= mips_section_threshold) \
111 ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \
112 last_assemble_variable_decl = DECL; \
113 ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL); \
114 ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1); \
118 /* These macros generate the special .type and .size directives which
119 are used to set the corresponding fields of the linker symbol table
120 entries in an ELF object file under SVR4. These macros also output
121 the starting labels for the relevant functions/objects. */
123 /* Write the extra assembler code needed to declare an object properly. */
125 #undef ASM_DECLARE_OBJECT_NAME
126 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
128 fprintf (FILE, "%s", TYPE_ASM_OP); \
129 assemble_name (FILE, NAME); \
131 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
133 size_directive_output = 0; \
134 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
136 size_directive_output = 1; \
137 fprintf (FILE, "%s", SIZE_ASM_OP); \
138 assemble_name (FILE, NAME); \
139 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
141 mips_declare_object (FILE, NAME, "", ":\n", 0); \
144 /* Output the size directive for a decl in rest_of_decl_compilation
145 in the case where we did not do so before the initializer.
146 Once we find the error_mark_node, we know that the value of
147 size_directive_output was set
148 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
150 #undef ASM_FINISH_DECLARE_OBJECT
151 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
153 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
154 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
155 && ! AT_END && TOP_LEVEL \
156 && DECL_INITIAL (DECL) == error_mark_node \
157 && !size_directive_output) \
159 size_directive_output = 1; \
160 fprintf (FILE, "%s", SIZE_ASM_OP); \
161 assemble_name (FILE, name); \
162 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
166 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
167 do { fputc ( '\t', FILE); \
168 assemble_name (FILE, LABEL1); \
169 fputs ( " = ", FILE); \
170 assemble_name (FILE, LABEL2); \
171 fputc ( '\n', FILE); \
174 /* Note about .weak vs. .weakext
175 The mips native assemblers support .weakext, but not .weak.
176 mips-elf gas supports .weak, but not .weakext.
177 mips-elf gas has been changed to support both .weak and .weakext,
178 but until that support is generally available, the 'if' below
181 #undef ASM_WEAKEN_LABEL
182 #define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,0)
183 #define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \
186 fputs ("\t.weak\t", FILE); \
188 fputs ("\t.weakext\t", FILE); \
189 assemble_name (FILE, NAME); \
193 assemble_name (FILE, VALUE); \
195 fputc ('\n', FILE); \
198 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
199 #undef UNIQUE_SECTION
200 #define UNIQUE_SECTION(DECL,RELOC) \
201 mips_unique_section ((DECL), (RELOC))
203 /* There's no point providing a default definition of __CTOR_LIST__
204 since people are expected either to use crtbegin.o, or an equivalent,
205 or provide their own definition. */
206 #define CTOR_LISTS_DEFINED_EXTERNALLY
208 /* A list of other sections which the compiler might be "in" at any
210 #undef EXTRA_SECTIONS
211 #define EXTRA_SECTIONS in_sdata, in_sbss, in_rdata
215 #undef EXTRA_SECTION_FUNCTIONS
216 #define EXTRA_SECTION_FUNCTIONS \
217 SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
218 SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) \
219 SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP)
221 #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \
224 if (in_section != ENUM) \
226 fprintf (asm_out_file, "%s\n", OP); \
231 /* Don't set the target flags, this is done by the linker script */
235 #undef STARTFILE_SPEC
236 #define STARTFILE_SPEC "crtbegin%O%s %{!mno-crt0:crt0%O%s}"
239 #define ENDFILE_SPEC "crtend%O%s"