]>
gcc.gnu.org Git - gcc.git/blob - gcc/config/mips/elf64.h
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 #define TARGET_DEFAULT MASK_FLOAT64|MASK_64BIT
26 #define MIPS_ISA_DEFAULT 3
28 /* This should change to n32 when it is supported in gas. */
29 #define MIPS_ABI_DEFAULT ABI_O64
31 /* Until we figure out what MIPS ELF targets normally use, just do
33 #ifndef PREFERRED_DEBUGGING_TYPE
34 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
37 /* US Software GOFAST library support. */
39 #define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
41 #include "mips/mips.h"
44 #define CPP_PREDEFINES "-Dmips -DMIPSEB -DR4000 -D_mips -D_MIPSEB -D_R4000"
46 /* I would rather put this in CPP_PREDEFINES, but the gcc driver
47 doesn't handle -U options in CPP_PREDEFINES. */
48 #undef SUBTARGET_CPP_SPEC
49 #define SUBTARGET_CPP_SPEC "\
50 %{!mips1:%{!mips2:-U__mips -D__mips=3 -D__mips64}}"
52 /* Use memcpy, et. al., rather than bcopy. */
53 #define TARGET_MEM_FUNCTIONS
55 /* Biggest alignment supported by the object file format of this
56 machine. Use this macro to limit the alignment which can be
57 specified using the `__attribute__ ((aligned (N)))' construct. If
58 not defined, the default value is `BIGGEST_ALIGNMENT'. */
60 #undef MAX_OFILE_ALIGNMENT
61 #define MAX_OFILE_ALIGNMENT (32768*8)
63 /* We need to use .esize and .etype instead of .size and .type to
64 avoid conflicting with ELF directives. */
66 #define PUT_SDB_SIZE(a) \
68 extern FILE *asm_out_text_file; \
69 fprintf (asm_out_text_file, "\t.esize\t"); \
70 fprintf (asm_out_text_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) (a)); \
71 fprintf (asm_out_text_file, ";"); \
75 #define PUT_SDB_TYPE(a) \
77 extern FILE *asm_out_text_file; \
78 fprintf (asm_out_text_file, "\t.etype\t0x%x;", (a)); \
81 /* Switch into a generic section. */
82 #undef TARGET_ASM_NAMED_SECTION
83 #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
85 /* Given that Irix has it's own headers, not having TARGET_GAS here
86 seems a mistake. If we actually need to be prepared for file
87 switching, then we need a custom TARGET_ASM_NAMED_SECTION too. */
90 #define TEXT_SECTION() \
92 if (TARGET_FILE_SWITCHING) \
94 fputs (TEXT_SECTION_ASM_OP, asm_out_file); \
95 fputc ('\n', asm_out_file); \
98 /* The following macro defines the format used to output the second
99 operand of the .type assembler directive. Different svr4 assemblers
100 expect various different forms for this operand. The one given here
101 is just a default. You may need to override it in your machine-
102 specific tm.h file (depending upon the particulars of your assembler). */
104 #define TYPE_OPERAND_FMT "@%s"
106 /* Define the strings used for the special svr4 .type and .size directives.
107 These strings generally do not vary from one system running svr4 to
108 another, but if a given system (e.g. m88k running svr) needs to use
109 different pseudo-op names for these, they may be overridden in the
110 file which includes this one. */
114 #define TYPE_ASM_OP "\t.type\t"
115 #define SIZE_ASM_OP "\t.size\t"
117 /* These macros generate the special .type and .size directives which
118 are used to set the corresponding fields of the linker symbol table
119 entries in an ELF object file under SVR4. These macros also output
120 the starting labels for the relevant functions/objects. */
122 /* Write the extra assembler code needed to declare an object properly. */
124 #undef ASM_DECLARE_OBJECT_NAME
125 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
127 fprintf (FILE, "%s", TYPE_ASM_OP); \
128 assemble_name (FILE, NAME); \
130 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
132 size_directive_output = 0; \
133 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
135 size_directive_output = 1; \
136 fprintf (FILE, "%s", SIZE_ASM_OP); \
137 assemble_name (FILE, NAME); \
138 fprintf (FILE, ","); \
139 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \
140 int_size_in_bytes (TREE_TYPE (DECL))); \
141 fprintf (FILE, "\n"); \
143 mips_declare_object (FILE, NAME, "", ":\n", 0); \
146 /* Output the size directive for a decl in rest_of_decl_compilation
147 in the case where we did not do so before the initializer.
148 Once we find the error_mark_node, we know that the value of
149 size_directive_output was set
150 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
152 #undef ASM_FINISH_DECLARE_OBJECT
153 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
155 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
156 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
157 && ! AT_END && TOP_LEVEL \
158 && DECL_INITIAL (DECL) == error_mark_node \
159 && !size_directive_output) \
161 size_directive_output = 1; \
162 fprintf (FILE, "%s", SIZE_ASM_OP); \
163 assemble_name (FILE, name); \
164 fprintf (FILE, ","); \
165 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \
166 int_size_in_bytes (TREE_TYPE (DECL))); \
167 fprintf (FILE, "\n"); \
171 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
172 do { fputc ( '\t', FILE); \
173 assemble_name (FILE, LABEL1); \
174 fputs ( " = ", FILE); \
175 assemble_name (FILE, LABEL2); \
176 fputc ( '\n', FILE); \
179 /* Note about .weak vs. .weakext
180 The mips native assemblers support .weakext, but not .weak.
181 mips-elf gas supports .weak, but not .weakext.
182 mips-elf gas has been changed to support both .weak and .weakext,
183 but until that support is generally available, the 'if' below
186 #undef ASM_WEAKEN_LABEL
187 #define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,0)
188 #define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \
191 fputs ("\t.weak\t", FILE); \
193 fputs ("\t.weakext\t", FILE); \
194 assemble_name (FILE, NAME); \
198 assemble_name (FILE, VALUE); \
200 fputc ('\n', FILE); \
203 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
204 #undef UNIQUE_SECTION
205 #define UNIQUE_SECTION(DECL,RELOC) \
207 int len, size, sec; \
208 const char *name, *prefix; \
210 static const char *const prefixes[4][2] = { \
211 { ".text.", ".gnu.linkonce.t." }, \
212 { ".rodata.", ".gnu.linkonce.r." }, \
213 { ".data.", ".gnu.linkonce.d." }, \
214 { ".sdata.", ".gnu.linkonce.s." } \
217 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
218 size = int_size_in_bytes (TREE_TYPE (decl)); \
220 /* Determine the base section we are interested in: \
221 0=text, 1=rodata, 2=data, 3=sdata, [4=bss]. */ \
222 if (TREE_CODE (DECL) == FUNCTION_DECL) \
224 else if (DECL_INITIAL (DECL) == 0 \
225 || DECL_INITIAL (DECL) == error_mark_node) \
227 else if ((TARGET_EMBEDDED_PIC || TARGET_MIPS16) \
228 && TREE_CODE (decl) == STRING_CST \
229 && !flag_writable_strings) \
231 /* For embedded position independent code, put constant strings \
232 in the text section, because the data section is limited to \
233 64K in size. For mips16 code, put strings in the text \
234 section so that a PC relative load instruction can be used to \
235 get their address. */ \
238 else if (TARGET_EMBEDDED_DATA) \
240 /* For embedded applications, always put an object in read-only data \
241 if possible, in order to reduce RAM usage. */ \
243 if (DECL_READONLY_SECTION (DECL, RELOC)) \
245 else if (size > 0 && size <= mips_section_threshold) \
252 /* For hosted applications, always put an object in small data if \
253 possible, as this gives the best performance. */ \
255 if (size > 0 && size <= mips_section_threshold) \
257 else if (DECL_READONLY_SECTION (DECL, RELOC)) \
263 prefix = prefixes[sec][DECL_ONE_ONLY (DECL)]; \
264 len = strlen (name) + strlen (prefix); \
265 string = alloca (len + 1); \
266 sprintf (string, "%s%s", prefix, name); \
268 DECL_SECTION_NAME (DECL) = build_string (len, string); \
271 /* A list of other sections which the compiler might be "in" at any
273 #undef EXTRA_SECTIONS
274 #define EXTRA_SECTIONS in_sdata, in_rdata
276 #undef EXTRA_SECTION_FUNCTIONS
277 #define EXTRA_SECTION_FUNCTIONS \
278 SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
279 SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP)
281 #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \
284 if (in_section != ENUM) \
286 fprintf (asm_out_file, "%s\n", OP); \
291 /* On elf, we *do* have support for the .init and .fini sections, and we
292 can put stuff in there to be executed before and after `main'. We let
293 crtstuff.c and other files know this by defining the following symbols.
294 The definitions say how to change sections to the .init and .fini
295 sections. This is the same for all known elf assemblers. */
297 #undef INIT_SECTION_ASM_OP
298 #define INIT_SECTION_ASM_OP "\t.section\t.init"
299 #undef FINI_SECTION_ASM_OP
300 #define FINI_SECTION_ASM_OP "\t.section\t.fini"
302 /* Don't set the target flags, this is done by the linker script */
306 #undef STARTFILE_SPEC
307 #define STARTFILE_SPEC "crti%O%s crtbegin%O%s %{!mno-crt0:crt0%O%s}"
310 #define ENDFILE_SPEC "crtend%O%s crtn%O%s"
This page took 0.053212 seconds and 6 git commands to generate.