diff options
author | Koen Kooi <koen@dominion.thruhere.net> | 2011-01-03 12:21:06 +0100 |
---|---|---|
committer | Koen Kooi <koen@dominion.thruhere.net> | 2011-01-03 12:21:06 +0100 |
commit | 60c9a5c925622682ab4189fcd7837798cbfdb9ca (patch) | |
tree | a04d1c536c090d8914594569aed5f28219fb5556 /recipes-devtools | |
parent | 1ec312f314343f287956dcab5482571039a94ff1 (diff) | |
download | meta-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.inc | 3 | ||||
-rw-r--r-- | recipes-devtools/gcc/gcc-4.5/gcc-arm-volatile-bitfield-fix.patch | 103 | ||||
-rw-r--r-- | recipes-devtools/gcc/gcc-cross_4.5.bb | 2 |
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 @@ | |||
1 | Date: Mon, 22 Nov 2010 13:28:54 +0000 | ||
2 | From: Julian Brown <julian at codesourcery dot com> | ||
3 | To: gcc-patches at gcc dot gnu dot org | ||
4 | Cc: DJ Delorie <dj at redhat dot com> | ||
5 | Subject: [PATCH] Volatile bitfields vs. inline asm memory constraints | ||
6 | Message-ID: <20101122132854.0aca431a@rex.config> | ||
7 | Mime-Version: 1.0 | ||
8 | Content-Type: multipart/mixed; boundary="MP_/ONpW806RnQ1ziaYj7_Y5E27" | ||
9 | X-IsSubscribed: yes | ||
10 | Mailing-List: contact gcc-patches-help at gcc dot gnu dot org; run by ezmlm | ||
11 | Precedence: bulk | ||
12 | List-Id: <gcc-patches.gcc.gnu.org> | ||
13 | List-Archive: <http://gcc.gnu.org/ml/gcc-patches/> | ||
14 | List-Post: <mailto:gcc-patches at gcc dot gnu dot org> | ||
15 | List-Help: <mailto:gcc-patches-help at gcc dot gnu dot org> | ||
16 | Sender: gcc-patches-owner at gcc dot gnu dot org | ||
17 | Delivered-To: mailing list gcc-patches at gcc dot gnu dot org | ||
18 | |||
19 | |||
20 | |||
21 | Hi, | ||
22 | |||
23 | This patch fixes the issue in the (Launchpad, not GCC) bug tracker: | ||
24 | |||
25 | https://bugs.launchpad.net/gcc-linaro/+bug/675347 | ||
26 | |||
27 | The problem was introduced by the patch from DJ to honour volatile | ||
28 | bitfield types: | ||
29 | |||
30 | http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01167.html | ||
31 | |||
32 | but not exposed (on ARM) until the option was made the default (on the | ||
33 | Linaro branch) -- it's not yet the default on mainline. | ||
34 | |||
35 | The issue is as follows: after DJ's patch and with | ||
36 | -fstrict-volatile-bitfields, in expr.c:expand_expr_real_1, the if | ||
37 | condition with the comment "In cases where an aligned union has an | ||
38 | unaligned object as a field, we might be extracting a BLKmode value | ||
39 | from an integer-mode (e.g., SImode) object [...]" triggers for a normal | ||
40 | (non-bitfield) volatile field of a struct/class. | ||
41 | |||
42 | But, this appears to be over-eager: in the particular case mentioned | ||
43 | above, when expanding a "volatile int" struct field used as a memory | ||
44 | constraint for an inline asm, we end up with something which is no | ||
45 | longer addressable (I think because of the actions of | ||
46 | extract_bit_field). So, compilation aborts. | ||
47 | |||
48 | My proposed fix is to restrict the conditional by only making it execute | ||
49 | for -fstrict-volatile-bitfields only for non-naturally-aligned accesses: | ||
50 | this appears to work (fixes test in question, and no regressions for | ||
51 | cross to ARM Linux, gcc/g++/libstdc++, with -fstrict-volatile-bitfields | ||
52 | turned on), but I don't know if there will be unintended consequences. | ||
53 | DJ, does it look sane to you? | ||
54 | |||
55 | Incidentally the constraints in the inline asm in the Launchpad | ||
56 | testcase might be slightly dubious (attempting to force (mem (reg)) by | ||
57 | using both "+m" (var) and "r" (&var) constraints), but replacing | ||
58 | them 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 | |||
71 | still leads to a warning (not an error) with trunk and | ||
72 | -fstrict-volatile-bitfields: | ||
73 | |||
74 | atomic-changed.cc:24:35: warning: use of memory input without lvalue in | ||
75 | asm operand 2 is deprecated [enabled by default] | ||
76 | |||
77 | The warning goes away with the attached patch. So, I don't think the | ||
78 | problem is purely that the original inline asm is invalid. | ||
79 | |||
80 | OK to apply, or any comments? | ||
81 | |||
82 | Julian | ||
83 | |||
84 | ChangeLog | ||
85 | |||
86 | gcc/ | ||
87 | * expr.c (expand_expr_real_1): Only use BLKmode for volatile | ||
88 | accesses which are not naturally aligned. | ||
89 | |||
90 | Index: 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 @@ | |||
1 | PR = "r11" | 1 | PR = "r12" |
2 | 2 | ||
3 | require gcc-${PV}.inc | 3 | require gcc-${PV}.inc |
4 | require gcc-cross4.inc | 4 | require gcc-cross4.inc |