summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Yanok <yanok@emcraft.com>2011-07-19 03:00:54 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-07-20 15:27:35 +0100
commit44f59d24d9cc3d8a15fd796d170233dc122d13b1 (patch)
tree29773aa7177ccd4d92bda36fe393d250a40a3f50
parent94a6e47402afe416d1c5657d6c60999b5b6e417f (diff)
downloadpoky-44f59d24d9cc3d8a15fd796d170233dc122d13b1.tar.gz
gcc_4.5.1: add pr44290.patch
Add fix for PR44290 as proposed in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44290 (From OE-Core rev: 94311ba57cd95b6b163d162587c6318da8c3b16a) Signed-off-by: Ilya Yanok <yanok@emcraft.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/pr44290.patch119
2 files changed, 120 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1.inc b/meta/recipes-devtools/gcc/gcc-4.5.1.inc
index efed414004..99f2ad61c4 100644
--- a/meta/recipes-devtools/gcc/gcc-4.5.1.inc
+++ b/meta/recipes-devtools/gcc/gcc-4.5.1.inc
@@ -59,6 +59,7 @@ SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
59 file://COLLECT_GCC_OPTIONS.patch \ 59 file://COLLECT_GCC_OPTIONS.patch \
60 file://use-defaults.h-and-t-oe-in-B.patch \ 60 file://use-defaults.h-and-t-oe-in-B.patch \
61 file://pr43810.patch \ 61 file://pr43810.patch \
62 file://pr44290.patch \
62 " 63 "
63 64
64SRC_URI_append_sh3 = " file://sh3-installfix-fixheaders.patch;patch=1 " 65SRC_URI_append_sh3 = " file://sh3-installfix-fixheaders.patch;patch=1 "
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/pr44290.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/pr44290.patch
new file mode 100644
index 0000000000..9cf187a423
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.5.1/pr44290.patch
@@ -0,0 +1,119 @@
1From cb13264f07c419149b86e19c2187729bda8dd47d Mon Sep 17 00:00:00 2001
2From: jiez <jiez@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Fri, 23 Jul 2010 14:47:46 +0000
4Subject: [PATCH 2/6] PR target/44290 * attribs.c (decl_attributes): Insert "noinline" and "noclone" if "naked". * tree-sra.c (ipa_sra_preliminary_function_checks): Return false if ! tree_versionable_function_p.
5
6 testsuite/
7 PR target/44290
8 * gcc.dg/pr44290-1.c: New test.
9 * gcc.dg/pr44290-2.c: New test.
10
11git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162466 138bc75d-0d04-0410-961f-82ee72b054a4
12---
13 gcc/attribs.c | 13 +++++++++++++
14 gcc/testsuite/gcc.dg/pr44290-1.c | 18 ++++++++++++++++++
15 gcc/testsuite/gcc.dg/pr44290-2.c | 24 ++++++++++++++++++++++++
16 gcc/tree-sra.c | 7 +++++++
17 4 files changed, 62 insertions(+), 0 deletions(-)
18 create mode 100644 gcc/testsuite/gcc.dg/pr44290-1.c
19 create mode 100644 gcc/testsuite/gcc.dg/pr44290-2.c
20
21diff --git a/gcc/attribs.c b/gcc/attribs.c
22index 4d91a0d..2e06608 100644
23--- a/gcc/attribs.c
24+++ b/gcc/attribs.c
25@@ -278,6 +278,19 @@ decl_attributes (tree *node, tree attributes, int flags)
26 TREE_VALUE (cur_attr) = chainon (opts, TREE_VALUE (cur_attr));
27 }
28
29+ /* A "naked" function attribute implies "noinline" and "noclone" for
30+ those targets that support it. */
31+ if (TREE_CODE (*node) == FUNCTION_DECL
32+ && lookup_attribute_spec (get_identifier ("naked"))
33+ && lookup_attribute ("naked", attributes) != NULL)
34+ {
35+ if (lookup_attribute ("noinline", attributes) == NULL)
36+ attributes = tree_cons (get_identifier ("noinline"), NULL, attributes);
37+
38+ if (lookup_attribute ("noclone", attributes) == NULL)
39+ attributes = tree_cons (get_identifier ("noclone"), NULL, attributes);
40+ }
41+
42 targetm.insert_attributes (*node, &attributes);
43
44 for (a = attributes; a; a = TREE_CHAIN (a))
45diff --git a/gcc/testsuite/gcc.dg/pr44290-1.c b/gcc/testsuite/gcc.dg/pr44290-1.c
46new file mode 100644
47index 0000000..071a271
48--- /dev/null
49+++ b/gcc/testsuite/gcc.dg/pr44290-1.c
50@@ -0,0 +1,18 @@
51+/* { dg-do compile { target arm*-*-* avr-*-* mcore-*-* rx-*-* spu-*-* } } */
52+/* { dg-options "-O2 -fdump-tree-optimized" } */
53+
54+static void __attribute__((naked))
55+foo(void *from, void *to)
56+{
57+ asm volatile("dummy"::"r"(from), "r"(to));
58+}
59+
60+unsigned int fie[2];
61+
62+void fum(void *to)
63+{
64+ foo(fie, to);
65+}
66+
67+/* { dg-final { scan-tree-dump "foo \\\(void \\\* from, void \\\* to\\\)" "optimized" } } */
68+/* { dg-final { cleanup-tree-dump "optimized" } } */
69diff --git a/gcc/testsuite/gcc.dg/pr44290-2.c b/gcc/testsuite/gcc.dg/pr44290-2.c
70new file mode 100644
71index 0000000..1951a51
72--- /dev/null
73+++ b/gcc/testsuite/gcc.dg/pr44290-2.c
74@@ -0,0 +1,24 @@
75+/* { dg-do compile { target arm*-*-* avr-*-* mcore-*-* rx-*-* spu-*-* } } */
76+/* { dg-options "-O2 -fdump-tree-optimized" } */
77+
78+static unsigned long __attribute__((naked))
79+foo (unsigned long base)
80+{
81+ asm volatile ("dummy");
82+}
83+unsigned long
84+bar (void)
85+{
86+ static int start, set;
87+
88+ if (!set)
89+ {
90+ set = 1;
91+ start = foo (0);
92+ }
93+
94+ return foo (start);
95+}
96+
97+/* { dg-final { scan-tree-dump "foo \\\(long unsigned int base\\\)" "optimized" } } */
98+/* { dg-final { cleanup-tree-dump "optimized" } } */
99diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
100index 6a5b577..ea37d97 100644
101--- a/gcc/tree-sra.c
102+++ b/gcc/tree-sra.c
103@@ -4126,6 +4126,13 @@ modify_function (struct cgraph_node *node, ipa_parm_adjustment_vec adjustments)
104 static bool
105 ipa_sra_preliminary_function_checks (struct cgraph_node *node)
106 {
107+ if (!tree_versionable_function_p (current_function_decl))
108+ {
109+ if (dump_file)
110+ fprintf (dump_file, "Function isn't allowed to be versioned.\n");
111+ return false;
112+ }
113+
114 if (!cgraph_node_can_be_local_p (node))
115 {
116 if (dump_file)
117--
1181.7.4
119