]>
Commit | Line | Data |
---|---|---|
89a2944c DE |
1 | /* Definitions of target machine for GNU compiler, |
2 | for ARM with COFF obj format. | |
b355a481 | 3 | Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. |
89a2944c DE |
4 | Contributed by Doug Evans (dje@cygnus.com). |
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 | #include "arm/semi.h" | |
b355a481 | 24 | #include "arm/aout.h" |
89a2944c DE |
25 | \f |
26 | /* Run-time Target Specification. */ | |
b355a481 | 27 | #undef TARGET_VERSION |
89a2944c DE |
28 | #define TARGET_VERSION fputs (" (ARM/coff)", stderr) |
29 | ||
b355a481 | 30 | #undef TARGET_DEFAULT |
75197b37 | 31 | #define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32) |
89a2944c | 32 | |
b355a481 | 33 | #define MULTILIB_DEFAULTS { "mlittle-endian", "msoft-float", "mapcs-32" } |
89a2944c | 34 | \f |
b355a481 NC |
35 | /* Setting this to 32 produces more efficient code, but the value set in previous |
36 | versions of this toolchain was 8, which produces more compact structures. The | |
37 | command line option -mstructure_size_boundary=<n> can be used to change this | |
38 | value. */ | |
39 | #undef STRUCTURE_SIZE_BOUNDARY | |
40 | #define STRUCTURE_SIZE_BOUNDARY arm_structure_size_boundary | |
41 | ||
42 | extern int arm_structure_size_boundary; | |
89a2944c DE |
43 | \f |
44 | /* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS | |
45 | is a valid machine specific attribute for DECL. | |
46 | The attributes in ATTRIBUTES have previously been assigned to DECL. */ | |
47 | extern int arm_valid_machine_decl_attribute (); | |
48 | #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \ | |
49 | arm_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS) | |
50 | \f | |
51 | /* This is COFF, but prefer stabs. */ | |
52 | #define SDB_DEBUGGING_INFO | |
53 | ||
54 | #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG | |
55 | ||
56 | #include "dbxcoff.h" | |
57 | \f | |
89a2944c DE |
58 | /* A C statement to output assembler commands which will identify the |
59 | object file as having been compiled with GNU CC (or another GNU | |
60 | compiler). */ | |
61 | /* Define this to NULL so we don't get anything. | |
62 | We have ASM_IDENTIFY_LANGUAGE. | |
63 | Also, when using stabs, gcc2_compiled must be a stabs entry, not an | |
64 | ordinary symbol, or gdb won't see it. The stabs entry must be | |
65 | before the N_SO in order for gdb to find it. */ | |
b355a481 NC |
66 | #define ASM_IDENTIFY_GCC(STREAM) \ |
67 | fprintf (STREAM, "%sgcc2_compiled.:\n", LOCAL_LABEL_PREFIX ) | |
89a2944c DE |
68 | |
69 | /* This outputs a lot of .req's to define alias for various registers. | |
70 | Let's try to avoid this. */ | |
71 | #undef ASM_FILE_START | |
72 | #define ASM_FILE_START(STREAM) \ | |
73 | do { \ | |
74 | extern char *version_string; \ | |
75 | fprintf (STREAM, "%s Generated by gcc %s for ARM/coff\n", \ | |
76 | ASM_COMMENT_START, version_string); \ | |
77 | } while (0) | |
78 | ||
79 | /* A C statement to output something to the assembler file to switch to section | |
80 | NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or | |
81 | NULL_TREE. Some target formats do not support arbitrary sections. Do not | |
82 | define this macro in such cases. */ | |
ad4ff310 | 83 | #define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \ |
89a2944c DE |
84 | do { \ |
85 | if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \ | |
86 | fprintf (STREAM, "\t.section %s,\"x\"\n", (NAME)); \ | |
ad4ff310 | 87 | else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \ |
89a2944c DE |
88 | fprintf (STREAM, "\t.section %s,\"\"\n", (NAME)); \ |
89 | else \ | |
90 | fprintf (STREAM, "\t.section %s,\"w\"\n", (NAME)); \ | |
91 | } while (0) | |
92 | \f | |
93 | /* Support the ctors/dtors and other sections. */ | |
94 | ||
95 | #undef INIT_SECTION_ASM_OP | |
96 | ||
97 | /* Define this macro if jump tables (for `tablejump' insns) should be | |
98 | output in the text section, along with the assembler instructions. | |
99 | Otherwise, the readonly data section is used. */ | |
75197b37 | 100 | #define JUMP_TABLES_IN_TEXT_SECTION 1 |
89a2944c | 101 | |
b355a481 | 102 | #undef READONLY_DATA_SECTION |
89a2944c | 103 | #define READONLY_DATA_SECTION rdata_section |
b355a481 | 104 | #undef RDATA_SECTION_ASM_OP |
89a2944c | 105 | #define RDATA_SECTION_ASM_OP "\t.section .rdata" |
b355a481 | 106 | #undef CTORS_SECTION_ASM_OP |
89a2944c | 107 | #define CTORS_SECTION_ASM_OP "\t.section .ctors,\"x\"" |
b355a481 | 108 | #undef DTORS_SECTION_ASM_OP |
89a2944c DE |
109 | #define DTORS_SECTION_ASM_OP "\t.section .dtors,\"x\"" |
110 | ||
111 | /* A list of other sections which the compiler might be "in" at any | |
112 | given time. */ | |
113 | ||
114 | #undef EXTRA_SECTIONS | |
115 | #define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS in_rdata, in_ctors, in_dtors | |
116 | ||
117 | #define SUBTARGET_EXTRA_SECTIONS | |
118 | ||
119 | /* A list of extra section function definitions. */ | |
120 | ||
121 | #undef EXTRA_SECTION_FUNCTIONS | |
122 | #define EXTRA_SECTION_FUNCTIONS \ | |
123 | RDATA_SECTION_FUNCTION \ | |
124 | CTORS_SECTION_FUNCTION \ | |
125 | DTORS_SECTION_FUNCTION \ | |
126 | SUBTARGET_EXTRA_SECTION_FUNCTIONS | |
127 | ||
128 | #define SUBTARGET_EXTRA_SECTION_FUNCTIONS | |
129 | ||
130 | #define RDATA_SECTION_FUNCTION \ | |
131 | void \ | |
132 | rdata_section () \ | |
133 | { \ | |
134 | if (in_section != in_rdata) \ | |
135 | { \ | |
136 | fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \ | |
137 | in_section = in_rdata; \ | |
138 | } \ | |
139 | } | |
140 | ||
141 | #define CTORS_SECTION_FUNCTION \ | |
142 | void \ | |
143 | ctors_section () \ | |
144 | { \ | |
145 | if (in_section != in_ctors) \ | |
146 | { \ | |
147 | fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ | |
148 | in_section = in_ctors; \ | |
149 | } \ | |
150 | } | |
151 | ||
152 | #define DTORS_SECTION_FUNCTION \ | |
153 | void \ | |
154 | dtors_section () \ | |
155 | { \ | |
156 | if (in_section != in_dtors) \ | |
157 | { \ | |
158 | fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ | |
159 | in_section = in_dtors; \ | |
160 | } \ | |
161 | } | |
162 | \f | |
163 | /* Support the ctors/dtors sections for g++. */ | |
164 | ||
165 | #define INT_ASM_OP ".word" | |
166 | ||
167 | /* A C statement (sans semicolon) to output an element in the table of | |
168 | global constructors. */ | |
169 | #undef ASM_OUTPUT_CONSTRUCTOR | |
170 | #define ASM_OUTPUT_CONSTRUCTOR(STREAM,NAME) \ | |
171 | do { \ | |
172 | ctors_section (); \ | |
173 | fprintf (STREAM, "\t%s\t ", INT_ASM_OP); \ | |
174 | assemble_name (STREAM, NAME); \ | |
175 | fprintf (STREAM, "\n"); \ | |
176 | } while (0) | |
177 | ||
178 | /* A C statement (sans semicolon) to output an element in the table of | |
179 | global destructors. */ | |
180 | #undef ASM_OUTPUT_DESTRUCTOR | |
181 | #define ASM_OUTPUT_DESTRUCTOR(STREAM,NAME) \ | |
182 | do { \ | |
183 | dtors_section (); \ | |
184 | fprintf (STREAM, "\t%s\t ", INT_ASM_OP); \ | |
185 | assemble_name (STREAM, NAME); \ | |
186 | fprintf (STREAM, "\n"); \ | |
187 | } while (0) | |
188 | ||
189 | /* __CTOR_LIST__ and __DTOR_LIST__ must be defined by the linker script. */ | |
190 | #define CTOR_LISTS_DEFINED_EXTERNALLY | |
191 | ||
192 | #undef DO_GLOBAL_CTORS_BODY | |
193 | #undef DO_GLOBAL_DTORS_BODY | |
194 | ||
b355a481 NC |
195 | /* If you don't define HAVE_ATEXIT, and the object file format/OS/whatever |
196 | does not support constructors/destructors, then gcc implements destructors | |
197 | by defining its own exit function, which calls the destructors. This gcc | |
198 | exit function overrides the C library's exit function, and this can cause | |
199 | all kinds of havoc if the C library has a non-trivial exit function. You | |
200 | really don't want to use the exit function in libgcc2.c. */ | |
89a2944c DE |
201 | #define HAVE_ATEXIT |
202 | ||
203 | /* The ARM development system defines __main. */ | |
204 | #define NAME__MAIN "__gccmain" | |
205 | #define SYMBOL__MAIN __gccmain |