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