[PATCH] Fix immediate asm constraint for gcc 3 x86_64

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Mathieu Desnoyers
Date: Friday, May 16, 2008 - 5:48 am

* Jeremy Fitzhardinge (jeremy@goop.org) wrote:

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@polymtl.ca>
CC: Jeremy Fitzhardinge <jeremy@goop.org>
CC: Ingo Molnar <mingo@elte.hu>
CC: "H. Peter Anvin" <hpa@zytor.com>
---
 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;							\





-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
x86-64 build problem with tip, Jeremy Fitzhardinge, (Wed May 14, 2:54 am)
[PATCH] Fix immediate asm constraint for gcc 3 x86_64, Mathieu Desnoyers, (Fri May 16, 5:48 am)
Re: [PATCH] Fix immediate asm constraint for gcc 3 x86_64, H. Peter Anvin, (Fri May 16, 2:32 pm)
Re: [PATCH] Fix immediate asm constraint for gcc 3 x86_64, Mathieu Desnoyers, (Wed May 21, 6:31 am)