mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: <penberg@kernel.org>
Cc: <kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] kvm tools: Fix build of guest init with biarch powerpc compilers
Date: Wed,  7 Aug 2013 18:46:47 +1000	[thread overview]
Message-ID: <1375865207-11794-1-git-send-email-michael@ellerman.id.au> (raw)

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 <michael@ellerman.id.au>
---
 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):
 
-- 
1.8.1.2


             reply	other threads:[~2013-08-07  8:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-07  8:46 Michael Ellerman [this message]
2013-08-10  6:51 ` Pekka Enberg

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=1375865207-11794-1-git-send-email-michael@ellerman.id.au \
    --to=michael@ellerman.id.au \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@kernel.org \
    /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

all inboxes | Powered by JetHome®