OSDN Git Service

2003-06-03 Chris Demetriou <cgd@broadcom.com>
[pf3gnuchains/gcc-fork.git] / 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.
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 #undef  OBJECT_FORMAT_COFF
24 #undef  EXTENDED_COFF
25
26 #undef  SDB_DEBUGGING_INFO
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 /* 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.  */
51
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)
60
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).  */
66
67 #define TYPE_OPERAND_FMT        "@%s"
68
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.  */
74
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"
79
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.  */
84
85 /* Write the extra assembler code needed to declare an object properly.  */
86
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)
101
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.  */
107
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)                                      \
117        {                                                                 \
118          size_directive_output = 1;                                      \
119          size = int_size_in_bytes (TREE_TYPE (DECL));                    \
120          ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size);                   \
121        }                                                                 \
122    } while (0)
123
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)
131
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.  */
138
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)                                    \
149     {                                           \
150       fputc (' ', FILE);                        \
151       assemble_name (FILE, VALUE);              \
152     }                                           \
153   fputc ('\n', FILE);                           \
154  } while (0)
155
156 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
157
158 #define TARGET_ASM_UNIQUE_SECTION mips_unique_section
159
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
164
165 #undef EXTRA_SECTION_FUNCTIONS
166 #define EXTRA_SECTION_FUNCTIONS                                         \
167   SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP)
168
169 #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP)                               \
170 void FN ()                                                            \
171 {                                                                     \
172   if (in_section != ENUM)                                             \
173     {                                                                 \
174       fprintf (asm_out_file, "%s\n", OP);                             \
175       in_section = ENUM;                                              \
176     }                                                                 \
177 }
178
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.  */
184
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"
189
190 /* Don't set the target flags, this is done by the linker script */
191 #undef LIB_SPEC
192 #define LIB_SPEC ""
193
194 #undef  STARTFILE_SPEC
195 #define STARTFILE_SPEC "crti%O%s crtbegin%O%s"
196
197 #undef  ENDFILE_SPEC
198 #define ENDFILE_SPEC "crtend%O%s crtn%O%s"
199
200 /* We support #pragma.  */
201 #define HANDLE_SYSV_PRAGMA 1