]> gcc.gnu.org Git - gcc.git/blob - gcc/config/mips/elf64.h
elf.h (STARTFILE_SPEC): Undo previous change.
[gcc.git] / 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, 2002
4 Free Software Foundation, Inc.
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
22
23 #define OBJECT_FORMAT_ELF
24
25 /* Default to -mips3. */
26 #ifndef TARGET_DEFAULT
27 #define TARGET_DEFAULT MASK_FLOAT64|MASK_64BIT
28 #endif
29
30 #ifndef MIPS_ISA_DEFAULT
31 #define MIPS_ISA_DEFAULT 3
32 #endif
33
34 /* This should change to n32 when it is supported in gas. */
35 #ifndef MIPS_ABI_DEFAULT
36 #define MIPS_ABI_DEFAULT ABI_O64
37 #endif
38
39 /* Until we figure out what MIPS ELF targets normally use, just do
40 stabs in ELF. */
41 #ifndef PREFERRED_DEBUGGING_TYPE
42 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
43 #endif
44
45 /* US Software GOFAST library support. */
46 #include "gofast.h"
47 #define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
48
49 #include "mips/mips.h"
50
51 /* Use memcpy, et. al., rather than bcopy. */
52 #define TARGET_MEM_FUNCTIONS
53
54 /* Biggest alignment supported by the object file format of this
55 machine. Use this macro to limit the alignment which can be
56 specified using the `__attribute__ ((aligned (N)))' construct. If
57 not defined, the default value is `BIGGEST_ALIGNMENT'. */
58
59 #undef MAX_OFILE_ALIGNMENT
60 #define MAX_OFILE_ALIGNMENT (32768*8)
61
62 /* We need to use .esize and .etype instead of .size and .type to
63 avoid conflicting with ELF directives. */
64 #undef PUT_SDB_SIZE
65 #define PUT_SDB_SIZE(a) \
66 do { \
67 extern FILE *asm_out_text_file; \
68 fprintf (asm_out_text_file, "\t.esize\t"); \
69 fprintf (asm_out_text_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) (a)); \
70 fprintf (asm_out_text_file, ";"); \
71 } while (0)
72
73 #undef PUT_SDB_TYPE
74 #define PUT_SDB_TYPE(a) \
75 do { \
76 extern FILE *asm_out_text_file; \
77 fprintf (asm_out_text_file, "\t.etype\t0x%x;", (a)); \
78 } while (0)
79
80 /* Switch into a generic section. */
81 #undef TARGET_ASM_NAMED_SECTION
82 #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
83
84 /* Given that Irix has it's own headers, not having TARGET_GAS here
85 seems a mistake. If we actually need to be prepared for file
86 switching, then we need a custom TARGET_ASM_NAMED_SECTION too. */
87
88 #undef TEXT_SECTION
89 #define TEXT_SECTION() \
90 do { \
91 if (TARGET_FILE_SWITCHING) \
92 abort (); \
93 fputs (TEXT_SECTION_ASM_OP, asm_out_file); \
94 fputc ('\n', asm_out_file); \
95 } while (0)
96
97 /* The following macro defines the format used to output the second
98 operand of the .type assembler directive. Different svr4 assemblers
99 expect various different forms for this operand. The one given here
100 is just a default. You may need to override it in your machine-
101 specific tm.h file (depending upon the particulars of your assembler). */
102
103 #define TYPE_OPERAND_FMT "@%s"
104
105 /* Define the strings used for the special svr4 .type and .size directives.
106 These strings generally do not vary from one system running svr4 to
107 another, but if a given system (e.g. m88k running svr) needs to use
108 different pseudo-op names for these, they may be overridden in the
109 file which includes this one. */
110
111 #undef TYPE_ASM_OP
112 #undef SIZE_ASM_OP
113 #define TYPE_ASM_OP "\t.type\t"
114 #define SIZE_ASM_OP "\t.size\t"
115
116 /* These macros generate the special .type and .size directives which
117 are used to set the corresponding fields of the linker symbol table
118 entries in an ELF object file under SVR4. These macros also output
119 the starting labels for the relevant functions/objects. */
120
121 /* Write the extra assembler code needed to declare an object properly. */
122
123 #undef ASM_DECLARE_OBJECT_NAME
124 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
125 do { \
126 fprintf (FILE, "%s", TYPE_ASM_OP); \
127 assemble_name (FILE, NAME); \
128 putc (',', FILE); \
129 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
130 putc ('\n', FILE); \
131 size_directive_output = 0; \
132 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
133 { \
134 size_directive_output = 1; \
135 fprintf (FILE, "%s", SIZE_ASM_OP); \
136 assemble_name (FILE, NAME); \
137 fprintf (FILE, ","); \
138 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \
139 int_size_in_bytes (TREE_TYPE (DECL))); \
140 fprintf (FILE, "\n"); \
141 } \
142 mips_declare_object (FILE, NAME, "", ":\n", 0); \
143 } while (0)
144
145 /* Output the size directive for a decl in rest_of_decl_compilation
146 in the case where we did not do so before the initializer.
147 Once we find the error_mark_node, we know that the value of
148 size_directive_output was set
149 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
150
151 #undef ASM_FINISH_DECLARE_OBJECT
152 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
153 do { \
154 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
155 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
156 && ! AT_END && TOP_LEVEL \
157 && DECL_INITIAL (DECL) == error_mark_node \
158 && !size_directive_output) \
159 { \
160 size_directive_output = 1; \
161 fprintf (FILE, "%s", SIZE_ASM_OP); \
162 assemble_name (FILE, name); \
163 fprintf (FILE, ","); \
164 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \
165 int_size_in_bytes (TREE_TYPE (DECL))); \
166 fprintf (FILE, "\n"); \
167 } \
168 } while (0)
169
170 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
171 do { fputc ( '\t', FILE); \
172 assemble_name (FILE, LABEL1); \
173 fputs ( " = ", FILE); \
174 assemble_name (FILE, LABEL2); \
175 fputc ( '\n', FILE); \
176 } while (0)
177
178 /* Note about .weak vs. .weakext
179 The mips native assemblers support .weakext, but not .weak.
180 mips-elf gas supports .weak, but not .weakext.
181 mips-elf gas has been changed to support both .weak and .weakext,
182 but until that support is generally available, the 'if' below
183 should serve. */
184
185 #undef ASM_WEAKEN_LABEL
186 #define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,0)
187 #define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \
188 do { \
189 if (TARGET_GAS) \
190 fputs ("\t.weak\t", FILE); \
191 else \
192 fputs ("\t.weakext\t", FILE); \
193 assemble_name (FILE, NAME); \
194 if (VALUE) \
195 { \
196 fputc (' ', FILE); \
197 assemble_name (FILE, VALUE); \
198 } \
199 fputc ('\n', FILE); \
200 } while (0)
201
202 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
203
204 #define TARGET_ASM_UNIQUE_SECTION mips_unique_section
205
206 /* A list of other sections which the compiler might be "in" at any
207 given time. */
208 #undef EXTRA_SECTIONS
209 #define EXTRA_SECTIONS in_sdata
210
211 #undef EXTRA_SECTION_FUNCTIONS
212 #define EXTRA_SECTION_FUNCTIONS \
213 SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP)
214
215 #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \
216 void FN () \
217 { \
218 if (in_section != ENUM) \
219 { \
220 fprintf (asm_out_file, "%s\n", OP); \
221 in_section = ENUM; \
222 } \
223 }
224
225 /* On elf, we *do* have support for the .init and .fini sections, and we
226 can put stuff in there to be executed before and after `main'. We let
227 crtstuff.c and other files know this by defining the following symbols.
228 The definitions say how to change sections to the .init and .fini
229 sections. This is the same for all known elf assemblers. */
230
231 #undef INIT_SECTION_ASM_OP
232 #define INIT_SECTION_ASM_OP "\t.section\t.init"
233 #undef FINI_SECTION_ASM_OP
234 #define FINI_SECTION_ASM_OP "\t.section\t.fini"
235
236 /* Don't set the target flags, this is done by the linker script */
237 #undef LIB_SPEC
238 #define LIB_SPEC ""
239
240 #undef STARTFILE_SPEC
241 #define STARTFILE_SPEC "crti%O%s crtbegin%O%s %{!mno-crt0:crt0%O%s}"
242
243 #undef ENDFILE_SPEC
244 #define ENDFILE_SPEC "crtend%O%s crtn%O%s"
This page took 0.049988 seconds and 6 git commands to generate.