]>
Commit | Line | Data |
---|---|---|
b355a481 | 1 | /* Definitions for non-Linux based ARM systems using ELF |
f22db2ef | 2 | Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. |
b355a481 NC |
3 | Contributed by Catherine Moore <clm@cygnus.com> |
4 | ||
5 | This file is part of GNU CC. | |
6 | ||
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. | |
11 | ||
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. | |
16 | ||
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. */ | |
21 | ||
22 | /* Run-time Target Specification. */ | |
e6592fff | 23 | #ifndef TARGET_VERSION |
bbc1b3f7 | 24 | #define TARGET_VERSION fputs (" (ARM/ELF non-Linux)", stderr); |
e6592fff | 25 | #endif |
b355a481 | 26 | |
b355a481 | 27 | /* Default to using APCS-32 and software floating point. */ |
0122a613 | 28 | #ifndef TARGET_DEFAULT |
d5b7b3ae | 29 | #define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME) |
0122a613 | 30 | #endif |
b355a481 NC |
31 | |
32 | /* Now we define the strings used to build the spec file. */ | |
33 | #define STARTFILE_SPEC "crtbegin%O%s crt0%O%s" | |
34 | ||
35 | #define ENDFILE_SPEC "crtend%O%s" | |
36 | ||
a1e27b76 | 37 | #define USER_LABEL_PREFIX "" |
b355a481 NC |
38 | #define LOCAL_LABEL_PREFIX "." |
39 | ||
40 | #define TEXT_SECTION " .text" | |
41 | ||
42 | #define INVOKE__main | |
43 | ||
44 | /* Debugging */ | |
45 | #define DWARF_DEBUGGING_INFO | |
46 | #define DWARF2_DEBUGGING_INFO | |
47 | #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG | |
48 | ||
49 | /* Support for Constructors and Destrcutors . */ | |
50 | #define READONLY_DATA_SECTION rdata_section | |
51 | ||
52 | /* A list of other sections which the compiler might be "in" at any | |
53 | given time. */ | |
54 | #define SUBTARGET_EXTRA_SECTIONS in_rdata, | |
55 | ||
56 | /* A list of extra section function definitions. */ | |
57 | #define SUBTARGET_EXTRA_SECTION_FUNCTIONS RDATA_SECTION_FUNCTION | |
58 | ||
59 | #define RDATA_SECTION_ASM_OP "\t.section .rodata" | |
60 | ||
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 | } \ | |
70 | } | |
71 | ||
7c262518 RH |
72 | /* Switch into a generic section. */ |
73 | #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section | |
b355a481 | 74 | |
b355a481 NC |
75 | /* The ARM development system defines __main. */ |
76 | #define NAME__MAIN "__gccmain" | |
77 | #define SYMBOL__MAIN __gccmain | |
78 | ||
a56e7c08 NC |
79 | /* Return a non-zero value if DECL has a section attribute. */ |
80 | #define IN_NAMED_SECTION(DECL) \ | |
81 | ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL) \ | |
82 | && DECL_SECTION_NAME (DECL) != NULL_TREE) | |
83 | ||
b355a481 | 84 | #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) |
d5b7b3ae | 85 | |
a56e7c08 NC |
86 | #define UNIQUE_SECTION(DECL, RELOC) \ |
87 | do \ | |
88 | { \ | |
89 | int len; \ | |
90 | int sec; \ | |
d5b7b3ae RE |
91 | const char * name; \ |
92 | char * string; \ | |
93 | char * prefix; \ | |
94 | static char * prefixes[4][2] = \ | |
a56e7c08 NC |
95 | { \ |
96 | { ".text.", ".gnu.linkonce.t." }, \ | |
97 | { ".rodata.", ".gnu.linkonce.r." }, \ | |
98 | { ".data.", ".gnu.linkonce.d." }, \ | |
99 | { ".bss.", ".gnu.linkonce.b." } \ | |
100 | }; \ | |
101 | \ | |
102 | if (TREE_CODE (DECL) == FUNCTION_DECL) \ | |
103 | sec = 0; \ | |
a56e7c08 NC |
104 | else if (DECL_READONLY_SECTION (DECL, RELOC)) \ |
105 | sec = 1; \ | |
265f5849 NC |
106 | else if (DECL_INITIAL (DECL) == NULL_TREE) \ |
107 | sec = 3; \ | |
a56e7c08 NC |
108 | else \ |
109 | sec = 2; \ | |
110 | \ | |
111 | prefix = prefixes[sec][DECL_ONE_ONLY(DECL)]; \ | |
112 | name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \ | |
113 | \ | |
114 | /* Strip off any encoding in name. */ \ | |
115 | STRIP_NAME_ENCODING (name, name); \ | |
116 | \ | |
117 | len = strlen (name) + strlen (prefix); \ | |
118 | string = alloca (len + 1); \ | |
119 | \ | |
120 | sprintf (string, "%s%s", prefix, name); \ | |
121 | \ | |
122 | DECL_SECTION_NAME (DECL) = build_string (len, string); \ | |
123 | } \ | |
124 | while (0) | |
125 | ||
126 | #undef ASM_OUTPUT_ALIGNED_BSS | |
127 | #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ | |
128 | do \ | |
129 | { \ | |
130 | if (IN_NAMED_SECTION (DECL)) \ | |
131 | named_section (DECL, NULL, 0); \ | |
132 | else \ | |
133 | bss_section (); \ | |
134 | \ | |
135 | ASM_GLOBALIZE_LABEL (FILE, NAME); \ | |
136 | \ | |
137 | ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \ | |
138 | \ | |
139 | last_assemble_variable_decl = DECL; \ | |
140 | ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL); \ | |
141 | ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1); \ | |
142 | } \ | |
143 | while (0) | |
144 | ||
145 | #undef ASM_OUTPUT_ALIGNED_DECL_LOCAL | |
146 | #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \ | |
147 | do \ | |
148 | { \ | |
149 | if (IN_NAMED_SECTION (DECL)) \ | |
150 | named_section (DECL, NULL, 0); \ | |
151 | else \ | |
152 | bss_section (); \ | |
153 | \ | |
154 | ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \ | |
155 | ASM_OUTPUT_LABEL (FILE, NAME); \ | |
156 | fprintf (FILE, "\t.space\t%d\n", SIZE); \ | |
157 | } \ | |
158 | while (0) | |
b355a481 | 159 | |
0122a613 | 160 | #ifndef CPP_APCS_PC_DEFAULT_SPEC |
b355a481 | 161 | #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" |
0122a613 NC |
162 | #endif |
163 | ||
164 | #ifndef SUBTARGET_CPU_DEFAULT | |
b355a481 | 165 | #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm7tdmi |
0122a613 | 166 | #endif |
d5b7b3ae | 167 | |
b355a481 | 168 | /* Now get the routine arm-elf definitions. */ |
d5b7b3ae | 169 | #include "elf.h" |