The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: [PATCH] Fix immediate asm constraint for gcc 3 x86_64
Date: Fri, 16 May 2008 08:48:11 -0400	[thread overview]
Message-ID: <20080516124811.GC4226@Krystal> (raw)
In-Reply-To: <482AB6C5.4060604@goop.org>

* Jeremy Fitzhardinge (jeremy@goop.org) 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@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;							\




> Turning CONFIG_MARKER off avoids the problem.
>
>    J

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

  reply	other threads:[~2008-05-16 12:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-14  9:54 x86-64 build problem with tip Jeremy Fitzhardinge
2008-05-16 12:48 ` Mathieu Desnoyers [this message]
2008-05-16 21:32   ` [PATCH] Fix immediate asm constraint for gcc 3 x86_64 H. Peter Anvin
2008-05-21 13:31     ` Mathieu Desnoyers
     [not found]       ` <48344239.9070003@zytor.com>
     [not found]         ` <20080521160217.GA26974@Krystal>
2008-05-21 17:01           ` [PATCH] Fix Immediate Values x86_64 support old gcc Mathieu Desnoyers
2008-05-21 20:37             ` Sam Ravnborg
2008-05-21 21:28               ` Mathieu Desnoyers
2008-05-21 21:46                 ` Sam Ravnborg
2008-05-21 21:57                   ` [PATCH] Fix Immediate Values x86_64 support old gcc (v2) Mathieu Desnoyers
2008-05-21 22:38                     ` Sam Ravnborg
2008-05-21 23:24                       ` [PATCH] Fix Immediate Values x86_64 support old gcc (v3) Mathieu Desnoyers
2008-05-22  2:03                         ` Mathieu Desnoyers
2008-05-25  7:21                           ` Sam Ravnborg
2008-05-27 13:12                             ` [PATCH ftrace.git sched-fixes.git] " Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080516124811.GC4226@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=hpa@zytor.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox