FSF GCC merge 02/23/03
[official-gcc.git] / gcc / config / mips / elf64.h
blobe9bed21da10bb6ce471cd3e2ce2c8c4df3519437
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.
6 This file is part of GNU CC.
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.
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.
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. */
23 #undef OBJECT_FORMAT_COFF
24 #undef EXTENDED_COFF
26 #undef SDB_DEBUGGING_INFO
27 #define DBX_DEBUGGING_INFO 1
28 #define DWARF2_DEBUGGING_INFO 1
30 #undef PREFERRED_DEBUGGING_TYPE
31 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
33 #undef SUBTARGET_ASM_DEBUGGING_SPEC
34 #define SUBTARGET_ASM_DEBUGGING_SPEC "-g0"
36 /* Biggest alignment supported by the object file format of this
37 machine. Use this macro to limit the alignment which can be
38 specified using the `__attribute__ ((aligned (N)))' construct. If
39 not defined, the default value is `BIGGEST_ALIGNMENT'. */
41 #undef MAX_OFILE_ALIGNMENT
42 #define MAX_OFILE_ALIGNMENT (32768*8)
44 /* Switch into a generic section. */
45 #undef TARGET_ASM_NAMED_SECTION
46 #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
48 /* Given that Irix has it's own headers, not having TARGET_GAS here
49 seems a mistake. If we actually need to be prepared for file
50 switching, then we need a custom TARGET_ASM_NAMED_SECTION too. */
52 #undef TEXT_SECTION
53 #define TEXT_SECTION() \
54 do { \
55 if (TARGET_FILE_SWITCHING) \
56 abort (); \
57 fputs (TEXT_SECTION_ASM_OP, asm_out_file); \
58 fputc ('\n', asm_out_file); \
59 } while (0)
61 /* The following macro defines the format used to output the second
62 operand of the .type assembler directive. Different svr4 assemblers
63 expect various different forms for this operand. The one given here
64 is just a default. You may need to override it in your machine-
65 specific tm.h file (depending upon the particulars of your assembler). */
67 #define TYPE_OPERAND_FMT "@%s"
69 /* Define the strings used for the special svr4 .type and .size directives.
70 These strings generally do not vary from one system running svr4 to
71 another, but if a given system (e.g. m88k running svr) needs to use
72 different pseudo-op names for these, they may be overridden in the
73 file which includes this one. */
75 #undef TYPE_ASM_OP
76 #undef SIZE_ASM_OP
77 #define TYPE_ASM_OP "\t.type\t"
78 #define SIZE_ASM_OP "\t.size\t"
80 /* These macros generate the special .type and .size directives which
81 are used to set the corresponding fields of the linker symbol table
82 entries in an ELF object file under SVR4. These macros also output
83 the starting labels for the relevant functions/objects. */
85 /* Write the extra assembler code needed to declare an object properly. */
87 #undef ASM_DECLARE_OBJECT_NAME
88 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
89 do { \
90 HOST_WIDE_INT size; \
91 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
92 size_directive_output = 0; \
93 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
94 { \
95 size_directive_output = 1; \
96 size = int_size_in_bytes (TREE_TYPE (DECL)); \
97 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
98 } \
99 mips_declare_object (FILE, NAME, "", ":\n", 0); \
100 } while (0)
102 /* Output the size directive for a decl in rest_of_decl_compilation
103 in the case where we did not do so before the initializer.
104 Once we find the error_mark_node, we know that the value of
105 size_directive_output was set
106 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
108 #undef ASM_FINISH_DECLARE_OBJECT
109 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
110 do { \
111 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
112 HOST_WIDE_INT size; \
113 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
114 && ! AT_END && TOP_LEVEL \
115 && DECL_INITIAL (DECL) == error_mark_node \
116 && !size_directive_output) \
118 size_directive_output = 1; \
119 size = int_size_in_bytes (TREE_TYPE (DECL)); \
120 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
122 } while (0)
124 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
125 do { fputc ( '\t', FILE); \
126 assemble_name (FILE, LABEL1); \
127 fputs ( " = ", FILE); \
128 assemble_name (FILE, LABEL2); \
129 fputc ( '\n', FILE); \
130 } while (0)
132 /* Note about .weak vs. .weakext
133 The mips native assemblers support .weakext, but not .weak.
134 mips-elf gas supports .weak, but not .weakext.
135 mips-elf gas has been changed to support both .weak and .weakext,
136 but until that support is generally available, the 'if' below
137 should serve. */
139 #undef ASM_WEAKEN_LABEL
140 #define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,0)
141 #define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \
142 do { \
143 if (TARGET_GAS) \
144 fputs ("\t.weak\t", FILE); \
145 else \
146 fputs ("\t.weakext\t", FILE); \
147 assemble_name (FILE, NAME); \
148 if (VALUE) \
150 fputc (' ', FILE); \
151 assemble_name (FILE, VALUE); \
153 fputc ('\n', FILE); \
154 } while (0)
156 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
158 #define TARGET_ASM_UNIQUE_SECTION mips_unique_section
160 /* A list of other sections which the compiler might be "in" at any
161 given time. */
162 #undef EXTRA_SECTIONS
163 #define EXTRA_SECTIONS in_sdata
165 #undef EXTRA_SECTION_FUNCTIONS
166 #define EXTRA_SECTION_FUNCTIONS \
167 SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP)
169 #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \
170 void FN () \
172 if (in_section != ENUM) \
174 fprintf (asm_out_file, "%s\n", OP); \
175 in_section = ENUM; \
179 /* On elf, we *do* have support for the .init and .fini sections, and we
180 can put stuff in there to be executed before and after `main'. We let
181 crtstuff.c and other files know this by defining the following symbols.
182 The definitions say how to change sections to the .init and .fini
183 sections. This is the same for all known elf assemblers. */
185 #undef INIT_SECTION_ASM_OP
186 #define INIT_SECTION_ASM_OP "\t.section\t.init"
187 #undef FINI_SECTION_ASM_OP
188 #define FINI_SECTION_ASM_OP "\t.section\t.fini"
190 /* Don't set the target flags, this is done by the linker script */
191 #undef LIB_SPEC
192 #define LIB_SPEC ""
194 #undef STARTFILE_SPEC
195 #if defined(HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES) \
196 || (MIPS_ABI_DEFAULT == ABI_MEABI)
197 #define STARTFILE_SPEC "crti%O%s crtbegin%O%s"
198 #else
199 #define STARTFILE_SPEC "crti%O%s crtbegin%O%s %{!mno-crt0:crt0%O%s}"
200 #endif
202 #undef ENDFILE_SPEC
203 #define ENDFILE_SPEC "crtend%O%s crtn%O%s"
205 /* We support #pragma. */
206 #define HANDLE_SYSV_PRAGMA 1