]>
Commit | Line | Data |
---|---|---|
cb805c2d | 1 | /* Definitions of target machine for GNU compiler, for ARM with PE obj format. |
c3d4c143 | 2 | Copyright (C) 1995, 1996, 1999, 2000, 2002, 2003, 2004, 2005 |
61f0ccff | 3 | Free Software Foundation, Inc. |
cb805c2d NC |
4 | Contributed by Doug Evans (dje@cygnus.com). |
5 | ||
4f448245 NC |
6 | This file is part of GCC. |
7 | ||
8 | GCC is free software; you can redistribute it and/or modify it | |
9 | under the terms of the GNU General Public License as published | |
10 | by the Free Software Foundation; either version 2, or (at your | |
11 | option) any later version. | |
12 | ||
13 | GCC is distributed in the hope that it will be useful, but WITHOUT | |
14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
15 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | |
16 | License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GCC; see the file COPYING. If not, write to | |
39d14dda KC |
20 | the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
21 | Boston, MA 02110-1301, USA. */ | |
cb805c2d | 22 | |
d5b7b3ae RE |
23 | /* Enable PE specific code. */ |
24 | #define ARM_PE 1 | |
25 | ||
c27ba912 DM |
26 | #define ARM_PE_FLAG_CHAR '@' |
27 | ||
28 | /* Ensure that @x. will be stripped from the function name. */ | |
950a3816 | 29 | #undef SUBTARGET_NAME_ENCODING_LENGTHS |
c27ba912 DM |
30 | #define SUBTARGET_NAME_ENCODING_LENGTHS \ |
31 | case ARM_PE_FLAG_CHAR: return 3; | |
32 | ||
cb805c2d NC |
33 | #undef USER_LABEL_PREFIX |
34 | #define USER_LABEL_PREFIX "_" | |
35 | ||
36 | \f | |
37 | /* Run-time Target Specification. */ | |
38 | #undef TARGET_VERSION | |
39 | #define TARGET_VERSION fputs (" (ARM/pe)", stderr) | |
40 | ||
672a6f42 NB |
41 | /* Get tree.c to declare a target-specific specialization of |
42 | merge_decl_attributes. */ | |
b2ca3702 | 43 | #define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1 |
672a6f42 | 44 | |
d5b7b3ae | 45 | #undef SUBTARGET_CPP_SPEC |
63c5b495 | 46 | #define SUBTARGET_CPP_SPEC "-D__pe__" |
d5b7b3ae | 47 | |
cb805c2d | 48 | #undef TARGET_DEFAULT |
c54c7322 | 49 | #define TARGET_DEFAULT (MASK_NOP_FUN_DLLIMPORT) |
3bcb1bb0 | 50 | |
52f97a3b NC |
51 | #undef MULTILIB_DEFAULTS |
52 | #define MULTILIB_DEFAULTS \ | |
61f0ccff | 53 | { "marm", "mlittle-endian", "msoft-float", "mno-thumb-interwork" } |
cb805c2d NC |
54 | \f |
55 | #undef WCHAR_TYPE | |
3bcb1bb0 | 56 | #define WCHAR_TYPE "short unsigned int" |
cb805c2d NC |
57 | #undef WCHAR_TYPE_SIZE |
58 | #define WCHAR_TYPE_SIZE 16 | |
59 | ||
2ed0b52a NC |
60 | /* r11 is fixed. */ |
61 | #undef SUBTARGET_CONDITIONAL_REGISTER_USAGE | |
62 | #define SUBTARGET_CONDITIONAL_REGISTER_USAGE \ | |
63 | fixed_regs [11] = 1; \ | |
64 | call_used_regs [11] = 1; | |
65 | ||
cb805c2d | 66 | \f |
15072eb1 ZW |
67 | /* PE/COFF uses explicit import from shared libraries. */ |
68 | #define MULTIPLE_SYMBOL_SPACES 1 | |
cb805c2d | 69 | |
ae46c4e0 | 70 | #define TARGET_ASM_UNIQUE_SECTION arm_pe_unique_section |
ab5c8549 | 71 | #define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section |
cb805c2d NC |
72 | |
73 | #define SUPPORTS_ONE_ONLY 1 | |
74 | ||
7c262518 | 75 | /* Switch into a generic section. */ |
52f97a3b | 76 | #undef TARGET_ASM_NAMED_SECTION |
7c262518 | 77 | #define TARGET_ASM_NAMED_SECTION default_pe_asm_named_section |
cb805c2d | 78 | \f |
1bc7c5b6 | 79 | #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true |
cb805c2d NC |
80 | |
81 | /* Output a reference to a label. */ | |
82 | #undef ASM_OUTPUT_LABELREF | |
83 | #define ASM_OUTPUT_LABELREF(STREAM, NAME) \ | |
d5b7b3ae | 84 | asm_fprintf (STREAM, "%U%s", arm_strip_name_encoding (NAME)) |
cb805c2d NC |
85 | |
86 | /* Output a function definition label. */ | |
87 | #undef ASM_DECLARE_FUNCTION_NAME | |
d5b7b3ae RE |
88 | #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ |
89 | do \ | |
90 | { \ | |
91 | if (arm_dllexport_name_p (NAME)) \ | |
92 | { \ | |
93 | drectve_section (); \ | |
94 | fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \ | |
95 | arm_strip_name_encoding (NAME)); \ | |
96 | function_section (DECL); \ | |
97 | } \ | |
98 | ARM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL); \ | |
99 | if (TARGET_THUMB) \ | |
100 | fprintf (STREAM, "\t.code 16\n"); \ | |
101 | ASM_OUTPUT_LABEL (STREAM, NAME); \ | |
102 | } \ | |
3bcb1bb0 | 103 | while (0) |
cb805c2d NC |
104 | |
105 | /* Output a common block. */ | |
106 | #undef ASM_OUTPUT_COMMON | |
3bcb1bb0 NC |
107 | #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \ |
108 | do \ | |
cb805c2d | 109 | { \ |
3bcb1bb0 NC |
110 | if (arm_dllexport_name_p (NAME)) \ |
111 | { \ | |
112 | drectve_section (); \ | |
113 | fprintf ((STREAM), "\t.ascii \" -export:%s\"\n",\ | |
c27ba912 | 114 | arm_strip_name_encoding (NAME)); \ |
3bcb1bb0 NC |
115 | } \ |
116 | if (! arm_dllimport_name_p (NAME)) \ | |
117 | { \ | |
118 | fprintf ((STREAM), "\t.comm\t"); \ | |
119 | assemble_name ((STREAM), (NAME)); \ | |
120 | asm_fprintf ((STREAM), ", %d\t%@ %d\n", \ | |
74eda121 | 121 | (int)(ROUNDED), (int)(SIZE)); \ |
3bcb1bb0 | 122 | } \ |
cb805c2d | 123 | } \ |
3bcb1bb0 | 124 | while (0) |
cb805c2d NC |
125 | |
126 | /* Output the label for an initialized variable. */ | |
127 | #undef ASM_DECLARE_OBJECT_NAME | |
3bcb1bb0 NC |
128 | #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \ |
129 | do \ | |
cb805c2d | 130 | { \ |
3bcb1bb0 NC |
131 | if (arm_dllexport_name_p (NAME)) \ |
132 | { \ | |
133 | enum in_section save_section = in_section; \ | |
134 | drectve_section (); \ | |
135 | fprintf (STREAM, "\t.ascii \" -export:%s\"\n",\ | |
c27ba912 | 136 | arm_strip_name_encoding (NAME)); \ |
3bcb1bb0 NC |
137 | switch_to_section (save_section, (DECL)); \ |
138 | } \ | |
139 | ASM_OUTPUT_LABEL ((STREAM), (NAME)); \ | |
cb805c2d | 140 | } \ |
3bcb1bb0 | 141 | while (0) |
cb805c2d NC |
142 | \f |
143 | /* Support the ctors/dtors and other sections. */ | |
144 | ||
145 | #define DRECTVE_SECTION_ASM_OP "\t.section .drectve" | |
146 | ||
147 | /* A list of other sections which the compiler might be "in" at any | |
148 | given time. */ | |
149 | ||
fb49053f RH |
150 | #undef EXTRA_SECTIONS |
151 | #define EXTRA_SECTIONS in_drectve | |
cb805c2d NC |
152 | |
153 | /* A list of extra section function definitions. */ | |
154 | ||
fb49053f RH |
155 | #undef EXTRA_SECTION_FUNCTIONS |
156 | #define EXTRA_SECTION_FUNCTIONS \ | |
cb805c2d NC |
157 | DRECTVE_SECTION_FUNCTION \ |
158 | SWITCH_TO_SECTION_FUNCTION | |
159 | ||
160 | #define DRECTVE_SECTION_FUNCTION \ | |
161 | void \ | |
4241d312 | 162 | drectve_section (void) \ |
cb805c2d NC |
163 | { \ |
164 | if (in_section != in_drectve) \ | |
165 | { \ | |
166 | fprintf (asm_out_file, "%s\n", DRECTVE_SECTION_ASM_OP); \ | |
167 | in_section = in_drectve; \ | |
168 | } \ | |
169 | } | |
170 | ||
171 | /* Switch to SECTION (an `enum in_section'). | |
172 | ||
173 | ??? This facility should be provided by GCC proper. | |
174 | The problem is that we want to temporarily switch sections in | |
175 | ASM_DECLARE_OBJECT_NAME and then switch back to the original section | |
176 | afterwards. */ | |
3bcb1bb0 | 177 | #define SWITCH_TO_SECTION_FUNCTION \ |
adf97f58 | 178 | static void \ |
4241d312 | 179 | switch_to_section (enum in_section section, tree decl) \ |
3bcb1bb0 NC |
180 | { \ |
181 | switch (section) \ | |
182 | { \ | |
183 | case in_text: text_section (); break; \ | |
9fb32434 | 184 | case in_unlikely_executed_text: unlikely_text_section (); break; \ |
3bcb1bb0 NC |
185 | case in_data: data_section (); break; \ |
186 | case in_named: named_section (decl, NULL, 0); break; \ | |
fb49053f | 187 | case in_readonly_data: readonly_data_section (); break; \ |
3bcb1bb0 NC |
188 | case in_ctors: ctors_section (); break; \ |
189 | case in_dtors: dtors_section (); break; \ | |
190 | case in_drectve: drectve_section (); break; \ | |
191 | default: abort (); break; \ | |
192 | } \ | |
cb805c2d | 193 | } |
4241d312 | 194 |