From patchwork Fri Jun 19 01:08:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 486539 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 8E3ED14029C for ; Fri, 19 Jun 2015 11:08:47 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752446AbbFSBIn (ORCPT ); Thu, 18 Jun 2015 21:08:43 -0400 Received: from ozlabs.org ([103.22.144.67]:34821 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751926AbbFSBIm (ORCPT ); Thu, 18 Jun 2015 21:08:42 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 366271401AF; Fri, 19 Jun 2015 11:08:41 +1000 (AEST) Message-ID: <1434676121.23771.1.camel@ellerman.id.au> Subject: Re: [PATCH 2/3] powerpc: use default endianness for converting guest/init From: Michael Ellerman To: Andre Przywara Cc: Will Deacon , Matt Evans , "kvm-ppc@vger.kernel.org" , "kvm@vger.kernel.org" , Vaidyanathan Srinivasan Date: Fri, 19 Jun 2015 11:08:41 +1000 In-Reply-To: <5582DB16.8060808@arm.com> References: <1434534230-17249-1-git-send-email-andre.przywara@arm.com> <1434534230-17249-3-git-send-email-andre.przywara@arm.com> <5582DB16.8060808@arm.com> X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org On Thu, 2015-06-18 at 15:52 +0100, Andre Przywara wrote: > Hi, > > On 06/17/2015 10:43 AM, Andre Przywara wrote: > > For converting the guest/init binary into an object file, we call > > the linker binary, setting the endianness to big endian explicitly > > when compiling kvmtool for powerpc. > > This breaks if the compiler is actually targetting little endian > > (which is true for the Debian port, for instance). > > Remove the explicit big endianness switch from the linker call to > > allow linking on little endian PowerPC builds again. > > > > Signed-off-by: Andre Przywara > > --- > > Hi, > > > > this fixed the powerpc64le build for me, while still compiling fine > > for big endian. Admittedly this whole init->guest_init.o conversion > > has its issues (with MIPS, for instance), which deserve proper fixing, > > but lets just fix that build for now. > > Will was concerned about breaking toolchains where the linker does not > default to 64-bit. Is that an issue we care about? Yeah, that would be Debian & Ubuntu BE at least, and maybe Fedora too? I'm not sure how you compiled it big endian? > AFAICT LDFLAGS is only used in this dodgy binary-to-object-file > conversion of guest/init. For this we rely on the resulting .o file to > have the same ELF target as the other object files to be finally linked > into the lkvm binary. As we don't compile guest/init with CFLAGS, there > is a possible mismatch. > > I am looking into a proper fix for this now (compiling guest/init with > CFLAGS, calling $CC with linker options instead of $LD and allowing CC > and LD override). Still struggling with MIPS, though :-( Yeah that's obviously a better solution medium term. Can you do something like this? Sorry untested: cheers --- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Makefile b/Makefile index 6110b8e..8663d67 100644 --- a/Makefile +++ b/Makefile @@ -149,7 +149,11 @@ ifeq ($(ARCH), powerpc) OBJS += powerpc/xics.o ARCH_INCLUDE := powerpc/include CFLAGS += -m64 - LDFLAGS += -m elf64ppc + ifeq ($(call try-build,$(SOURCE_HELLO),$(CFLAGS),-m elf64ppc),y) + LDFLAGS += -m elf64ppc + else + LDFLAGS += -m elf64leppc + endif ARCH_WANT_LIBFDT := y endif