OSDN Git Service

* toplev.c (output_lang_identify): Delete.
[pf3gnuchains/gcc-fork.git] / gcc / config / arm / linux-elf.h
1 /* Definitions for ARM running Linux-based GNU systems using ELF
2    Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001 
3    Free Software Foundation, Inc.
4    Contributed by Philip Blundell <philb@gnu.org>
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 this program; 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 /* Run-time Target Specification.  */
24 #define TARGET_VERSION  fputs (" (ARM GNU/Linux with ELF)", stderr);
25
26 /* Do not assume anything about header files.  */
27 #define NO_IMPLICIT_EXTERN_C
28
29 /* Default is to use APCS-32 mode.  */
30 #define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS)
31 #define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
32 #define MULTILIB_DEFAULTS \
33         { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
34 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
35
36 /* This was defined in linux.h.  Define it here also. */
37 #undef  DEFAULT_VTABLE_THUNKS
38 #define DEFAULT_VTABLE_THUNKS   1
39
40 /* Handle #pragma weak and #pragma pack.  */
41 #define HANDLE_SYSV_PRAGMA
42
43 /* Now we define the strings used to build the spec file.  */
44 #define LIB_SPEC \
45   "%{shared: -lc} \
46    %{!shared: %{pthread:-lpthread} \
47    %{profile:-lc_p} %{!profile: -lc}}"
48
49
50 #define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc"
51
52 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux.  Here we add
53    the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
54    provides part of the support for getting C++ file-scope static
55    object constructed before entering `main'. */
56    
57 #define STARTFILE_SPEC \
58   "%{!shared: \
59      %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
60                        %{!p:%{profile:gcrt1.o%s} \
61                          %{!profile:crt1.o%s}}}} \
62    crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
63
64 /* Provide a ENDFILE_SPEC appropriate for GNU/Linux.  Here we tack on
65    the GNU/Linux magical crtend.o file (see crtstuff.c) which
66    provides part of the support for getting C++ file-scope static
67    object constructed before entering `main', followed by a normal
68    GNU/Linux "finalizer" file, `crtn.o'.  */
69
70 #define ENDFILE_SPEC \
71   "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
72
73 #define LINK_SPEC "%{h*} %{version:-v} \
74    %{b} %{Wl,*:%*} \
75    %{static:-Bstatic} \
76    %{shared:-shared} \
77    %{symbolic:-Bsymbolic} \
78    %{rdynamic:-export-dynamic} \
79    %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
80    -X \
81    %{mbig-endian:-EB}" \
82    SUBTARGET_EXTRA_LINK_SPEC
83
84 #undef  CPP_PREDEFINES
85 #define CPP_PREDEFINES \
86 "-Dunix -Dlinux -D__ELF__ \
87 -Asystem=unix -Asystem=posix -Acpu=arm -Amachine=arm"
88
89 /* Allow #sccs in preprocessor.  */
90 #define SCCS_DIRECTIVE
91
92 #define USER_LABEL_PREFIX       ""      /* For ELF the default is no underscores */
93 #define LOCAL_LABEL_PREFIX      "."
94
95 #define IDENT_ASM_OP    "\t.ident\t"
96
97 /* Output #ident as a .ident.  */
98 #define ASM_OUTPUT_IDENT(FILE, NAME) \
99   fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME);
100
101 /* Support const sections and the ctors and dtors sections for g++.
102    Note that there appears to be two different ways to support const
103    sections at the moment.  You can either #define the symbol
104    READONLY_DATA_SECTION (giving it some code which switches to the
105    readonly data section) or else you can #define the symbols
106    EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
107    SELECT_RTX_SECTION.  We do both here just to be on the safe side.  */
108 #define USE_CONST_SECTION       1
109
110 /* Support for Constructors and Destructors.  */
111 #define READONLY_DATA_SECTION() const_section ()
112
113 /* A default list of other sections which we might be "in" at any given
114    time.  For targets that use additional sections (e.g. .tdesc) you
115    should override this definition in the target-specific file which
116    includes this file.  */
117 #define SUBTARGET_EXTRA_SECTIONS in_const,
118
119 /* A default list of extra section function definitions.  For targets
120    that use additional sections (e.g. .tdesc) you should override this
121    definition in the target-specific file which includes this file.  */
122 #define SUBTARGET_EXTRA_SECTION_FUNCTIONS       CONST_SECTION_FUNCTION
123
124 #define CONST_SECTION_ASM_OP    "\t.section\t.rodata"
125
126 #define CONST_SECTION_FUNCTION                                          \
127 void                                                                    \
128 const_section ()                                                        \
129 {                                                                       \
130   if (!USE_CONST_SECTION)                                               \
131     text_section ();                                                    \
132   else if (in_section != in_const)                                      \
133     {                                                                   \
134       fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP);             \
135       in_section = in_const;                                            \
136     }                                                                   \
137 }
138
139 /* Switch into a generic section.
140    This is currently only used to support section attributes.
141
142    We make the section read-only and executable for a function decl,
143    read-only for a const data decl, and writable for a non-const data decl.  */
144 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
145   fprintf (FILE, ".section\t%s,\"%s\",%%progbits\n", NAME, \
146            (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
147            (DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "aw")
148
149 /* A C statement or statements to switch to the appropriate
150    section for output of DECL.  DECL is either a `VAR_DECL' node
151    or a constant of some sort.  RELOC indicates whether forming
152    the initial value of DECL requires link-time relocations.  */
153 #define SELECT_SECTION(DECL,RELOC)                                      \
154 {                                                                       \
155   if (TREE_CODE (DECL) == STRING_CST)                                   \
156     {                                                                   \
157       if (! flag_writable_strings)                                      \
158         const_section ();                                               \
159       else                                                              \
160         data_section ();                                                \
161     }                                                                   \
162   else if (TREE_CODE (DECL) == VAR_DECL)                                \
163     {                                                                   \
164       if ((flag_pic && RELOC)                                           \
165           || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)          \
166           || !DECL_INITIAL (DECL)                                       \
167           || (DECL_INITIAL (DECL) != error_mark_node                    \
168               && !TREE_CONSTANT (DECL_INITIAL (DECL))))                 \
169         data_section ();                                                \
170       else                                                              \
171         const_section ();                                               \
172     }                                                                   \
173   else                                                                  \
174     const_section ();                                                   \
175 }
176
177 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
178 #define UNIQUE_SECTION_P(DECL)   (DECL_ONE_ONLY (DECL))
179
180 #define UNIQUE_SECTION(DECL, RELOC)                             \
181   do                                                            \
182     {                                                           \
183       int len;                                                  \
184       char * name;                                              \
185       char * string;                                            \
186       char * prefix;                                            \
187                                                                 \
188       name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));   \
189                                                                 \
190       if (! DECL_ONE_ONLY (DECL))                               \
191         {                                                       \
192           prefix = ".";                                         \
193           if (TREE_CODE (DECL) == FUNCTION_DECL)                \
194             prefix = ".text.";                                  \
195           else if (DECL_READONLY_SECTION (DECL, RELOC))         \
196             prefix = ".rodata.";                                \
197           else                                                  \
198             prefix = ".data.";                                  \
199         }                                                       \
200       else if (TREE_CODE (DECL) == FUNCTION_DECL)               \
201         prefix = ".gnu.linkonce.t.";                            \
202       else if (DECL_READONLY_SECTION (DECL, RELOC))             \
203         prefix = ".gnu.linkonce.r.";                            \
204       else                                                      \
205         prefix = ".gnu.linkonce.d.";                            \
206                                                                 \
207       len = strlen (name) + strlen (prefix);                    \
208       string = alloca (len + 1);                                \
209       sprintf (string, "%s%s", prefix, name);                   \
210                                                                 \
211       DECL_SECTION_NAME (DECL) = build_string (len, string);    \
212     }                                                           \
213   while (0)
214
215 /* A C statement or statements to switch to the appropriate
216    section for output of RTX in mode MODE.  RTX is some kind
217    of constant in RTL.  The argument MODE is redundant except
218    in the case of a `const_int' rtx.  Currently, these always
219    go into the const section.  */
220 #define SELECT_RTX_SECTION(MODE,RTX) const_section ()
221
222 /* On svr4, we *do* have support for the .init and .fini sections, and we
223    can put stuff in there to be executed before and after `main'.  We let
224    crtstuff.c and other files know this by defining the following symbols.
225    The definitions say how to change sections to the .init and .fini
226    sections.  This is the same for all known svr4 assemblers.  */
227 #define INIT_SECTION_ASM_OP     "\t.section\t.init"
228 #define FINI_SECTION_ASM_OP     "\t.section\t.fini"
229
230
231 /* This is how we tell the assembler that a symbol is weak.  */
232 #define ASM_WEAKEN_LABEL(FILE,NAME) \
233   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
234        fputc ('\n', FILE); } while (0)
235
236 /* This is how we tell the assembler that two symbols have the same value.  */
237
238 #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
239   do { assemble_name (FILE, NAME1);      \
240        fputs (" = ", FILE);              \
241        assemble_name (FILE, NAME2);      \
242        fputc ('\n', FILE); } while (0)
243
244 /* Make DWARF2 an option, but keep DBX as the default for now.
245    Use -gdwarf-2 to turn on DWARF2.  */
246 #define DWARF2_DEBUGGING_INFO
247 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
248
249 /* Get the standard ELF stabs definitions.  */
250 #include "dbxelf.h"
251
252 #include "arm/elf.h"
253 #include "arm/linux-gas.h"
254
255 /* NWFPE always understands FPA instructions.  */
256 #undef  FP_DEFAULT
257 #define FP_DEFAULT FP_SOFT3
258
259 /* Call the function profiler with a given profile label.  */
260 #undef  ARM_FUNCTION_PROFILER
261 #define ARM_FUNCTION_PROFILER(STREAM, LABELNO)                          \
262 {                                                                       \
263   fprintf (STREAM, "\tbl\tmcount%s\n", NEED_PLT_RELOC ? "(PLT)" : "");  \
264 }
265
266 #undef  CC1_SPEC
267 #define CC1_SPEC "%{profile:-p}"