summaryrefslogtreecommitdiffstats
path: root/recipes-devtools
diff options
context:
space:
mode:
authorKoen Kooi <koen@dominion.thruhere.net>2011-01-03 12:21:06 +0100
committerKoen Kooi <koen@dominion.thruhere.net>2011-01-03 12:21:06 +0100
commit60c9a5c925622682ab4189fcd7837798cbfdb9ca (patch)
treea04d1c536c090d8914594569aed5f28219fb5556 /recipes-devtools
parent1ec312f314343f287956dcab5482571039a94ff1 (diff)
downloadmeta-openembedded-60c9a5c925622682ab4189fcd7837798cbfdb9ca.tar.gz
gcc: sync with OE
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'recipes-devtools')
-rw-r--r--recipes-devtools/gcc/gcc-4.5.inc3
-rw-r--r--recipes-devtools/gcc/gcc-4.5/gcc-arm-volatile-bitfield-fix.patch103
-rw-r--r--recipes-devtools/gcc/gcc-cross_4.5.bb2
3 files changed, 106 insertions, 2 deletions
diff --git a/recipes-devtools/gcc/gcc-4.5.inc b/recipes-devtools/gcc/gcc-4.5.inc
index 8f5148d4e..3728fa0e6 100644
--- a/recipes-devtools/gcc/gcc-4.5.inc
+++ b/recipes-devtools/gcc/gcc-4.5.inc
@@ -158,7 +158,8 @@ SRC_URI = "svn://gcc.gnu.org/svn/gcc/branches;module=${BRANCH} \
158 file://linaro/gcc-4.5-linaro-r99444.patch \ 158 file://linaro/gcc-4.5-linaro-r99444.patch \
159 file://gcc-scalar-widening-pr45847.patch \ 159 file://gcc-scalar-widening-pr45847.patch \
160 file://gcc-arm-qihi-split-PR46883.patch \ 160 file://gcc-arm-qihi-split-PR46883.patch \
161 \ 161 file://gcc-arm-volatile-bitfield-fix.patch \
162 \
162 file://optional_libstdc.patch \ 163 file://optional_libstdc.patch \
163 file://64bithack.patch \ 164 file://64bithack.patch \
164 " 165 "
diff --git a/recipes-devtools/gcc/gcc-4.5/gcc-arm-volatile-bitfield-fix.patch b/recipes-devtools/gcc/gcc-4.5/gcc-arm-volatile-bitfield-fix.patch
new file mode 100644
index 000000000..d5a31d19d
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.5/gcc-arm-volatile-bitfield-fix.patch
@@ -0,0 +1,103 @@
1Date: Mon, 22 Nov 2010 13:28:54 +0000
2From: Julian Brown <julian at codesourcery dot com>
3To: gcc-patches at gcc dot gnu dot org
4Cc: DJ Delorie <dj at redhat dot com>
5Subject: [PATCH] Volatile bitfields vs. inline asm memory constraints
6Message-ID: <20101122132854.0aca431a@rex.config>
7Mime-Version: 1.0
8Content-Type: multipart/mixed; boundary="MP_/ONpW806RnQ1ziaYj7_Y5E27"
9X-IsSubscribed: yes
10Mailing-List: contact gcc-patches-help at gcc dot gnu dot org; run by ezmlm
11Precedence: bulk
12List-Id: <gcc-patches.gcc.gnu.org>
13List-Archive: <http://gcc.gnu.org/ml/gcc-patches/>
14List-Post: <mailto:gcc-patches at gcc dot gnu dot org>
15List-Help: <mailto:gcc-patches-help at gcc dot gnu dot org>
16Sender: gcc-patches-owner at gcc dot gnu dot org
17Delivered-To: mailing list gcc-patches at gcc dot gnu dot org
18
19
20
21Hi,
22
23This patch fixes the issue in the (Launchpad, not GCC) bug tracker:
24
25https://bugs.launchpad.net/gcc-linaro/+bug/675347
26
27The problem was introduced by the patch from DJ to honour volatile
28bitfield types:
29
30http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01167.html
31
32but not exposed (on ARM) until the option was made the default (on the
33Linaro branch) -- it's not yet the default on mainline.
34
35The issue is as follows: after DJ's patch and with
36-fstrict-volatile-bitfields, in expr.c:expand_expr_real_1, the if
37condition with the comment "In cases where an aligned union has an
38unaligned object as a field, we might be extracting a BLKmode value
39from an integer-mode (e.g., SImode) object [...]" triggers for a normal
40(non-bitfield) volatile field of a struct/class.
41
42But, this appears to be over-eager: in the particular case mentioned
43above, when expanding a "volatile int" struct field used as a memory
44constraint for an inline asm, we end up with something which is no
45longer addressable (I think because of the actions of
46extract_bit_field). So, compilation aborts.
47
48My proposed fix is to restrict the conditional by only making it execute
49for -fstrict-volatile-bitfields only for non-naturally-aligned accesses:
50this appears to work (fixes test in question, and no regressions for
51cross to ARM Linux, gcc/g++/libstdc++, with -fstrict-volatile-bitfields
52turned on), but I don't know if there will be unintended consequences.
53DJ, does it look sane to you?
54
55Incidentally the constraints in the inline asm in the Launchpad
56testcase might be slightly dubious (attempting to force (mem (reg)) by
57using both "+m" (var) and "r" (&var) constraints), but replacing
58them with e.g.:
59
60 asm volatile("0:\n"
61 "ldrex %[newValue], %[_q_value]\n"
62 "sub %[newValue], %[newValue], #1\n"
63 "strex %[result], %[newValue], %[_q_value]\n"
64 "teq %[result], #0\n"
65 "bne 0b\n"
66 : [newValue] "=&r" (newValue),
67 [result] "=&r" (result)
68 : [_q_value] "Q" (_q_value)
69 : "cc", "memory");
70
71still leads to a warning (not an error) with trunk and
72-fstrict-volatile-bitfields:
73
74atomic-changed.cc:24:35: warning: use of memory input without lvalue in
75asm operand 2 is deprecated [enabled by default]
76
77The warning goes away with the attached patch. So, I don't think the
78problem is purely that the original inline asm is invalid.
79
80OK to apply, or any comments?
81
82Julian
83
84ChangeLog
85
86 gcc/
87 * expr.c (expand_expr_real_1): Only use BLKmode for volatile
88 accesses which are not naturally aligned.
89
90Index: gcc-4_5-branch/gcc/expr.c
91===================================================================
92--- gcc-4_5-branch.orig/gcc/expr.c 2010-12-23 00:42:11.690101002 -0800
93+++ gcc-4_5-branch/gcc/expr.c 2010-12-24 15:07:39.400101000 -0800
94@@ -9029,7 +9029,8 @@
95 && modifier != EXPAND_INITIALIZER)
96 /* If the field is volatile, we always want an aligned
97 access. */
98- || (volatilep && flag_strict_volatile_bitfields > 0)
99+ || (volatilep && flag_strict_volatile_bitfields > 0
100+ && (bitpos % GET_MODE_ALIGNMENT (mode) != 0))
101 /* If the field isn't aligned enough to fetch as a memref,
102 fetch it as a bit field. */
103 || (mode1 != BLKmode
diff --git a/recipes-devtools/gcc/gcc-cross_4.5.bb b/recipes-devtools/gcc/gcc-cross_4.5.bb
index 7f67acf28..d56045446 100644
--- a/recipes-devtools/gcc/gcc-cross_4.5.bb
+++ b/recipes-devtools/gcc/gcc-cross_4.5.bb
@@ -1,4 +1,4 @@
1PR = "r11" 1PR = "r12"
2 2
3require gcc-${PV}.inc 3require gcc-${PV}.inc
4require gcc-cross4.inc 4require gcc-cross4.inc