update copyrights in config dir.
[official-gcc.git] / gcc / config / arm / unknown-elf.h
blob33bd9af459d4928c60d24064b181b370c3f1b5b1
1 /* Definitions for non-Linux based ARM systems using ELF
2 Copyright (C) 1998, 1999 Free Software Foundation, Inc.
3 Contributed by Catherine Moore <clm@cygnus.com>
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* Run-time Target Specification. */
23 #ifndef TARGET_VERSION
24 #define TARGET_VERSION fputs (" (ARM/ELF non-Linux)", stderr);
25 #endif
27 /* Default to using APCS-32 and software floating point. */
28 #ifndef TARGET_DEFAULT
29 #define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32)
30 #endif
32 /* Now we define the strings used to build the spec file. */
33 #define STARTFILE_SPEC "crtbegin%O%s crt0%O%s"
35 #define ENDFILE_SPEC "crtend%O%s"
37 #define USER_LABEL_PREFIX ""
38 #define LOCAL_LABEL_PREFIX "."
40 #define TEXT_SECTION " .text"
42 #define INVOKE__main
44 /* Debugging */
45 #define DWARF_DEBUGGING_INFO
46 #define DWARF2_DEBUGGING_INFO
47 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
49 /* Support for Constructors and Destrcutors . */
50 #define READONLY_DATA_SECTION rdata_section
52 /* A list of other sections which the compiler might be "in" at any
53 given time. */
54 #define SUBTARGET_EXTRA_SECTIONS in_rdata,
56 /* A list of extra section function definitions. */
57 #define SUBTARGET_EXTRA_SECTION_FUNCTIONS RDATA_SECTION_FUNCTION
59 #define RDATA_SECTION_ASM_OP "\t.section .rodata"
61 #define RDATA_SECTION_FUNCTION \
62 void \
63 rdata_section () \
64 { \
65 if (in_section != in_rdata) \
66 { \
67 fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \
68 in_section = in_rdata; \
69 } \
72 #define CTOR_LIST_BEGIN \
73 asm (CTORS_SECTION_ASM_OP); \
74 func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }
76 #define CTOR_LIST_END \
77 asm (CTORS_SECTION_ASM_OP); \
78 func_ptr __CTOR_END__[1] = { (func_ptr) 0 };
80 #define DTOR_LIST_BEGIN \
81 asm (DTORS_SECTION_ASM_OP); \
82 func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) }
84 #define DTOR_LIST_END \
85 asm (DTORS_SECTION_ASM_OP); \
86 func_ptr __DTOR_END__[1] = { (func_ptr) 0 };
88 /* A C statement to output something to the assembler file to switch to section
89 NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
90 NULL_TREE. Some target formats do not support arbitrary sections. Do not
91 define this macro in such cases. */
92 #define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
93 do \
94 { \
95 if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
96 fprintf (STREAM, "\t.section %s,\"ax\",%%progbits\n", NAME); \
97 else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
98 fprintf (STREAM, "\t.section %s,\"a\"\n", NAME); \
99 else if (! strncmp (NAME, ".bss", 4)) \
100 fprintf (STREAM, "\t.section %s,\"aw\",%%nobits\n", NAME); \
101 else \
102 fprintf (STREAM, "\t.section %s,\"aw\"\n", NAME); \
104 while (0)
106 /* Don't know how to order these. UNALIGNED_WORD_ASM_OP is in
107 dwarf2.out. */
108 #define UNALIGNED_WORD_ASM_OP ".4byte"
110 #define ASM_OUTPUT_DWARF2_ADDR_CONST(FILE,ADDR) \
111 fprintf ((FILE), "\t%s\t%s", UNALIGNED_WORD_ASM_OP, ADDR)
113 #define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,RTX) \
114 do { \
115 fprintf ((FILE), "\t%s\t", UNALIGNED_WORD_ASM_OP); \
116 output_addr_const ((FILE), (RTX)); \
117 fputc ('\n', (FILE)); \
118 } while (0)
121 /* The ARM development system defines __main. */
122 #define NAME__MAIN "__gccmain"
123 #define SYMBOL__MAIN __gccmain
125 /* Return a non-zero value if DECL has a section attribute. */
126 #define IN_NAMED_SECTION(DECL) \
127 ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL) \
128 && DECL_SECTION_NAME (DECL) != NULL_TREE)
131 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
133 #define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL) || flag_data_sections)
135 #define UNIQUE_SECTION(DECL, RELOC) \
136 do \
138 int len; \
139 int sec; \
140 char *name; \
141 char *string; \
142 char *prefix; \
143 static char *prefixes[4][2] = \
145 { ".text.", ".gnu.linkonce.t." }, \
146 { ".rodata.", ".gnu.linkonce.r." }, \
147 { ".data.", ".gnu.linkonce.d." }, \
148 { ".bss.", ".gnu.linkonce.b." } \
149 }; \
151 if (TREE_CODE (DECL) == FUNCTION_DECL) \
152 sec = 0; \
153 else if (DECL_INITIAL (DECL) == 0 \
154 || DECL_INITIAL (DECL) == error_mark_node) \
155 sec = 3; \
156 else if (DECL_READONLY_SECTION (DECL, RELOC)) \
157 sec = 1; \
158 else \
159 sec = 2; \
161 prefix = prefixes[sec][DECL_ONE_ONLY(DECL)]; \
162 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
164 /* Strip off any encoding in name. */ \
165 STRIP_NAME_ENCODING (name, name); \
167 len = strlen (name) + strlen (prefix); \
168 string = alloca (len + 1); \
170 sprintf (string, "%s%s", prefix, name); \
172 DECL_SECTION_NAME (DECL) = build_string (len, string); \
174 while (0)
176 #undef ASM_OUTPUT_ALIGNED_BSS
177 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
178 do \
180 if (IN_NAMED_SECTION (DECL)) \
181 named_section (DECL, NULL, 0); \
182 else \
183 bss_section (); \
185 ASM_GLOBALIZE_LABEL (FILE, NAME); \
187 ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \
189 last_assemble_variable_decl = DECL; \
190 ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL); \
191 ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1); \
193 while (0)
195 #undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
196 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
197 do \
199 if (IN_NAMED_SECTION (DECL)) \
200 named_section (DECL, NULL, 0); \
201 else \
202 bss_section (); \
204 ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \
205 ASM_OUTPUT_LABEL (FILE, NAME); \
206 fprintf (FILE, "\t.space\t%d\n", SIZE); \
208 while (0)
210 #ifndef CPP_APCS_PC_DEFAULT_SPEC
211 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
212 #endif
214 #ifndef SUBTARGET_CPU_DEFAULT
215 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm7tdmi
216 #endif
218 /* Now get the routine arm-elf definitions. */
219 #include "arm/elf.h"