OSDN Git Service

* config/mips/elf.h (OBJECT_FORMAT_COFF, EXTENDED_COFF): Remove undefs.
[pf3gnuchains/gcc-fork.git] / gcc / config / mips / elf.h
1 /* Definitions of target machine for GNU compiler.  MIPS R3000 version with
2    GOFAST floating point library.
3    Copyright (C) 1994, 1997, 1999, 2000, 2002, 2003
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 /* Use ELF.  */
24 #define DBX_DEBUGGING_INFO 1
25 #define DWARF2_DEBUGGING_INFO 1
26
27 #undef  PREFERRED_DEBUGGING_TYPE
28 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
29
30 #undef  SUBTARGET_ASM_DEBUGGING_SPEC
31 #define SUBTARGET_ASM_DEBUGGING_SPEC "-g0"
32
33 /* Biggest alignment supported by the object file format of this
34    machine.  Use this macro to limit the alignment which can be
35    specified using the `__attribute__ ((aligned (N)))' construct.  If
36    not defined, the default value is `BIGGEST_ALIGNMENT'.  */
37
38 #undef  MAX_OFILE_ALIGNMENT
39 #define MAX_OFILE_ALIGNMENT (32768*8)
40
41 /* Switch into a generic section.  */
42 #undef  TARGET_ASM_NAMED_SECTION
43 #define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
44
45 /* The following macro defines the format used to output the second
46    operand of the .type assembler directive.  Different svr4 assemblers
47    expect various different forms for this operand.  The one given here
48    is just a default.  You may need to override it in your machine-
49    specific tm.h file (depending upon the particulars of your assembler).  */
50
51 #define TYPE_OPERAND_FMT        "@%s"
52
53 /* Define the strings used for the special svr4 .type and .size directives.
54    These strings generally do not vary from one system running svr4 to
55    another, but if a given system (e.g. m88k running svr) needs to use
56    different pseudo-op names for these, they may be overridden in the
57    file which includes this one.  */
58
59 #undef TYPE_ASM_OP
60 #undef SIZE_ASM_OP
61 #define TYPE_ASM_OP     "\t.type\t"
62 #define SIZE_ASM_OP     "\t.size\t"
63
64 /* If defined, a C expression whose value is a string containing the
65    assembler operation to identify the following data as
66    uninitialized global data.  If not defined, and neither
67    `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
68    uninitialized global data will be output in the data section if
69    `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
70    used.  */
71
72 #ifndef BSS_SECTION_ASM_OP
73 #define BSS_SECTION_ASM_OP      "\t.section\t.bss"
74 #endif
75
76 #undef  SBSS_SECTION_ASM_OP
77 #define SBSS_SECTION_ASM_OP     "\t.section .sbss"
78
79 /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
80    separate, explicit argument.  If you define this macro, it is used
81    in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
82    handling the required alignment of the variable.  The alignment is
83    specified as the number of bits.
84
85    Try to use function `asm_output_aligned_bss' defined in file
86    `varasm.c' when defining this macro.  */
87 #ifndef ASM_OUTPUT_ALIGNED_BSS
88 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
89 do {                                                                    \
90   if (SIZE > 0 && SIZE <= (unsigned HOST_WIDE_INT)mips_section_threshold)\
91     named_section (0, ".sbss", 0);                                      \
92   else                                                                  \
93     bss_section ();                                                     \
94   ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT));          \
95   last_assemble_variable_decl = DECL;                                   \
96   ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL);                           \
97   ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1);                              \
98 } while (0)
99 #endif
100
101 /* These macros generate the special .type and .size directives which
102    are used to set the corresponding fields of the linker symbol table
103    entries in an ELF object file under SVR4.  These macros also output
104    the starting labels for the relevant functions/objects.  */
105
106 /* Write the extra assembler code needed to declare an object properly.  */
107
108 #undef  ASM_DECLARE_OBJECT_NAME
109 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)                       \
110   do {                                                                  \
111     HOST_WIDE_INT size;                                                 \
112     ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");                   \
113     size_directive_output = 0;                                          \
114     if (!flag_inhibit_size_directive && DECL_SIZE (DECL))               \
115       {                                                                 \
116         size_directive_output = 1;                                      \
117         size = int_size_in_bytes (TREE_TYPE (DECL));                    \
118         ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size);                   \
119       }                                                                 \
120     mips_declare_object (FILE, NAME, "", ":\n", 0);                     \
121   } while (0)
122
123 /* Output the size directive for a decl in rest_of_decl_compilation
124    in the case where we did not do so before the initializer.
125    Once we find the error_mark_node, we know that the value of
126    size_directive_output was set
127    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
128
129 #undef  ASM_FINISH_DECLARE_OBJECT
130 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)         \
131 do {                                                                     \
132      const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);             \
133      HOST_WIDE_INT size;                                                 \
134                                                                          \
135      if (!flag_inhibit_size_directive && DECL_SIZE (DECL)                \
136          && ! AT_END && TOP_LEVEL                                        \
137          && DECL_INITIAL (DECL) == error_mark_node                       \
138          && !size_directive_output)                                      \
139        {                                                                 \
140          size_directive_output = 1;                                      \
141          size = int_size_in_bytes (TREE_TYPE (DECL));                    \
142          ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size);                   \
143        }                                                                 \
144    } while (0)
145
146 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                            \
147  do { fputc ( '\t', FILE);                                            \
148       assemble_name (FILE, LABEL1);                                   \
149       fputs ( " = ", FILE);                                           \
150       assemble_name (FILE, LABEL2);                                   \
151       fputc ( '\n', FILE);                                            \
152  } while (0)
153
154 /* Note about .weak vs. .weakext
155    The mips native assemblers support .weakext, but not .weak.
156    mips-elf gas supports .weak, but not .weakext.
157    mips-elf gas has been changed to support both .weak and .weakext,
158    but until that support is generally available, the 'if' below
159    should serve.  */
160
161 #undef  ASM_WEAKEN_LABEL
162 #define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,0)
163 #define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE)  \
164  do {                                           \
165   if (TARGET_GAS)                               \
166       fputs ("\t.weak\t", FILE);                \
167   else                                          \
168       fputs ("\t.weakext\t", FILE);             \
169   assemble_name (FILE, NAME);                   \
170   if (VALUE)                                    \
171     {                                           \
172       fputc (' ', FILE);                        \
173       assemble_name (FILE, VALUE);              \
174     }                                           \
175   fputc ('\n', FILE);                           \
176  } while (0)
177
178 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
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
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
196 #define STARTFILE_SPEC "crti%O%s crtbegin%O%s"
197
198 #undef  ENDFILE_SPEC
199 #define ENDFILE_SPEC "crtend%O%s crtn%O%s"
200
201 /* We support #pragma.  */
202 #define HANDLE_SYSV_PRAGMA 1