From: Hollis Blanchard Subject: [PATCH 7 of 7] user: define and use AR in configure scripts and Makefiles Date: Wed, 29 Oct 2008 13:27:55 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org To: avi@qumranet.com Return-path: Received: from e4.ny.us.ibm.com ([32.97.182.144]:46472 "EHLO e4.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752823AbYJ2S2P (ORCPT ); Wed, 29 Oct 2008 14:28:15 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e4.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m9TISEE0010426 for ; Wed, 29 Oct 2008 14:28:14 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id m9TISE8S131058 for ; Wed, 29 Oct 2008 14:28:14 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m9TIS70s010741 for ; Wed, 29 Oct 2008 14:28:07 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: libkvm/Makefile uses $(AR), but it's not defined by the top-level configure. The problem is that when cross-compiling for a 64-bit target on a 32-bit host, 32-bit ar will be used and the 64-bit code will fail to link. user/Makefile has the same problem, and even uses plain "ar". Add AR to configure and user/configure, and use it in the Makefiles. Signed-off-by: Hollis Blanchard diff --git a/configure b/configure --- a/configure +++ b/configure @@ -6,6 +6,7 @@ cc=gcc cc=gcc ld=ld objcopy=objcopy +ar=ar want_module=1 qemu_cflags= qemu_ldflags= @@ -141,6 +142,7 @@ CC=$cross_prefix$cc CC=$cross_prefix$cc LD=$cross_prefix$ld OBJCOPY=$cross_prefix$objcopy +AR=$cross_prefix$ar EOF cat < kernel/config.kbuild diff --git a/user/Makefile b/user/Makefile --- a/user/Makefile +++ b/user/Makefile @@ -48,7 +48,7 @@ kvmtrace: $(kvmtrace_objs) $(CC) $(LDFLAGS) $^ -o $@ $(libcflat): $(cflatobjs) - ar rcs $@ $^ + $(AR) rcs $@ $^ %.o: %.S $(CC) $(CFLAGS) -c -nostdlib -o $@ $^ diff --git a/user/configure b/user/configure --- a/user/configure +++ b/user/configure @@ -5,6 +5,7 @@ cc=gcc cc=gcc ld=ld objcopy=objcopy +ar=ar arch=`uname -m | sed -e s/i.86/i386/` processor="$arch" cross_prefix= @@ -70,4 +71,5 @@ CC=$cross_prefix$cc CC=$cross_prefix$cc LD=$cross_prefix$ld OBJCOPY=$cross_prefix$objcopy +AR=$cross_prefix$ar EOF