OSDN Git Service

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