From mboxrd@z Thu Jan 1 00:00:00 1970 From: Prerna Saxena Subject: Re: kvmtool : [PATCH] PowerPc : Fix compilation for ppc64 Date: Thu, 11 Apr 2013 22:23:06 +0530 Message-ID: <5166EA72.3020004@linux.vnet.ibm.com> References: <20130409225958.760c72ac@zephyr.in.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Pekka Enberg , KVM General , Michael Ellerman , Sasha Levin To: Sasha Levin Return-path: Received: from e23smtp07.au.ibm.com ([202.81.31.140]:38035 "EHLO e23smtp07.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935114Ab3DKQ5i (ORCPT ); Thu, 11 Apr 2013 12:57:38 -0400 Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Apr 2013 02:48:35 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 1D742357804E for ; Fri, 12 Apr 2013 02:57:33 +1000 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r3BGhgjD58917076 for ; Fri, 12 Apr 2013 02:43:43 +1000 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r3BGv1QO021711 for ; Fri, 12 Apr 2013 02:57:02 +1000 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 04/10/2013 09:05 PM, Sasha Levin wrote: > Hm, what would LD create before this patch? I thought that the default > would be to create a binary that corresponds to the platform you're > building in, so if you build on ppc64 you'd get ppc64 binaries, no? > Hi Sasha, Thanks for the prompt response. Powerpc had historically supported 32 bit userspace on a 64 bit kernel, before everything moved 64 bit. I'd hit this issue since the default output of 'ld' was turning out to be 'elf32-powerpc' on my ppc64 build machine. This was running ld-2.22. I found that adding '--oformat=elf64-powerpc' to the Makefile helped me tide over it, so I sent a patch to that end. Today, I verified on another ppc64 machine that ld is automatically choosing 'elf64-powerpc'. This machine is running 'ld-2.23' So, this patch can be ignored, since it appears to be a toolchain dependency. Or, we could put it in place, to ensure kvmtool builds dont break even if the toolchain is not perfectly configured. As you suggest :) Regards, Prerna > > > On Wed, Apr 10, 2013 at 2:44 AM, Pekka Enberg > wrote: > > On Tue, Apr 9, 2013 at 8:29 PM, Prerna Saxena > > wrote: > > 'lkvm' compilation on ppc64 fails with the following error : > > ...[snip].. > > LINK guest/init > > LINK lkvm > > /usr/bin/ld: powerpc:common architecture of input file > `guest/guest_init.o' > > is incompatible with powerpc:common64 output > > collect2: ld returned 1 exit status > > make: *** [lkvm] Error 1 > > > > This patch corrects the error above, and enables 'lkvm' to compile > on ppc64 > > architecture. > > > > Signed-off-by: Prerna Saxena > > > --- > > tools/kvm/Makefile | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile > > index 0c59faa..269e29e 100644 > > --- a/tools/kvm/Makefile > > +++ b/tools/kvm/Makefile > > @@ -335,7 +335,11 @@ $(PROGRAM_ALIAS): $(PROGRAM) > > $(GUEST_INIT): guest/init.c > > $(E) " LINK " $@ > > $(Q) $(CC) -static guest/init.c -o $@ > > +ifeq ($(ARCH), powerpc) > > + $(Q) $(LD) -r -b binary --oformat elf64-powerpc -o > guest/guest_init.o $(GUEST_INIT) > > +else > > $(Q) $(LD) -r -b binary -o guest/guest_init.o $(GUEST_INIT) > > +endif > > > > $(DEPS): > > > > -- > > 1.7.10.4 > > Michael, Sasha, comments? > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India