]>
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, 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)
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 #define OBJECT_FORMAT_ELF
25 /* If an embedded ABI is selected, prefer to generate 64-bit code.
26 Implies -mips3 in such cases. */
27 #ifndef TARGET_DEFAULT
28 #define TARGET_DEFAULT MASK_FLOAT64|MASK_64BIT
31 /* This should change to n32 when it is supported in gas. */
32 #ifndef MIPS_ABI_DEFAULT
33 #define MIPS_ABI_DEFAULT ABI_O64
36 /* Until we figure out what MIPS ELF targets normally use, just do
38 #ifndef PREFERRED_DEBUGGING_TYPE
39 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
42 /* US Software GOFAST library support. */
44 #define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
46 #include "mips/mips.h"
48 /* Use memcpy, et. al., rather than bcopy. */
49 #define TARGET_MEM_FUNCTIONS
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 /* We need to use .esize and .etype instead of .size and .type to
60 avoid conflicting with ELF directives. */
62 #define PUT_SDB_SIZE(a) \
64 extern FILE *asm_out_text_file; \
65 fprintf (asm_out_text_file, "\t.esize\t"); \
66 fprintf (asm_out_text_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) (a)); \
67 fprintf (asm_out_text_file, ";"); \
71 #define PUT_SDB_TYPE(a) \
73 extern FILE *asm_out_text_file; \
74 fprintf (asm_out_text_file, "\t.etype\t0x%x;", (a)); \
77 /* Switch into a generic section. */
78 #undef TARGET_ASM_NAMED_SECTION
79 #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
81 /* Given that Irix has it's own headers, not having TARGET_GAS here
82 seems a mistake. If we actually need to be prepared for file
83 switching, then we need a custom TARGET_ASM_NAMED_SECTION too. */
86 #define TEXT_SECTION() \
88 if (TARGET_FILE_SWITCHING) \
90 fputs (TEXT_SECTION_ASM_OP, asm_out_file); \
91 fputc ('\n', asm_out_file); \
94 /* The following macro defines the format used to output the second
95 operand of the .type assembler directive. Different svr4 assemblers
96 expect various different forms for this operand. The one given here
97 is just a default. You may need to override it in your machine-
98 specific tm.h file (depending upon the particulars of your assembler). */
100 #define TYPE_OPERAND_FMT "@%s"
102 /* Define the strings used for the special svr4 .type and .size directives.
103 These strings generally do not vary from one system running svr4 to
104 another, but if a given system (e.g. m88k running svr) needs to use
105 different pseudo-op names for these, they may be overridden in the
106 file which includes this one. */
110 #define TYPE_ASM_OP "\t.type\t"
111 #define SIZE_ASM_OP "\t.size\t"
113 /* These macros generate the special .type and .size directives which
114 are used to set the corresponding fields of the linker symbol table
115 entries in an ELF object file under SVR4. These macros also output
116 the starting labels for the relevant functions/objects. */
118 /* Write the extra assembler code needed to declare an object properly. */
120 #undef ASM_DECLARE_OBJECT_NAME
121 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
123 HOST_WIDE_INT size; \
124 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
125 size_directive_output = 0; \
126 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
128 size_directive_output = 1; \
129 size = int_size_in_bytes (TREE_TYPE (DECL)); \
130 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
132 mips_declare_object (FILE, NAME, "", ":\n", 0); \
135 /* Output the size directive for a decl in rest_of_decl_compilation
136 in the case where we did not do so before the initializer.
137 Once we find the error_mark_node, we know that the value of
138 size_directive_output was set
139 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
141 #undef ASM_FINISH_DECLARE_OBJECT
142 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
144 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
145 HOST_WIDE_INT size; \
146 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
147 && ! AT_END && TOP_LEVEL \
148 && DECL_INITIAL (DECL) == error_mark_node \
149 && !size_directive_output) \
151 size_directive_output = 1; \
152 size = int_size_in_bytes (TREE_TYPE (DECL)); \
153 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
157 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
158 do { fputc ( '\t', FILE); \
159 assemble_name (FILE, LABEL1); \
160 fputs ( " = ", FILE); \
161 assemble_name (FILE, LABEL2); \
162 fputc ( '\n', FILE); \
165 /* Note about .weak vs. .weakext
166 The mips native assemblers support .weakext, but not .weak.
167 mips-elf gas supports .weak, but not .weakext.
168 mips-elf gas has been changed to support both .weak and .weakext,
169 but until that support is generally available, the 'if' below
172 #undef ASM_WEAKEN_LABEL
173 #define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,0)
174 #define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \
177 fputs ("\t.weak\t", FILE); \
179 fputs ("\t.weakext\t", FILE); \
180 assemble_name (FILE, NAME); \
184 assemble_name (FILE, VALUE); \
186 fputc ('\n', FILE); \
189 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
191 #define TARGET_ASM_UNIQUE_SECTION mips_unique_section
193 /* A list of other sections which the compiler might be "in" at any
195 #undef EXTRA_SECTIONS
196 #define EXTRA_SECTIONS in_sdata
198 #undef EXTRA_SECTION_FUNCTIONS
199 #define EXTRA_SECTION_FUNCTIONS \
200 SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP)
202 #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \
205 if (in_section != ENUM) \
207 fprintf (asm_out_file, "%s\n", OP); \
212 /* On elf, we *do* have support for the .init and .fini sections, and we
213 can put stuff in there to be executed before and after `main'. We let
214 crtstuff.c and other files know this by defining the following symbols.
215 The definitions say how to change sections to the .init and .fini
216 sections. This is the same for all known elf assemblers. */
218 #undef INIT_SECTION_ASM_OP
219 #define INIT_SECTION_ASM_OP "\t.section\t.init"
220 #undef FINI_SECTION_ASM_OP
221 #define FINI_SECTION_ASM_OP "\t.section\t.fini"
223 /* Don't set the target flags, this is done by the linker script */
227 #undef STARTFILE_SPEC
228 #define STARTFILE_SPEC "crti%O%s crtbegin%O%s %{!mno-crt0:crt0%O%s}"
231 #define ENDFILE_SPEC "crtend%O%s crtn%O%s"
This page took 0.053434 seconds and 6 git commands to generate.