aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2013-08-07 18:46:47 +1000
committerWill Deacon <will.deacon@arm.com>2015-06-01 16:39:54 +0100
commit393cba1732999e751c3bc53d2f2ce8ae0eb066c7 (patch)
treed72d53998fbed8df9558caa76394da58fb1235e6
parent5f3aaf228169257ce4a73b86eab315d6a951bc79 (diff)
downloadkvmtool-393cba1732999e751c3bc53d2f2ce8ae0eb066c7.tar.gz
kvm tools: Fix build of guest init with biarch powerpc compilers
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> Signed-off-by: Pekka Enberg <penberg@kernel.org>
-rw-r--r--Makefile3
1 files changed, 2 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 8f996cd6..b614aab7 100644
--- a/Makefile
+++ b/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):