From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: Re: [kvm-unit-tests PATCH v2 1/2] powerpc: allow to build big-endian binaries on little-endian host Date: Fri, 26 Feb 2016 18:42:11 +0100 Message-ID: <20160226174211.zlesgk4fb5tvu6lf@hawk.localdomain> References: <1456506526-10803-1-git-send-email-lvivier@redhat.com> <1456506526-10803-2-git-send-email-lvivier@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, thuth@redhat.com, dgibson@redhat.com, agraf@suse.de, pbonzini@redhat.com To: Laurent Vivier Return-path: Received: from mx1.redhat.com ([209.132.183.28]:53063 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422800AbcBZRmU (ORCPT ); Fri, 26 Feb 2016 12:42:20 -0500 Content-Disposition: inline In-Reply-To: <1456506526-10803-2-git-send-email-lvivier@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: One nit though, $SUBJECT is super loooong.... On Fri, Feb 26, 2016 at 06:08:45PM +0100, Laurent Vivier wrote: > boot_rom will be always big endian (like SLOF is). > Make the endianness of the test files configurable with > arch_CFLAGS and arch_LDFLAGS. > > For the moment, this only works with big endian. > > Of course, once build on a little endian host, these binaries > can be used on the little endian host to test the > big endian mode of KVM. > > Signed-off-by: Laurent Vivier > --- > configure | 2 +- > powerpc/Makefile.common | 13 ++++++------- > powerpc/Makefile.ppc64 | 3 +++ > 3 files changed, 10 insertions(+), 8 deletions(-) > > diff --git a/configure b/configure > index 7d5702e..a685cca 100755 > --- a/configure > +++ b/configure > @@ -7,7 +7,7 @@ ld=ld > objcopy=objcopy > objdump=objdump > ar=ar > -arch=`uname -m | sed -e s/i.86/i386/ | sed -e 's/arm.*/arm/'` > +arch=`uname -m | sed -e 's/i.86/i386/;s/arm.*/arm/;s/ppc64.*/ppc64/'` > host=$arch > cross_prefix= > > diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common > index cad728e..cc27ac8 100644 > --- a/powerpc/Makefile.common > +++ b/powerpc/Makefile.common > @@ -11,6 +11,7 @@ all: $(TEST_DIR)/boot_rom.bin test_cases > > ################################################################## > > +CFLAGS += $(arch_CFLAGS) > CFLAGS += -std=gnu99 > CFLAGS += -ffreestanding > CFLAGS += -Wextra > @@ -30,13 +31,11 @@ cflatobjs += lib/powerpc/hcall.o > cflatobjs += lib/powerpc/setup.o > cflatobjs += lib/powerpc/rtas.o > > -libgcc := $(shell $(CC) $(machine) --print-libgcc-file-name) > - > -FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) > -%.elf: LDFLAGS = $(CFLAGS) -nostdlib -pie > +FLATLIBS = $(libcflat) $(LIBFDT_archive) > +%.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie > %.elf: %.o $(FLATLIBS) powerpc/flat.lds > - $(CC) $(LDFLAGS) -o $@ \ > - -Wl,-T,powerpc/flat.lds,--build-id=none \ > + $(LD) $(LDFLAGS) -o $@ \ > + -T powerpc/flat.lds --build-id=none \ > $(filter %.o, $^) $(FLATLIBS) > @echo -n Checking $@ for unsupported reloc types... > @if $(OBJDUMP) -R $@ | grep R_ | grep -v R_PPC64_RELATIVE; then \ > @@ -50,7 +49,7 @@ $(TEST_DIR)/boot_rom.bin: $(TEST_DIR)/boot_rom.elf > $(OBJCOPY) -O binary $^ >(cat - >>$@) > > $(TEST_DIR)/boot_rom.elf: $(TEST_DIR)/boot_rom.o > - $(LD) -nostdlib -Ttext=0x100 --entry=start --build-id=none -o $@ $< > + $(LD) -EB -nostdlib -Ttext=0x100 --entry=start --build-id=none -o $@ $< > > powerpc_clean: libfdt_clean asm_offsets_clean > $(RM) $(TEST_DIR)/*.{o,elf} $(TEST_DIR)/boot_rom.bin \ > diff --git a/powerpc/Makefile.ppc64 b/powerpc/Makefile.ppc64 > index 899dd5e..1cf277e 100644 > --- a/powerpc/Makefile.ppc64 > +++ b/powerpc/Makefile.ppc64 > @@ -6,6 +6,9 @@ > bits = 64 > ldarch = elf64-powerpc > > +arch_CFLAGS = -mbig-endian > +arch_LDFLAGS = -EB > + > cstart.o = $(TEST_DIR)/cstart64.o > reloc.o = $(TEST_DIR)/reloc64.o > cflatobjs += lib/ppc64/spinlock.o > -- > 2.5.0 > > -- > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Date: Fri, 26 Feb 2016 17:42:11 +0000 Subject: Re: [kvm-unit-tests PATCH v2 1/2] powerpc: allow to build big-endian binaries on little-endian host Message-Id: <20160226174211.zlesgk4fb5tvu6lf@hawk.localdomain> List-Id: References: <1456506526-10803-1-git-send-email-lvivier@redhat.com> <1456506526-10803-2-git-send-email-lvivier@redhat.com> In-Reply-To: <1456506526-10803-2-git-send-email-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Laurent Vivier Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, thuth@redhat.com, dgibson@redhat.com, agraf@suse.de, pbonzini@redhat.com One nit though, $SUBJECT is super loooong.... On Fri, Feb 26, 2016 at 06:08:45PM +0100, Laurent Vivier wrote: > boot_rom will be always big endian (like SLOF is). > Make the endianness of the test files configurable with > arch_CFLAGS and arch_LDFLAGS. > > For the moment, this only works with big endian. > > Of course, once build on a little endian host, these binaries > can be used on the little endian host to test the > big endian mode of KVM. > > Signed-off-by: Laurent Vivier > --- > configure | 2 +- > powerpc/Makefile.common | 13 ++++++------- > powerpc/Makefile.ppc64 | 3 +++ > 3 files changed, 10 insertions(+), 8 deletions(-) > > diff --git a/configure b/configure > index 7d5702e..a685cca 100755 > --- a/configure > +++ b/configure > @@ -7,7 +7,7 @@ ld=ld > objcopy=objcopy > objdump=objdump > ar=ar > -arch=`uname -m | sed -e s/i.86/i386/ | sed -e 's/arm.*/arm/'` > +arch=`uname -m | sed -e 's/i.86/i386/;s/arm.*/arm/;s/ppc64.*/ppc64/'` > host=$arch > cross_prefix> > diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common > index cad728e..cc27ac8 100644 > --- a/powerpc/Makefile.common > +++ b/powerpc/Makefile.common > @@ -11,6 +11,7 @@ all: $(TEST_DIR)/boot_rom.bin test_cases > > ################################################################## > > +CFLAGS += $(arch_CFLAGS) > CFLAGS += -std=gnu99 > CFLAGS += -ffreestanding > CFLAGS += -Wextra > @@ -30,13 +31,11 @@ cflatobjs += lib/powerpc/hcall.o > cflatobjs += lib/powerpc/setup.o > cflatobjs += lib/powerpc/rtas.o > > -libgcc := $(shell $(CC) $(machine) --print-libgcc-file-name) > - > -FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) > -%.elf: LDFLAGS = $(CFLAGS) -nostdlib -pie > +FLATLIBS = $(libcflat) $(LIBFDT_archive) > +%.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie > %.elf: %.o $(FLATLIBS) powerpc/flat.lds > - $(CC) $(LDFLAGS) -o $@ \ > - -Wl,-T,powerpc/flat.lds,--build-id=none \ > + $(LD) $(LDFLAGS) -o $@ \ > + -T powerpc/flat.lds --build-id=none \ > $(filter %.o, $^) $(FLATLIBS) > @echo -n Checking $@ for unsupported reloc types... > @if $(OBJDUMP) -R $@ | grep R_ | grep -v R_PPC64_RELATIVE; then \ > @@ -50,7 +49,7 @@ $(TEST_DIR)/boot_rom.bin: $(TEST_DIR)/boot_rom.elf > $(OBJCOPY) -O binary $^ >(cat - >>$@) > > $(TEST_DIR)/boot_rom.elf: $(TEST_DIR)/boot_rom.o > - $(LD) -nostdlib -Ttext=0x100 --entry=start --build-id=none -o $@ $< > + $(LD) -EB -nostdlib -Ttext=0x100 --entry=start --build-id=none -o $@ $< > > powerpc_clean: libfdt_clean asm_offsets_clean > $(RM) $(TEST_DIR)/*.{o,elf} $(TEST_DIR)/boot_rom.bin \ > diff --git a/powerpc/Makefile.ppc64 b/powerpc/Makefile.ppc64 > index 899dd5e..1cf277e 100644 > --- a/powerpc/Makefile.ppc64 > +++ b/powerpc/Makefile.ppc64 > @@ -6,6 +6,9 @@ > bits = 64 > ldarch = elf64-powerpc > > +arch_CFLAGS = -mbig-endian > +arch_LDFLAGS = -EB > + > cstart.o = $(TEST_DIR)/cstart64.o > reloc.o = $(TEST_DIR)/reloc64.o > cflatobjs += lib/ppc64/spinlock.o > -- > 2.5.0 > > -- > 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