Date:	Mon, 29 Sep 2008 16:17:52 -0400
From: Neil Horman <nhorman@tuxdriver.com>
To: cpw@sgi.com, linux-numa@vger.kernel.org

Subject: Fix build break in numactl-2.0.2

Hey-
i was just trying to update rawhide to numactl-2.0.2 and ran into a
build break.  It bailed out while building clearcache.c for numademo on i386
with the following error:
clearcache.c: In function clearcache:

clearcache.c:60: error: can't find a register in class BREG while reloading asm

I'm pretty lousy with asm, but after some reasearch it appeaered to me that it
was invalid to assing values to ebx while building code with -fPic (which I was
doing).

The below patch, which modifies the asm in quesition to use a register of the
compliers choosing, rather than ebx specifically, corrects the problem for me:

Regards
Neil
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>


per Andi Kleen:
The patch is wrong, cpuid has fixed output registers and using an arbitary
one is not correct.

It sounds like you're compiling numademo as PIC code. Why should you
do that? It's wrong.

Ok I guess you're using position independent executables, but that's
just a bad idea here.



 clearcache.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -up numactl-2.0.2/clearcache.c.orig numactl-2.0.2/clearcache.c
--- numactl-2.0.2/clearcache.c.orig	2008-09-29 16:08:38.000000000 -0400
+++ numactl-2.0.2/clearcache.c	2008-09-29 16:08:49.000000000 -0400
@@ -57,7 +57,7 @@ void clearcache(unsigned char *mem, unsi
 #if defined(__i386__) || defined(__x86_64__)
 	unsigned i, cl, eax, feat;
 	/* get clflush unit and feature */
-	asm("cpuid" : "=a" (eax), "=b" (cl), "=d" (feat) : "0" (1) : "cx");
+	asm("cpuid" : "=a" (eax), "=r" (cl), "=d" (feat) : "0" (1) : "cx");
 	if (!(feat & (1 << 19)))
 		fallback_clearcache();
 	cl = ((cl >> 8) & 0xff) * 8;
