diff options
author | Mark Salter <msalter@redhat.com> | 2009-10-01 18:44:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-01 19:11:12 -0400 |
commit | d22a001bf6a502e978a8617e3f297b4d762cfbb5 (patch) | |
tree | 6291200ec18203153ff6e26a666bd7809659b371 /arch/mn10300/include/asm/uaccess.h | |
parent | 933d35f00cfaf99985515c7c212d9dee30b1a1fb (diff) |
mn10300: fix kernel build failures when using gcc-4.x
Fix some build failures when using gcc-4.x for MN10300.
Firstly, __get_user() fails to build because the pointer points to a const and
__gu_val ends up being read-only:
In file included from include/linux/mempolicy.h:62,
from init/main.c:50:
include/linux/pagemap.h: In function 'fault_in_pages_readable':
include/linux/pagemap.h:394: error: read-only variable '__gu_val' used as 'asm' output
include/linux/pagemap.h:394: error: read-only variable '__gu_val' used as 'asm' output
include/linux/pagemap.h:394: error: read-only variable '__gu_val' used as 'asm' output
include/linux/pagemap.h:400: error: read-only variable '__gu_val' used as 'asm' output
include/linux/pagemap.h:400: error: read-only variable '__gu_val' used as 'asm' output
include/linux/pagemap.h:400: error: read-only variable '__gu_val' used as 'asm' output
make[1]: *** [init/main.o] Error 1
Secondly, gcc-4 doesn't allow casts of lvalues:
UPD include/linux/compile.h
arch/mn10300/kernel/rtc.c: In function 'calibrate_clock':
arch/mn10300/kernel/rtc.c:170: error: lvalue required as left operand of assignment
arch/mn10300/kernel/rtc.c:172: error: lvalue required as left operand of assignment
make[1]: *** [arch/mn10300/kernel/rtc.o] Error 1
These are seen with gcc 4.2.1.
Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/mn10300/include/asm/uaccess.h')
-rw-r--r-- | arch/mn10300/include/asm/uaccess.h | 73 |
1 files changed, 39 insertions, 34 deletions
diff --git a/arch/mn10300/include/asm/uaccess.h b/arch/mn10300/include/asm/uaccess.h index 8a3a4dd55763..167e10ff06d9 100644 --- a/arch/mn10300/include/asm/uaccess.h +++ b/arch/mn10300/include/asm/uaccess.h | |||
@@ -129,42 +129,47 @@ extern int fixup_exception(struct pt_regs *regs); | |||
129 | struct __large_struct { unsigned long buf[100]; }; | 129 | struct __large_struct { unsigned long buf[100]; }; |
130 | #define __m(x) (*(struct __large_struct *)(x)) | 130 | #define __m(x) (*(struct __large_struct *)(x)) |
131 | 131 | ||
132 | #define __get_user_nocheck(x, ptr, size) \ | 132 | #define __get_user_nocheck(x, ptr, size) \ |
133 | ({ \ | 133 | ({ \ |
134 | __typeof(*(ptr)) __gu_val; \ | 134 | unsigned long __gu_addr; \ |
135 | unsigned long __gu_addr; \ | 135 | int __gu_err; \ |
136 | int __gu_err; \ | 136 | __gu_addr = (unsigned long) (ptr); \ |
137 | __gu_addr = (unsigned long) (ptr); \ | 137 | switch (size) { \ |
138 | switch (size) { \ | 138 | case 1: { \ |
139 | case 1: __get_user_asm("bu"); break; \ | 139 | unsigned char __gu_val; \ |
140 | case 2: __get_user_asm("hu"); break; \ | 140 | __get_user_asm("bu"); \ |
141 | case 4: __get_user_asm("" ); break; \ | 141 | (x) = *(__force __typeof__(*(ptr))*) &__gu_val; \ |
142 | default: __get_user_unknown(); break; \ | 142 | break; \ |
143 | } \ | 143 | } \ |
144 | x = (__typeof__(*(ptr))) __gu_val; \ | 144 | case 2: { \ |
145 | __gu_err; \ | 145 | unsigned short __gu_val; \ |
146 | __get_user_asm("hu"); \ | ||
147 | (x) = *(__force __typeof__(*(ptr))*) &__gu_val; \ | ||
148 | break; \ | ||
149 | } \ | ||
150 | case 4: { \ | ||
151 | unsigned int __gu_val; \ | ||
152 | __get_user_asm(""); \ | ||
153 | (x) = *(__force __typeof__(*(ptr))*) &__gu_val; \ | ||
154 | break; \ | ||
155 | } \ | ||
156 | default: \ | ||
157 | __get_user_unknown(); \ | ||
158 | break; \ | ||
159 | } \ | ||
160 | __gu_err; \ | ||
146 | }) | 161 | }) |
147 | 162 | ||
148 | #define __get_user_check(x, ptr, size) \ | 163 | #define __get_user_check(x, ptr, size) \ |
149 | ({ \ | 164 | ({ \ |
150 | __typeof__(*(ptr)) __gu_val; \ | 165 | int _e; \ |
151 | unsigned long __gu_addr; \ | 166 | if (likely(__access_ok((unsigned long) (ptr), (size)))) \ |
152 | int __gu_err; \ | 167 | _e = __get_user_nocheck((x), (ptr), (size)); \ |
153 | __gu_addr = (unsigned long) (ptr); \ | 168 | else { \ |
154 | if (likely(__access_ok(__gu_addr,size))) { \ | 169 | _e = -EFAULT; \ |
155 | switch (size) { \ | 170 | (x) = (__typeof__(x))0; \ |
156 | case 1: __get_user_asm("bu"); break; \ | 171 | } \ |
157 | case 2: __get_user_asm("hu"); break; \ | 172 | _e; \ |
158 | case 4: __get_user_asm("" ); break; \ | ||
159 | default: __get_user_unknown(); break; \ | ||
160 | } \ | ||
161 | } \ | ||
162 | else { \ | ||
163 | __gu_err = -EFAULT; \ | ||
164 | __gu_val = 0; \ | ||
165 | } \ | ||
166 | x = (__typeof__(*(ptr))) __gu_val; \ | ||
167 | __gu_err; \ | ||
168 | }) | 173 | }) |
169 | 174 | ||
170 | #define __get_user_asm(INSN) \ | 175 | #define __get_user_asm(INSN) \ |