summaryrefslogtreecommitdiffstats
path: root/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106830.patch
diff options
context:
space:
mode:
Diffstat (limited to 'toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106830.patch')
-rw-r--r--toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106830.patch304
1 files changed, 0 insertions, 304 deletions
diff --git a/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106830.patch b/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106830.patch
deleted file mode 100644
index 695aa8559..000000000
--- a/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106830.patch
+++ /dev/null
@@ -1,304 +0,0 @@
12011-10-19 Andrew Stubbs <ams@codesourcery.com>
2
3 Backport from FSF:
4
5 2011-10-18 Andrew Stubbs <ams@codesourcery.com>
6
7 * config/arm/driver-arm.c (host_detect_local_cpu): Close the file
8 before exiting.
9
10 2011-10-18 Andrew Stubbs <ams@codesourcery.com>
11
12 gcc/
13 * config.host (arm*-*-linux*): Add driver-arm.o and x-arm.
14 * config/arm/arm.opt: Add 'native' processor_type and
15 arm_arch enum values.
16 * config/arm/arm.h (host_detect_local_cpu): New prototype.
17 (EXTRA_SPEC_FUNCTIONS): New define.
18 (MCPU_MTUNE_NATIVE_SPECS): New define.
19 (DRIVER_SELF_SPECS): New define.
20 * config/arm/driver-arm.c: New file.
21 * config/arm/x-arm: New file.
22 * doc/invoke.texi (ARM Options): Document -mcpu=native,
23 -mtune=native and -march=native.
24
25=== modified file 'gcc/config.host'
26--- old/gcc/config.host 2011-02-15 09:49:14 +0000
27+++ new/gcc/config.host 2011-10-19 17:01:50 +0000
28@@ -100,6 +100,14 @@
29 esac
30
31 case ${host} in
32+ arm*-*-linux*)
33+ case ${target} in
34+ arm*-*-*)
35+ host_extra_gcc_objs="driver-arm.o"
36+ host_xmake_file="${host_xmake_file} arm/x-arm"
37+ ;;
38+ esac
39+ ;;
40 alpha*-*-linux*)
41 case ${target} in
42 alpha*-*-linux*)
43
44=== modified file 'gcc/config/arm/arm.h'
45--- old/gcc/config/arm/arm.h 2011-10-19 16:46:51 +0000
46+++ new/gcc/config/arm/arm.h 2011-10-19 17:01:50 +0000
47@@ -2283,4 +2283,21 @@
48 " %{mcpu=generic-*:-march=%*;" \
49 " :%{mcpu=*:-mcpu=%*} %{march=*:-march=%*}}"
50
51+/* -mcpu=native handling only makes sense with compiler running on
52+ an ARM chip. */
53+#if defined(__arm__)
54+extern const char *host_detect_local_cpu (int argc, const char **argv);
55+# define EXTRA_SPEC_FUNCTIONS \
56+ { "local_cpu_detect", host_detect_local_cpu },
57+
58+# define MCPU_MTUNE_NATIVE_SPECS \
59+ " %{march=native:%<march=native %:local_cpu_detect(arch)}" \
60+ " %{mcpu=native:%<mcpu=native %:local_cpu_detect(cpu)}" \
61+ " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
62+#else
63+# define MCPU_MTUNE_NATIVE_SPECS ""
64+#endif
65+
66+#define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS
67+
68 #endif /* ! GCC_ARM_H */
69
70=== modified file 'gcc/config/arm/arm.opt'
71--- old/gcc/config/arm/arm.opt 2011-10-11 02:31:01 +0000
72+++ new/gcc/config/arm/arm.opt 2011-10-19 17:01:50 +0000
73@@ -48,6 +48,11 @@
74 Target RejectNegative Joined
75 Specify the name of the target architecture
76
77+; Other arm_arch values are loaded from arm-tables.opt
78+; but that is a generated file and this is an odd-one-out.
79+EnumValue
80+Enum(arm_arch) String(native) Value(-1) DriverOnly
81+
82 marm
83 Target RejectNegative InverseMask(THUMB) Undocumented
84
85@@ -153,6 +158,11 @@
86 Target RejectNegative Joined
87 Tune code for the given processor
88
89+; Other processor_type values are loaded from arm-tables.opt
90+; but that is a generated file and this is an odd-one-out.
91+EnumValue
92+Enum(processor_type) String(native) Value(-1) DriverOnly
93+
94 mwords-little-endian
95 Target Report RejectNegative Mask(LITTLE_WORDS)
96 Assume big endian bytes, little endian words
97
98=== added file 'gcc/config/arm/driver-arm.c'
99--- old/gcc/config/arm/driver-arm.c 1970-01-01 00:00:00 +0000
100+++ new/gcc/config/arm/driver-arm.c 2011-10-19 17:07:55 +0000
101@@ -0,0 +1,149 @@
102+/* Subroutines for the gcc driver.
103+ Copyright (C) 2011 Free Software Foundation, Inc.
104+
105+This file is part of GCC.
106+
107+GCC is free software; you can redistribute it and/or modify
108+it under the terms of the GNU General Public License as published by
109+the Free Software Foundation; either version 3, or (at your option)
110+any later version.
111+
112+GCC is distributed in the hope that it will be useful,
113+but WITHOUT ANY WARRANTY; without even the implied warranty of
114+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
115+GNU General Public License for more details.
116+
117+You should have received a copy of the GNU General Public License
118+along with GCC; see the file COPYING3. If not see
119+<http://www.gnu.org/licenses/>. */
120+
121+#include "config.h"
122+#include "system.h"
123+#include "coretypes.h"
124+#include "tm.h"
125+#include "configargs.h"
126+
127+struct vendor_cpu {
128+ const char *part_no;
129+ const char *arch_name;
130+ const char *cpu_name;
131+};
132+
133+static struct vendor_cpu arm_cpu_table[] = {
134+ {"0x926", "armv5te", "arm926ej-s"},
135+ {"0xa26", "armv5te", "arm1026ej-s"},
136+ {"0xb02", "armv6k", "mpcore"},
137+ {"0xb36", "armv6j", "arm1136j-s"},
138+ {"0xb56", "armv6t2", "arm1156t2-s"},
139+ {"0xb76", "armv6zk", "arm1176jz-s"},
140+ {"0xc05", "armv7-a", "cortex-a5"},
141+ {"0xc08", "armv7-a", "cortex-a8"},
142+ {"0xc09", "armv7-a", "cortex-a9"},
143+ {"0xc0f", "armv7-a", "cortex-a15"},
144+ {"0xc14", "armv7-r", "cortex-r4"},
145+ {"0xc15", "armv7-r", "cortex-r5"},
146+ {"0xc20", "armv6-m", "cortex-m0"},
147+ {"0xc21", "armv6-m", "cortex-m1"},
148+ {"0xc23", "armv7-m", "cortex-m3"},
149+ {"0xc24", "armv7e-m", "cortex-m4"},
150+ {NULL, NULL, NULL}
151+};
152+
153+struct {
154+ const char *vendor_no;
155+ const struct vendor_cpu *vendor_parts;
156+} vendors[] = {
157+ {"0x41", arm_cpu_table},
158+ {NULL, NULL}
159+};
160+
161+/* This will be called by the spec parser in gcc.c when it sees
162+ a %:local_cpu_detect(args) construct. Currently it will be called
163+ with either "arch", "cpu" or "tune" as argument depending on if
164+ -march=native, -mcpu=native or -mtune=native is to be substituted.
165+
166+ It returns a string containing new command line parameters to be
167+ put at the place of the above two options, depending on what CPU
168+ this is executed. E.g. "-march=armv7-a" on a Cortex-A8 for
169+ -march=native. If the routine can't detect a known processor,
170+ the -march or -mtune option is discarded.
171+
172+ ARGC and ARGV are set depending on the actual arguments given
173+ in the spec. */
174+const char *
175+host_detect_local_cpu (int argc, const char **argv)
176+{
177+ const char *val = NULL;
178+ char buf[128];
179+ FILE *f = NULL;
180+ bool arch;
181+ const struct vendor_cpu *cpu_table = NULL;
182+
183+ if (argc < 1)
184+ goto not_found;
185+
186+ arch = strcmp (argv[0], "arch") == 0;
187+ if (!arch && strcmp (argv[0], "cpu") != 0 && strcmp (argv[0], "tune"))
188+ goto not_found;
189+
190+ f = fopen ("/proc/cpuinfo", "r");
191+ if (f == NULL)
192+ goto not_found;
193+
194+ while (fgets (buf, sizeof (buf), f) != NULL)
195+ {
196+ /* Ensure that CPU implementer is ARM (0x41). */
197+ if (strncmp (buf, "CPU implementer", sizeof ("CPU implementer") - 1) == 0)
198+ {
199+ int i;
200+ for (i = 0; vendors[i].vendor_no != NULL; i++)
201+ if (strstr (buf, vendors[i].vendor_no) != NULL)
202+ {
203+ cpu_table = vendors[i].vendor_parts;
204+ break;
205+ }
206+ }
207+
208+ /* Detect arch/cpu. */
209+ if (strncmp (buf, "CPU part", sizeof ("CPU part") - 1) == 0)
210+ {
211+ int i;
212+
213+ if (cpu_table == NULL)
214+ goto not_found;
215+
216+ for (i = 0; cpu_table[i].part_no != NULL; i++)
217+ if (strstr (buf, cpu_table[i].part_no) != NULL)
218+ {
219+ val = arch ? cpu_table[i].arch_name : cpu_table[i].cpu_name;
220+ break;
221+ }
222+ break;
223+ }
224+ }
225+
226+ fclose (f);
227+
228+ if (val == NULL)
229+ goto not_found;
230+
231+ return concat ("-m", argv[0], "=", val, NULL);
232+
233+not_found:
234+ {
235+ unsigned int i;
236+ unsigned int opt;
237+ const char *search[] = {NULL, "arch"};
238+
239+ if (f)
240+ fclose (f);
241+
242+ search[0] = argv[0];
243+ for (opt = 0; opt < ARRAY_SIZE (search); opt++)
244+ for (i = 0; i < ARRAY_SIZE (configure_default_options); i++)
245+ if (strcmp (configure_default_options[i].name, search[opt]) == 0)
246+ return concat ("-m", search[opt], "=",
247+ configure_default_options[i].value, NULL);
248+ return NULL;
249+ }
250+}
251
252=== added file 'gcc/config/arm/x-arm'
253--- old/gcc/config/arm/x-arm 1970-01-01 00:00:00 +0000
254+++ new/gcc/config/arm/x-arm 2011-10-19 17:01:50 +0000
255@@ -0,0 +1,3 @@
256+driver-arm.o: $(srcdir)/config/arm/driver-arm.c \
257+ $(CONFIG_H) $(SYSTEM_H)
258+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
259
260=== modified file 'gcc/doc/invoke.texi'
261--- old/gcc/doc/invoke.texi 2011-10-19 16:46:51 +0000
262+++ new/gcc/doc/invoke.texi 2011-10-19 17:01:50 +0000
263@@ -10215,10 +10215,16 @@
264 @samp{cortex-m0},
265 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
266
267+
268 @option{-mcpu=generic-@var{arch}} is also permissible, and is
269 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
270 See @option{-mtune} for more information.
271
272+@option{-mcpu=native} causes the compiler to auto-detect the CPU
273+of the build computer. At present, this feature is only supported on
274+Linux, and not all architectures are recognised. If the auto-detect is
275+unsuccessful the option has no effect.
276+
277 @item -mtune=@var{name}
278 @opindex mtune
279 This option is very similar to the @option{-mcpu=} option, except that
280@@ -10237,6 +10243,11 @@
281 range, and avoiding performance pitfalls of other CPUs. The effects of
282 this option may change in future GCC versions as CPU models come and go.
283
284+@option{-mtune=native} causes the compiler to auto-detect the CPU
285+of the build computer. At present, this feature is only supported on
286+Linux, and not all architectures are recognised. If the auto-detect is
287+unsuccessful the option has no effect.
288+
289 @item -march=@var{name}
290 @opindex march
291 This specifies the name of the target ARM architecture. GCC uses this
292@@ -10250,6 +10261,11 @@
293 @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m},
294 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
295
296+@option{-march=native} causes the compiler to auto-detect the architecture
297+of the build computer. At present, this feature is only supported on
298+Linux, and not all architectures are recognised. If the auto-detect is
299+unsuccessful the option has no effect.
300+
301 @item -mfpu=@var{name}
302 @itemx -mfpe=@var{number}
303 @itemx -mfp=@var{number}
304