diff options
Diffstat (limited to 'meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99412.patch')
-rw-r--r-- | meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99412.patch | 316 |
1 files changed, 316 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99412.patch b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99412.patch new file mode 100644 index 000000000..c0aabbeb5 --- /dev/null +++ b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99412.patch | |||
@@ -0,0 +1,316 @@ | |||
1 | 2010-10-09 Jie Zhang <jie@codesourcery.com> | ||
2 | |||
3 | Backport from mainline: | ||
4 | |||
5 | gcc/ | ||
6 | 2010-06-03 Paul Brook <paul@codesourcery.com> | ||
7 | * config/arm/arm.c (FL_TUNE): Define. | ||
8 | (arm_default_cpu, arm_cpu_select): Remove. | ||
9 | (all_cores): Populate core field. | ||
10 | (arm_selected_arch, arm_selected_cpu, arm_selected_tune): New. | ||
11 | (arm_find_cpu): New function. | ||
12 | (arm_handle_option): Lookup cpu/architecture names. | ||
13 | (arm_override_options): Cleanup mcpu/march/mtune handling. | ||
14 | (arm_file_start): Ditto. | ||
15 | |||
16 | === modified file 'gcc/config/arm/arm.c' | ||
17 | Index: gcc-4.5/gcc/config/arm/arm.c | ||
18 | =================================================================== | ||
19 | --- gcc-4.5.orig/gcc/config/arm/arm.c | ||
20 | +++ gcc-4.5/gcc/config/arm/arm.c | ||
21 | @@ -550,9 +550,6 @@ enum processor_type arm_tune = arm_none; | ||
22 | /* The current tuning set. */ | ||
23 | const struct tune_params *current_tune; | ||
24 | |||
25 | -/* The default processor used if not overridden by commandline. */ | ||
26 | -static enum processor_type arm_default_cpu = arm_none; | ||
27 | - | ||
28 | /* Which floating point hardware to schedule for. */ | ||
29 | int arm_fpu_attr; | ||
30 | |||
31 | @@ -608,6 +605,10 @@ static int thumb_call_reg_needed; | ||
32 | |||
33 | #define FL_IWMMXT (1 << 29) /* XScale v2 or "Intel Wireless MMX technology". */ | ||
34 | |||
35 | +/* Flags that only effect tuning, not available instructions. */ | ||
36 | +#define FL_TUNE (FL_WBUF | FL_VFPV2 | FL_STRONG | FL_LDSCHED \ | ||
37 | + | FL_CO_PROC) | ||
38 | + | ||
39 | #define FL_FOR_ARCH2 FL_NOTM | ||
40 | #define FL_FOR_ARCH3 (FL_FOR_ARCH2 | FL_MODE32) | ||
41 | #define FL_FOR_ARCH3M (FL_FOR_ARCH3 | FL_ARCH3M) | ||
42 | @@ -808,7 +809,7 @@ static const struct processors all_cores | ||
43 | { | ||
44 | /* ARM Cores */ | ||
45 | #define ARM_CORE(NAME, IDENT, ARCH, FLAGS, COSTS) \ | ||
46 | - {NAME, arm_none, #ARCH, FLAGS | FL_FOR_ARCH##ARCH, &arm_##COSTS##_tune}, | ||
47 | + {NAME, IDENT, #ARCH, FLAGS | FL_FOR_ARCH##ARCH, &arm_##COSTS##_tune}, | ||
48 | #include "arm-cores.def" | ||
49 | #undef ARM_CORE | ||
50 | {NULL, arm_none, NULL, 0, NULL} | ||
51 | @@ -850,29 +851,12 @@ static const struct processors all_archi | ||
52 | {NULL, arm_none, NULL, 0 , NULL} | ||
53 | }; | ||
54 | |||
55 | -struct arm_cpu_select | ||
56 | -{ | ||
57 | - const char * string; | ||
58 | - const char * name; | ||
59 | - const struct processors * processors; | ||
60 | -}; | ||
61 | - | ||
62 | -/* This is a magic structure. The 'string' field is magically filled in | ||
63 | - with a pointer to the value specified by the user on the command line | ||
64 | - assuming that the user has specified such a value. */ | ||
65 | - | ||
66 | -static struct arm_cpu_select arm_select[] = | ||
67 | -{ | ||
68 | - /* string name processors */ | ||
69 | - { NULL, "-mcpu=", all_cores }, | ||
70 | - { NULL, "-march=", all_architectures }, | ||
71 | - { NULL, "-mtune=", all_cores } | ||
72 | -}; | ||
73 | |||
74 | -/* Defines representing the indexes into the above table. */ | ||
75 | -#define ARM_OPT_SET_CPU 0 | ||
76 | -#define ARM_OPT_SET_ARCH 1 | ||
77 | -#define ARM_OPT_SET_TUNE 2 | ||
78 | +/* These are populated as commandline arguments are processed, or NULL | ||
79 | + if not specified. */ | ||
80 | +static const struct processors *arm_selected_arch; | ||
81 | +static const struct processors *arm_selected_cpu; | ||
82 | +static const struct processors *arm_selected_tune; | ||
83 | |||
84 | /* The name of the preprocessor macro to define for this architecture. */ | ||
85 | |||
86 | @@ -1234,6 +1218,24 @@ arm_gimplify_va_arg_expr (tree valist, t | ||
87 | return std_gimplify_va_arg_expr (valist, type, pre_p, post_p); | ||
88 | } | ||
89 | |||
90 | +/* Lookup NAME in SEL. */ | ||
91 | + | ||
92 | +static const struct processors * | ||
93 | +arm_find_cpu (const char *name, const struct processors *sel, const char *desc) | ||
94 | +{ | ||
95 | + if (!(name && *name)) | ||
96 | + return NULL; | ||
97 | + | ||
98 | + for (; sel->name != NULL; sel++) | ||
99 | + { | ||
100 | + if (streq (name, sel->name)) | ||
101 | + return sel; | ||
102 | + } | ||
103 | + | ||
104 | + error ("bad value (%s) for %s switch", name, desc); | ||
105 | + return NULL; | ||
106 | +} | ||
107 | + | ||
108 | /* Implement TARGET_HANDLE_OPTION. */ | ||
109 | |||
110 | static bool | ||
111 | @@ -1242,11 +1244,11 @@ arm_handle_option (size_t code, const ch | ||
112 | switch (code) | ||
113 | { | ||
114 | case OPT_march_: | ||
115 | - arm_select[1].string = arg; | ||
116 | + arm_selected_arch = arm_find_cpu(arg, all_architectures, "-march"); | ||
117 | return true; | ||
118 | |||
119 | case OPT_mcpu_: | ||
120 | - arm_select[0].string = arg; | ||
121 | + arm_selected_cpu = arm_find_cpu(arg, all_cores, "-mcpu"); | ||
122 | return true; | ||
123 | |||
124 | case OPT_mhard_float: | ||
125 | @@ -1258,7 +1260,7 @@ arm_handle_option (size_t code, const ch | ||
126 | return true; | ||
127 | |||
128 | case OPT_mtune_: | ||
129 | - arm_select[2].string = arg; | ||
130 | + arm_selected_tune = arm_find_cpu(arg, all_cores, "-mtune"); | ||
131 | return true; | ||
132 | |||
133 | default: | ||
134 | @@ -1358,88 +1360,52 @@ void | ||
135 | arm_override_options (void) | ||
136 | { | ||
137 | unsigned i; | ||
138 | - enum processor_type target_arch_cpu = arm_none; | ||
139 | - enum processor_type selected_cpu = arm_none; | ||
140 | |||
141 | - /* Set up the flags based on the cpu/architecture selected by the user. */ | ||
142 | - for (i = ARRAY_SIZE (arm_select); i--;) | ||
143 | + if (arm_selected_arch) | ||
144 | { | ||
145 | - struct arm_cpu_select * ptr = arm_select + i; | ||
146 | - | ||
147 | - if (ptr->string != NULL && ptr->string[0] != '\0') | ||
148 | - { | ||
149 | - const struct processors * sel; | ||
150 | - | ||
151 | - for (sel = ptr->processors; sel->name != NULL; sel++) | ||
152 | - if (streq (ptr->string, sel->name)) | ||
153 | - { | ||
154 | - /* Set the architecture define. */ | ||
155 | - if (i != ARM_OPT_SET_TUNE) | ||
156 | - sprintf (arm_arch_name, "__ARM_ARCH_%s__", sel->arch); | ||
157 | - | ||
158 | - /* Determine the processor core for which we should | ||
159 | - tune code-generation. */ | ||
160 | - if (/* -mcpu= is a sensible default. */ | ||
161 | - i == ARM_OPT_SET_CPU | ||
162 | - /* -mtune= overrides -mcpu= and -march=. */ | ||
163 | - || i == ARM_OPT_SET_TUNE) | ||
164 | - arm_tune = (enum processor_type) (sel - ptr->processors); | ||
165 | - | ||
166 | - /* Remember the CPU associated with this architecture. | ||
167 | - If no other option is used to set the CPU type, | ||
168 | - we'll use this to guess the most suitable tuning | ||
169 | - options. */ | ||
170 | - if (i == ARM_OPT_SET_ARCH) | ||
171 | - target_arch_cpu = sel->core; | ||
172 | - | ||
173 | - if (i == ARM_OPT_SET_CPU) | ||
174 | - selected_cpu = (enum processor_type) (sel - ptr->processors); | ||
175 | - | ||
176 | - if (i != ARM_OPT_SET_TUNE) | ||
177 | - { | ||
178 | - /* If we have been given an architecture and a processor | ||
179 | - make sure that they are compatible. We only generate | ||
180 | - a warning though, and we prefer the CPU over the | ||
181 | - architecture. */ | ||
182 | - if (insn_flags != 0 && (insn_flags ^ sel->flags)) | ||
183 | - warning (0, "switch -mcpu=%s conflicts with -march= switch", | ||
184 | - ptr->string); | ||
185 | - | ||
186 | - insn_flags = sel->flags; | ||
187 | - } | ||
188 | - | ||
189 | - break; | ||
190 | - } | ||
191 | + if (arm_selected_cpu) | ||
192 | + { | ||
193 | + /* Check for conflict between mcpu and march */ | ||
194 | + if ((arm_selected_cpu->flags ^ arm_selected_arch->flags) & ~FL_TUNE) | ||
195 | + { | ||
196 | + warning (0, "switch -mcpu=%s conflicts with -march=%s switch", | ||
197 | + arm_selected_cpu->name, arm_selected_arch->name); | ||
198 | + /* -march wins for code generation. | ||
199 | + -mcpu wins for default tuning. */ | ||
200 | + if (!arm_selected_tune) | ||
201 | + arm_selected_tune = arm_selected_cpu; | ||
202 | |||
203 | - if (sel->name == NULL) | ||
204 | - error ("bad value (%s) for %s switch", ptr->string, ptr->name); | ||
205 | - } | ||
206 | + arm_selected_cpu = arm_selected_arch; | ||
207 | + } | ||
208 | + else | ||
209 | + /* -mcpu wins. */ | ||
210 | + arm_selected_arch = NULL; | ||
211 | + } | ||
212 | + else | ||
213 | + /* Pick a CPU based on the architecture. */ | ||
214 | + arm_selected_cpu = arm_selected_arch; | ||
215 | } | ||
216 | |||
217 | - /* Guess the tuning options from the architecture if necessary. */ | ||
218 | - if (arm_tune == arm_none) | ||
219 | - arm_tune = target_arch_cpu; | ||
220 | - | ||
221 | /* If the user did not specify a processor, choose one for them. */ | ||
222 | - if (insn_flags == 0) | ||
223 | + if (!arm_selected_cpu) | ||
224 | { | ||
225 | const struct processors * sel; | ||
226 | unsigned int sought; | ||
227 | |||
228 | - selected_cpu = (enum processor_type) TARGET_CPU_DEFAULT; | ||
229 | - if (selected_cpu == arm_none) | ||
230 | + arm_selected_cpu = &all_cores[TARGET_CPU_DEFAULT]; | ||
231 | + if (!arm_selected_cpu->name) | ||
232 | { | ||
233 | #ifdef SUBTARGET_CPU_DEFAULT | ||
234 | /* Use the subtarget default CPU if none was specified by | ||
235 | configure. */ | ||
236 | - selected_cpu = (enum processor_type) SUBTARGET_CPU_DEFAULT; | ||
237 | + arm_selected_cpu = &all_cores[SUBTARGET_CPU_DEFAULT]; | ||
238 | #endif | ||
239 | /* Default to ARM6. */ | ||
240 | - if (selected_cpu == arm_none) | ||
241 | - selected_cpu = arm6; | ||
242 | + if (arm_selected_cpu->name) | ||
243 | + arm_selected_cpu = &all_cores[arm6]; | ||
244 | } | ||
245 | - sel = &all_cores[selected_cpu]; | ||
246 | |||
247 | + sel = arm_selected_cpu; | ||
248 | insn_flags = sel->flags; | ||
249 | |||
250 | /* Now check to see if the user has specified some command line | ||
251 | @@ -1500,17 +1466,21 @@ arm_override_options (void) | ||
252 | sel = best_fit; | ||
253 | } | ||
254 | |||
255 | - insn_flags = sel->flags; | ||
256 | + arm_selected_cpu = sel; | ||
257 | } | ||
258 | - sprintf (arm_arch_name, "__ARM_ARCH_%s__", sel->arch); | ||
259 | - arm_default_cpu = (enum processor_type) (sel - all_cores); | ||
260 | - if (arm_tune == arm_none) | ||
261 | - arm_tune = arm_default_cpu; | ||
262 | } | ||
263 | |||
264 | - /* The processor for which we should tune should now have been | ||
265 | - chosen. */ | ||
266 | - gcc_assert (arm_tune != arm_none); | ||
267 | + gcc_assert (arm_selected_cpu); | ||
268 | + /* The selected cpu may be an architecture, so lookup tuning by core ID. */ | ||
269 | + if (!arm_selected_tune) | ||
270 | + arm_selected_tune = &all_cores[arm_selected_cpu->core]; | ||
271 | + | ||
272 | + sprintf (arm_arch_name, "__ARM_ARCH_%s__", arm_selected_cpu->arch); | ||
273 | + insn_flags = arm_selected_cpu->flags; | ||
274 | + | ||
275 | + arm_tune = arm_selected_tune->core; | ||
276 | + tune_flags = arm_selected_tune->flags; | ||
277 | + current_tune = arm_selected_tune->tune; | ||
278 | |||
279 | if (arm_tune == cortexa8 && optimize >= 3) | ||
280 | { | ||
281 | @@ -1522,9 +1492,6 @@ arm_override_options (void) | ||
282 | align_jumps = 16; | ||
283 | } | ||
284 | |||
285 | - tune_flags = all_cores[(int)arm_tune].flags; | ||
286 | - current_tune = all_cores[(int)arm_tune].tune; | ||
287 | - | ||
288 | if (target_fp16_format_name) | ||
289 | { | ||
290 | for (i = 0; i < ARRAY_SIZE (all_fp16_formats); i++) | ||
291 | @@ -1907,7 +1874,7 @@ arm_override_options (void) | ||
292 | /* Enable -mfix-cortex-m3-ldrd by default for Cortex-M3 cores. */ | ||
293 | if (fix_cm3_ldrd == 2) | ||
294 | { | ||
295 | - if (selected_cpu == cortexm3) | ||
296 | + if (arm_selected_cpu->core == cortexm3) | ||
297 | fix_cm3_ldrd = 1; | ||
298 | else | ||
299 | fix_cm3_ldrd = 0; | ||
300 | @@ -21235,13 +21202,10 @@ arm_file_start (void) | ||
301 | if (TARGET_BPABI) | ||
302 | { | ||
303 | const char *fpu_name; | ||
304 | - if (arm_select[0].string) | ||
305 | - asm_fprintf (asm_out_file, "\t.cpu %s\n", arm_select[0].string); | ||
306 | - else if (arm_select[1].string) | ||
307 | - asm_fprintf (asm_out_file, "\t.arch %s\n", arm_select[1].string); | ||
308 | + if (arm_selected_arch) | ||
309 | + asm_fprintf (asm_out_file, "\t.arch %s\n", arm_selected_arch->name); | ||
310 | else | ||
311 | - asm_fprintf (asm_out_file, "\t.cpu %s\n", | ||
312 | - all_cores[arm_default_cpu].name); | ||
313 | + asm_fprintf (asm_out_file, "\t.cpu %s\n", arm_selected_cpu->name); | ||
314 | |||
315 | if (TARGET_SOFT_FLOAT) | ||
316 | { | ||