]>
Commit | Line | Data |
---|---|---|
3185dc73 DE |
1 | /* Definitions of target machine for GNU compiler. MIPS R4000 version with |
2 | GOFAST floating point library. | |
ae46c4e0 RH |
3 | Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2002 |
4 | Free Software Foundation, Inc. | |
3185dc73 DE |
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 | |
0e29e3c9 RK |
20 | the Free Software Foundation, 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. */ | |
3185dc73 | 22 | |
6d439235 EC |
23 | #undef OBJECT_FORMAT_COFF |
24 | #undef EXTENDED_COFF | |
3185dc73 DE |
25 | #define OBJECT_FORMAT_ELF |
26 | ||
6d439235 | 27 | #undef SDB_DEBUGGING_INFO |
23532de9 JT |
28 | #define DBX_DEBUGGING_INFO 1 |
29 | #define DWARF2_DEBUGGING_INFO 1 | |
54401342 | 30 | |
6d439235 EC |
31 | #undef PREFERRED_DEBUGGING_TYPE |
32 | #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG | |
e0e00329 | 33 | |
6d439235 EC |
34 | #undef SUBTARGET_ASM_DEBUGGING_SPEC |
35 | #define SUBTARGET_ASM_DEBUGGING_SPEC "-g0" | |
3185dc73 | 36 | |
a211c7b9 MM |
37 | /* Biggest alignment supported by the object file format of this |
38 | machine. Use this macro to limit the alignment which can be | |
39 | specified using the `__attribute__ ((aligned (N)))' construct. If | |
40 | not defined, the default value is `BIGGEST_ALIGNMENT'. */ | |
41 | ||
44404b8b | 42 | #undef MAX_OFILE_ALIGNMENT |
a211c7b9 MM |
43 | #define MAX_OFILE_ALIGNMENT (32768*8) |
44 | ||
7c262518 RH |
45 | /* Switch into a generic section. */ |
46 | #undef TARGET_ASM_NAMED_SECTION | |
47 | #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section | |
a0281dae | 48 | |
f99ffb60 RH |
49 | /* Given that Irix has it's own headers, not having TARGET_GAS here |
50 | seems a mistake. If we actually need to be prepared for file | |
51 | switching, then we need a custom TARGET_ASM_NAMED_SECTION too. */ | |
52 | ||
53 | #undef TEXT_SECTION | |
32fa4d4a RH |
54 | #define TEXT_SECTION() \ |
55 | do { \ | |
56 | if (TARGET_FILE_SWITCHING) \ | |
57 | abort (); \ | |
58 | fputs (TEXT_SECTION_ASM_OP, asm_out_file); \ | |
59 | fputc ('\n', asm_out_file); \ | |
f99ffb60 RH |
60 | } while (0) |
61 | ||
674576f1 RH |
62 | /* The following macro defines the format used to output the second |
63 | operand of the .type assembler directive. Different svr4 assemblers | |
64 | expect various different forms for this operand. The one given here | |
65 | is just a default. You may need to override it in your machine- | |
66 | specific tm.h file (depending upon the particulars of your assembler). */ | |
67 | ||
68 | #define TYPE_OPERAND_FMT "@%s" | |
69 | ||
70 | /* Define the strings used for the special svr4 .type and .size directives. | |
71 | These strings generally do not vary from one system running svr4 to | |
72 | another, but if a given system (e.g. m88k running svr) needs to use | |
73 | different pseudo-op names for these, they may be overridden in the | |
74 | file which includes this one. */ | |
75 | ||
76 | #undef TYPE_ASM_OP | |
77 | #undef SIZE_ASM_OP | |
78d057d8 HPN |
78 | #define TYPE_ASM_OP "\t.type\t" |
79 | #define SIZE_ASM_OP "\t.size\t" | |
674576f1 RH |
80 | |
81 | /* These macros generate the special .type and .size directives which | |
82 | are used to set the corresponding fields of the linker symbol table | |
83 | entries in an ELF object file under SVR4. These macros also output | |
84 | the starting labels for the relevant functions/objects. */ | |
85 | ||
86 | /* Write the extra assembler code needed to declare an object properly. */ | |
87 | ||
88 | #undef ASM_DECLARE_OBJECT_NAME | |
89 | #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ | |
90 | do { \ | |
2be2ac70 ZW |
91 | HOST_WIDE_INT size; \ |
92 | ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ | |
674576f1 RH |
93 | size_directive_output = 0; \ |
94 | if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ | |
95 | { \ | |
96 | size_directive_output = 1; \ | |
2be2ac70 ZW |
97 | size = int_size_in_bytes (TREE_TYPE (DECL)); \ |
98 | ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \ | |
674576f1 RH |
99 | } \ |
100 | mips_declare_object (FILE, NAME, "", ":\n", 0); \ | |
101 | } while (0) | |
102 | ||
103 | /* Output the size directive for a decl in rest_of_decl_compilation | |
104 | in the case where we did not do so before the initializer. | |
105 | Once we find the error_mark_node, we know that the value of | |
106 | size_directive_output was set | |
107 | by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ | |
108 | ||
109 | #undef ASM_FINISH_DECLARE_OBJECT | |
110 | #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ | |
111 | do { \ | |
3cce094d | 112 | const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ |
2be2ac70 | 113 | HOST_WIDE_INT size; \ |
674576f1 RH |
114 | if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ |
115 | && ! AT_END && TOP_LEVEL \ | |
116 | && DECL_INITIAL (DECL) == error_mark_node \ | |
117 | && !size_directive_output) \ | |
118 | { \ | |
119 | size_directive_output = 1; \ | |
2be2ac70 ZW |
120 | size = int_size_in_bytes (TREE_TYPE (DECL)); \ |
121 | ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \ | |
674576f1 RH |
122 | } \ |
123 | } while (0) | |
124 | ||
a0281dae GK |
125 | #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ |
126 | do { fputc ( '\t', FILE); \ | |
127 | assemble_name (FILE, LABEL1); \ | |
128 | fputs ( " = ", FILE); \ | |
129 | assemble_name (FILE, LABEL2); \ | |
130 | fputc ( '\n', FILE); \ | |
131 | } while (0) | |
132 | ||
133 | /* Note about .weak vs. .weakext | |
134 | The mips native assemblers support .weakext, but not .weak. | |
135 | mips-elf gas supports .weak, but not .weakext. | |
136 | mips-elf gas has been changed to support both .weak and .weakext, | |
137 | but until that support is generally available, the 'if' below | |
987ba558 | 138 | should serve. */ |
a0281dae | 139 | |
44404b8b | 140 | #undef ASM_WEAKEN_LABEL |
a0281dae GK |
141 | #define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,0) |
142 | #define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \ | |
143 | do { \ | |
144 | if (TARGET_GAS) \ | |
145 | fputs ("\t.weak\t", FILE); \ | |
146 | else \ | |
147 | fputs ("\t.weakext\t", FILE); \ | |
148 | assemble_name (FILE, NAME); \ | |
149 | if (VALUE) \ | |
150 | { \ | |
151 | fputc (' ', FILE); \ | |
152 | assemble_name (FILE, VALUE); \ | |
153 | } \ | |
154 | fputc ('\n', FILE); \ | |
155 | } while (0) | |
156 | ||
52ecdfda | 157 | #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) |
ae46c4e0 RH |
158 | |
159 | #define TARGET_ASM_UNIQUE_SECTION mips_unique_section | |
d8265d29 | 160 | |
d8265d29 CM |
161 | /* A list of other sections which the compiler might be "in" at any |
162 | given time. */ | |
163 | #undef EXTRA_SECTIONS | |
d48bc59a | 164 | #define EXTRA_SECTIONS in_sdata |
d8265d29 CM |
165 | |
166 | #undef EXTRA_SECTION_FUNCTIONS | |
167 | #define EXTRA_SECTION_FUNCTIONS \ | |
d48bc59a | 168 | SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) |
d8265d29 CM |
169 | |
170 | #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \ | |
171 | void FN () \ | |
172 | { \ | |
173 | if (in_section != ENUM) \ | |
174 | { \ | |
175 | fprintf (asm_out_file, "%s\n", OP); \ | |
176 | in_section = ENUM; \ | |
177 | } \ | |
178 | } | |
46f9491e EC |
179 | |
180 | /* On elf, we *do* have support for the .init and .fini sections, and we | |
181 | can put stuff in there to be executed before and after `main'. We let | |
182 | crtstuff.c and other files know this by defining the following symbols. | |
183 | The definitions say how to change sections to the .init and .fini | |
184 | sections. This is the same for all known elf assemblers. */ | |
185 | ||
186 | #undef INIT_SECTION_ASM_OP | |
187 | #define INIT_SECTION_ASM_OP "\t.section\t.init" | |
188 | #undef FINI_SECTION_ASM_OP | |
189 | #define FINI_SECTION_ASM_OP "\t.section\t.fini" | |
190 | ||
d8265d29 CM |
191 | /* Don't set the target flags, this is done by the linker script */ |
192 | #undef LIB_SPEC | |
193 | #define LIB_SPEC "" | |
194 | ||
195 | #undef STARTFILE_SPEC | |
3fb9d48a CD |
196 | #if defined(HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES) \ |
197 | || (MIPS_ABI_DEFAULT == ABI_MEABI) | |
4357a6c3 CD |
198 | #define STARTFILE_SPEC "crti%O%s crtbegin%O%s" |
199 | #else | |
8d1b7ba1 | 200 | #define STARTFILE_SPEC "crti%O%s crtbegin%O%s %{!mno-crt0:crt0%O%s}" |
4357a6c3 | 201 | #endif |
d8265d29 CM |
202 | |
203 | #undef ENDFILE_SPEC | |
46f9491e | 204 | #define ENDFILE_SPEC "crtend%O%s crtn%O%s" |