Merge changes from merged-arm-thumb-backend-branch onto trunk.
[official-gcc.git] / gcc / config / arm / coff.h
bloba083be903acabaf42a72169ff8ed675fdc20731e
1 /* Definitions of target machine for GNU compiler.
2 For ARM with COFF object format.
3 Copyright (C) 1995 - 1999 Free Software Foundation, Inc.
4 Contributed by Doug Evans (devans@cygnus.com).
6 This file is part of GNU CC.
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.
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.
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. */
23 #include "semi.h"
24 #include "aout.h"
26 /* Note - it is important that this definition matches the one in tcoff.h */
27 #undef USER_LABEL_PREFIX
28 #define USER_LABEL_PREFIX "_"
31 /* Run-time Target Specification. */
32 #undef TARGET_VERSION
33 #define TARGET_VERSION fputs (" (ARM/coff)", stderr)
35 #undef TARGET_DEFAULT
36 #define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME)
38 #ifndef MULTILIB_DEFAULTS
39 #define MULTILIB_DEFAULTS \
40 { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" }
41 #endif
43 /* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
44 is a valid machine specific attribute for DECL.
45 The attributes in ATTRIBUTES have previously been assigned to DECL. */
46 #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
47 arm_valid_machine_decl_attribute (DECL, IDENTIFIER, ARGS)
49 /* This is COFF, but prefer stabs. */
50 #define SDB_DEBUGGING_INFO
52 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
54 #include "dbxcoff.h"
56 /* A C statement to output assembler commands which will identify the
57 object file as having been compiled with GNU CC (or another GNU
58 compiler). */
59 /* Define this to NULL so we don't get anything.
60 We have ASM_IDENTIFY_LANGUAGE.
61 Also, when using stabs, gcc2_compiled must be a stabs entry, not an
62 ordinary symbol, or gdb won't see it. The stabs entry must be
63 before the N_SO in order for gdb to find it. */
64 #define ASM_IDENTIFY_GCC(STREAM) \
65 fprintf (STREAM, "%sgcc2_compiled.:\n", LOCAL_LABEL_PREFIX )
67 /* This outputs a lot of .req's to define alias for various registers.
68 Let's try to avoid this. */
69 #undef ASM_FILE_START
70 #define ASM_FILE_START(STREAM) \
71 do \
72 { \
73 fprintf (STREAM, "%s Generated by gcc %s for ARM/coff\n", \
74 ASM_COMMENT_START, version_string); \
75 fprintf (STREAM, ASM_APP_OFF); \
76 } \
77 while (0)
79 /* A C statement to output something to the assembler file to switch to
80 section 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. */
83 #define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
84 do \
85 { \
86 if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
87 fprintf (STREAM, "\t.section %s,\"x\"\n", (NAME)); \
88 else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
89 fprintf (STREAM, "\t.section %s,\"\"\n", (NAME)); \
90 else \
91 fprintf (STREAM, "\t.section %s,\"w\"\n", (NAME)); \
92 } \
93 while (0)
95 /* Support the ctors/dtors and other sections. */
97 #undef INIT_SECTION_ASM_OP
99 /* Define this macro if jump tables (for `tablejump' insns) should be
100 output in the text section, along with the assembler instructions.
101 Otherwise, the readonly data section is used. */
102 #define JUMP_TABLES_IN_TEXT_SECTION 1
104 #undef READONLY_DATA_SECTION
105 #define READONLY_DATA_SECTION rdata_section
106 #undef RDATA_SECTION_ASM_OP
107 #define RDATA_SECTION_ASM_OP "\t.section .rdata"
108 #undef CTORS_SECTION_ASM_OP
109 #define CTORS_SECTION_ASM_OP "\t.section .ctors,\"x\""
110 #undef DTORS_SECTION_ASM_OP
111 #define DTORS_SECTION_ASM_OP "\t.section .dtors,\"x\""
113 /* A list of other sections which the compiler might be "in" at any
114 given time. */
116 #undef EXTRA_SECTIONS
117 #define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS in_rdata, in_ctors, in_dtors
119 #define SUBTARGET_EXTRA_SECTIONS
121 /* A list of extra section function definitions. */
123 #undef EXTRA_SECTION_FUNCTIONS
124 #define EXTRA_SECTION_FUNCTIONS \
125 RDATA_SECTION_FUNCTION \
126 CTORS_SECTION_FUNCTION \
127 DTORS_SECTION_FUNCTION \
128 SUBTARGET_EXTRA_SECTION_FUNCTIONS
130 #define SUBTARGET_EXTRA_SECTION_FUNCTIONS
132 #define RDATA_SECTION_FUNCTION \
133 void \
134 rdata_section () \
136 if (in_section != in_rdata) \
138 fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \
139 in_section = in_rdata; \
143 #define CTORS_SECTION_FUNCTION \
144 void \
145 ctors_section () \
147 if (in_section != in_ctors) \
149 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
150 in_section = in_ctors; \
154 #define DTORS_SECTION_FUNCTION \
155 void \
156 dtors_section () \
158 if (in_section != in_dtors) \
160 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
161 in_section = in_dtors; \
165 /* Support the ctors/dtors sections for g++. */
167 #define INT_ASM_OP ".word"
169 /* A C statement (sans semicolon) to output an element in the table of
170 global constructors. */
171 #undef ASM_OUTPUT_CONSTRUCTOR
172 #define ASM_OUTPUT_CONSTRUCTOR(STREAM, NAME) \
173 do \
175 ctors_section (); \
176 fprintf (STREAM, "\t%s\t ", INT_ASM_OP); \
177 assemble_name (STREAM, NAME); \
178 fprintf (STREAM, "\n"); \
180 while (0)
182 /* A C statement (sans semicolon) to output an element in the table of
183 global destructors. */
184 #undef ASM_OUTPUT_DESTRUCTOR
185 #define ASM_OUTPUT_DESTRUCTOR(STREAM, NAME) \
186 do \
188 dtors_section (); \
189 fprintf (STREAM, "\t%s\t ", INT_ASM_OP); \
190 assemble_name (STREAM, NAME); \
191 fprintf (STREAM, "\n"); \
193 while (0)
195 /* __CTOR_LIST__ and __DTOR_LIST__ must be defined by the linker script. */
196 #define CTOR_LISTS_DEFINED_EXTERNALLY
198 #undef DO_GLOBAL_CTORS_BODY
199 #undef DO_GLOBAL_DTORS_BODY
201 /* If you don't define HAVE_ATEXIT, and the object file format/OS/whatever
202 does not support constructors/destructors, then gcc implements destructors
203 by defining its own exit function, which calls the destructors. This gcc
204 exit function overrides the C library's exit function, and this can cause
205 all kinds of havoc if the C library has a non-trivial exit function. You
206 really don't want to use the exit function in libgcc2.c. */
207 #define HAVE_ATEXIT
209 /* The ARM development system defines __main. */
210 #define NAME__MAIN "__gccmain"
211 #define SYMBOL__MAIN __gccmain