OSDN Git Service

Skip -mthumb as well as -mthumb-interwork when -mcpu=arm7 is specified.
[pf3gnuchains/gcc-fork.git] / gcc / config / arm / coff.h
1 /* Definitions of target machine for GNU compiler.
2    For ARM with COFF object format.
3    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
4    Free Software Foundation, Inc.
5    Contributed by Doug Evans (devans@cygnus.com).
6    
7 This file is part of GNU CC.
8
9 GNU CC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 GNU CC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GNU CC; see the file COPYING.  If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA.  */
23
24 #include "semi.h"
25 #include "aout.h"
26
27 /* Note - it is important that this definition matches the one in tcoff.h */
28 #undef  USER_LABEL_PREFIX
29 #define USER_LABEL_PREFIX "_"
30
31 \f
32 /* Run-time Target Specification.  */
33 #undef  TARGET_VERSION
34 #define TARGET_VERSION fputs (" (ARM/coff)", stderr)
35
36 #undef  TARGET_DEFAULT
37 #define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME)
38
39 #ifndef MULTILIB_DEFAULTS
40 #define MULTILIB_DEFAULTS \
41   { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" }
42 #endif
43 \f
44 /* This is COFF, but prefer stabs.  */
45 #define SDB_DEBUGGING_INFO
46
47 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
48
49 #include "dbxcoff.h"
50 \f
51 /* A C statement to output assembler commands which will identify the
52    object file as having been compiled with GNU CC (or another GNU
53    compiler).  */
54
55 /* This outputs a lot of .req's to define alias for various registers.
56    Let's try to avoid this.  */
57 #undef ASM_FILE_START
58 #define ASM_FILE_START(STREAM)                                  \
59   do                                                            \
60     {                                                           \
61       fprintf (STREAM, "%s Generated by gcc %s for ARM/coff\n", \
62                ASM_COMMENT_START, version_string);              \
63       fprintf (STREAM, ASM_APP_OFF);                            \
64     }                                                           \
65   while (0)
66
67 /* A C statement to output something to the assembler file to switch to
68    section NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
69    NULL_TREE.  Some target formats do not support arbitrary sections.  Do not
70    define this macro in such cases.  */
71 #define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC)      \
72   do                                                            \
73     {                                                           \
74       if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL)          \
75         fprintf (STREAM, "\t.section %s,\"x\"\n", (NAME));      \
76       else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC))   \
77         fprintf (STREAM, "\t.section %s,\"\"\n", (NAME));       \
78       else                                                      \
79         fprintf (STREAM, "\t.section %s,\"w\"\n", (NAME));      \
80     }                                                           \
81   while (0)
82 \f
83 /* Support the ctors/dtors and other sections.  */
84
85 #undef INIT_SECTION_ASM_OP
86
87 /* Define this macro if jump tables (for `tablejump' insns) should be
88    output in the text section, along with the assembler instructions.
89    Otherwise, the readonly data section is used.  */
90 #define JUMP_TABLES_IN_TEXT_SECTION 1
91
92 #undef  READONLY_DATA_SECTION
93 #define READONLY_DATA_SECTION   rdata_section
94 #undef  RDATA_SECTION_ASM_OP
95 #define RDATA_SECTION_ASM_OP    "\t.section .rdata"
96 #undef  CTORS_SECTION_ASM_OP
97 #define CTORS_SECTION_ASM_OP    "\t.section .ctors,\"x\""
98 #undef  DTORS_SECTION_ASM_OP
99 #define DTORS_SECTION_ASM_OP    "\t.section .dtors,\"x\""
100
101 /* A list of other sections which the compiler might be "in" at any
102    given time.  */
103
104 #undef EXTRA_SECTIONS
105 #define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS in_rdata, in_ctors, in_dtors
106
107 #define SUBTARGET_EXTRA_SECTIONS
108
109 /* A list of extra section function definitions.  */
110
111 #undef EXTRA_SECTION_FUNCTIONS
112 #define EXTRA_SECTION_FUNCTIONS \
113   RDATA_SECTION_FUNCTION        \
114   CTORS_SECTION_FUNCTION        \
115   DTORS_SECTION_FUNCTION        \
116   SUBTARGET_EXTRA_SECTION_FUNCTIONS
117
118 #define SUBTARGET_EXTRA_SECTION_FUNCTIONS
119
120 #define RDATA_SECTION_FUNCTION \
121 void                                                            \
122 rdata_section ()                                                \
123 {                                                               \
124   if (in_section != in_rdata)                                   \
125     {                                                           \
126       fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP);     \
127       in_section = in_rdata;                                    \
128     }                                                           \
129 }
130
131 #define CTORS_SECTION_FUNCTION \
132 void                                                            \
133 ctors_section ()                                                \
134 {                                                               \
135   if (in_section != in_ctors)                                   \
136     {                                                           \
137       fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);     \
138       in_section = in_ctors;                                    \
139     }                                                           \
140 }
141
142 #define DTORS_SECTION_FUNCTION \
143 void                                                            \
144 dtors_section ()                                                \
145 {                                                               \
146   if (in_section != in_dtors)                                   \
147     {                                                           \
148       fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);     \
149       in_section = in_dtors;                                    \
150     }                                                           \
151 }
152 \f
153 /* Support the ctors/dtors sections for g++.  */
154
155 #define INT_ASM_OP "\t.word\t"
156
157 /* A C statement (sans semicolon) to output an element in the table of
158    global constructors.  */
159 #undef ASM_OUTPUT_CONSTRUCTOR
160 #define ASM_OUTPUT_CONSTRUCTOR(STREAM, NAME)    \
161   do                                            \
162     {                                           \
163       ctors_section ();                         \
164       fprintf (STREAM, "%s", INT_ASM_OP);       \
165       assemble_name (STREAM, NAME);             \
166       fprintf (STREAM, "\n");                   \
167     }                                           \
168   while (0)
169
170 /* A C statement (sans semicolon) to output an element in the table of
171    global destructors.  */
172 #undef ASM_OUTPUT_DESTRUCTOR
173 #define ASM_OUTPUT_DESTRUCTOR(STREAM, NAME)     \
174   do                                            \
175     {                                           \
176       dtors_section ();                         \
177       fprintf (STREAM, "%s", INT_ASM_OP);       \
178       assemble_name (STREAM, NAME);             \
179       fprintf (STREAM, "\n");                   \
180     }                                           \
181   while (0)
182
183 /* __CTOR_LIST__ and __DTOR_LIST__ must be defined by the linker script.  */
184 #define CTOR_LISTS_DEFINED_EXTERNALLY
185
186 #undef DO_GLOBAL_CTORS_BODY
187 #undef DO_GLOBAL_DTORS_BODY
188
189 /* The ARM development system defines __main.  */
190 #define NAME__MAIN  "__gccmain"
191 #define SYMBOL__MAIN __gccmain