[PATCH] Fix immediate asm constraint for gcc 3 x86_64
From: Mathieu Desnoyers
Date: Fri May 16 2008 - 08:48:24 EST
* Jeremy Fitzhardinge (jeremy@xxxxxxxx) wrote:
> I'm getting this when I build for x86-64 with
>
> jeremy@cosworth:~/hg/xen/paravirt/linux-x86_64$ gcc -v
> Reading specs from /usr/lib/gcc/x86_64-linux/3.4.4/specs
> Configured with: ../src/configure -v
> --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
> --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4
> --enable-shared --with-system-zlib --enable-nls --without-included-gettext
> --program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
> --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
> --enable-java-awt=gtk --disable-werror x86_64-linux
> Thread model: posix
> gcc version 3.4.4 20050314 (prerelease) (Debian 3.4.3-13)
>
>
> CC kernel/sched.o
> /home/jeremy/hg/xen/paravirt/linux/kernel/sched_trace.h: In function
> `wait_task_inactive':
> /home/jeremy/hg/xen/paravirt/linux/kernel/sched_trace.h:5: warning: asm
> operand 1 probably doesn't match constraints
> /home/jeremy/hg/xen/paravirt/linux/kernel/sched_trace.h:5: error:
> impossible constraint in `asm'
> /home/jeremy/hg/xen/paravirt/linux/kernel/sched_trace.h:5: warning: 'value'
> might be used uninitialized in this function
> /home/jeremy/hg/xen/paravirt/linux/kernel/sched.c: At top level:
> /home/jeremy/hg/xen/paravirt/linux/kernel/sched_fair.c:1167: warning:
> 'wakeup_preempt_entity' defined but not used
> make[3]: *** [kernel/sched.o] Error 1
>
>
It seems that include/asm-x86/immediate.h in sched-devel.git causes
this. gcc-3.4 does not seem to like the "i" (&name##__imv) constraint. I
have seen no such problem with gcc-4.1. This is weird. It seems that
relaxing the constraint helps fixing this, but it's not clear whether
fixing the code or gcc-3.4 is the correct solution... here is the fix :
Fix immediate asm constraint for gcc 3 x86_64
make CC=gcc-3.4 HOSTCC=gcc-3.4 causes this problem with immediate values on
x86_64 :
kernel/sched_trace.h: In function `wait_task_inactive':
kernel/sched_trace.h:5: warning: asm operand 1 probably doesn't match constraints
kernel/sched_trace.h:5: error: impossible constraint in `asm'
kernel/sched_trace.h:5: warning: 'value' might be used uninitialized in this function
make[1]: *** [kernel/sched.o] Error 1
make: *** [kernel/] Error 2
gcc-4.1 does not have this problem.
Fix this by changing the "i" (&name##__imv) for a "g" (&name##__imv) constraint.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxx>
CC: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
CC: Ingo Molnar <mingo@xxxxxxx>
CC: "H. Peter Anvin" <hpa@xxxxxxxxx>
---
include/asm-x86/immediate.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: linux-2.6-sched-devel/include/asm-x86/immediate.h
===================================================================
--- linux-2.6-sched-devel.orig/include/asm-x86/immediate.h 2008-05-16 05:07:55.000000000 -0400
+++ linux-2.6-sched-devel/include/asm-x86/immediate.h 2008-05-16 05:08:29.000000000 -0400
@@ -63,7 +63,7 @@
"mov $0,%0\n\t" \
"3:\n\t" \
: "=q" (value) \
- : "i" (&name##__imv), \
+ : "g" (&name##__imv), \
"i" (sizeof(value))); \
break; \
case 2: \
@@ -81,7 +81,7 @@
"mov $0,%0\n\t" \
"3:\n\t" \
: "=r" (value) \
- : "i" (&name##__imv), \
+ : "g" (&name##__imv), \
"i" (sizeof(value))); \
break; \
case 8: \
@@ -102,7 +102,7 @@
"mov $0xFEFEFEFE01010101,%0\n\t" \
"3:\n\t" \
: "=r" (value) \
- : "i" (&name##__imv), \
+ : "g" (&name##__imv), \
"i" (sizeof(value))); \
break; \
}; \
@@ -143,7 +143,7 @@
"mov $0,%0\n\t" \
"3:\n\t" \
: "=a" (value) \
- : "i" (&name##__imv), \
+ : "g" (&name##__imv), \
"i" (sizeof(value)), \
"i" (sizeof(__typeof__(name##__imv)))); \
value; \
> Turning CONFIG_MARKER off avoids the problem.
>
> J
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/