From patchwork Wed Aug 7 08:46:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 2839995 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BA4FABF535 for ; Wed, 7 Aug 2013 08:48:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A916A201E2 for ; Wed, 7 Aug 2013 08:48:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 92431201CD for ; Wed, 7 Aug 2013 08:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757232Ab3HGIrz (ORCPT ); Wed, 7 Aug 2013 04:47:55 -0400 Received: from ozlabs.org ([203.10.76.45]:58927 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755786Ab3HGIrx (ORCPT ); Wed, 7 Aug 2013 04:47:53 -0400 Received: by ozlabs.org (Postfix, from userid 1034) id 86DFC2C00CA; Wed, 7 Aug 2013 18:47:52 +1000 (EST) From: Michael Ellerman To: Cc: , Subject: [PATCH] kvm tools: Fix build of guest init with biarch powerpc compilers Date: Wed, 7 Aug 2013 18:46:47 +1000 Message-Id: <1375865207-11794-1-git-send-email-michael@ellerman.id.au> X-Mailer: git-send-email 1.8.1.2 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On powerpc we build kvmtool as a 64bit binary. We do that by setting -m64 in our CFLAGS. For most things we just call $(CC) and it passes that info onto the linker. However there is one place where we explicitly call the linker, in the build of guest/init - and in that case we need to tell the linker to build 64bit. We have gotten away with this so far because we have been building with a 64bit only toolchain. However if you build with a biarch toolchain, which generally defaults to 32bit, we fail to link. The fix is to defined LDFLAGS appropriately and pass it to LD. Tested on powerpc and x86-64. Signed-off-by: Michael Ellerman --- tools/kvm/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile index 8f996cd..b614aab 100644 --- a/tools/kvm/Makefile +++ b/tools/kvm/Makefile @@ -150,6 +150,7 @@ ifeq ($(ARCH), powerpc) OBJS += powerpc/xics.o ARCH_INCLUDE := powerpc/include CFLAGS += -m64 + LDFLAGS += -m elf64ppc ARCH_WANT_LIBFDT := y endif @@ -348,7 +349,7 @@ $(PROGRAM_ALIAS): $(PROGRAM) $(GUEST_INIT): guest/init.c $(E) " LINK " $@ $(Q) $(CC) -static guest/init.c -o $@ - $(Q) $(LD) -r -b binary -o guest/guest_init.o $(GUEST_INIT) + $(Q) $(LD) $(LDFLAGS) -r -b binary -o guest/guest_init.o $(GUEST_INIT) $(DEPS):