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 <lvivier@xxxxxxxxxx> Reviewed-by: Andrew Jones <drjones@xxxxxxxxxx> > --- > 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@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html