All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org
Cc: drjones@redhat.com, thuth@redhat.com, dgibson@redhat.com,
	agraf@suse.de, pbonzini@redhat.com,
	Laurent Vivier <lvivier@redhat.com>
Subject: [kvm-unit-tests PATCH v2 1/2] powerpc: allow to build big-endian binaries on little-endian host
Date: Fri, 26 Feb 2016 18:08:45 +0100	[thread overview]
Message-ID: <1456506526-10803-2-git-send-email-lvivier@redhat.com> (raw)
In-Reply-To: <1456506526-10803-1-git-send-email-lvivier@redhat.com>

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@redhat.com>
---
 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


WARNING: multiple messages have this Message-ID (diff)
From: Laurent Vivier <lvivier@redhat.com>
To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org
Cc: drjones@redhat.com, thuth@redhat.com, dgibson@redhat.com,
	agraf@suse.de, pbonzini@redhat.com,
	Laurent Vivier <lvivier@redhat.com>
Subject: [kvm-unit-tests PATCH v2 1/2] powerpc: allow to build big-endian binaries on little-endian host
Date: Fri, 26 Feb 2016 17:08:45 +0000	[thread overview]
Message-ID: <1456506526-10803-2-git-send-email-lvivier@redhat.com> (raw)
In-Reply-To: <1456506526-10803-1-git-send-email-lvivier@redhat.com>

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@redhat.com>
---
 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


  reply	other threads:[~2016-02-26 17:08 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26 17:08 [kvm-unit-tests PATCH v2 0/2] powerpc: add little-endian support Laurent Vivier
2016-02-26 17:08 ` Laurent Vivier
2016-02-26 17:08 ` Laurent Vivier [this message]
2016-02-26 17:08   ` [kvm-unit-tests PATCH v2 1/2] powerpc: allow to build big-endian binaries on little-endian host Laurent Vivier
2016-02-26 17:41   ` Andrew Jones
2016-02-26 17:41     ` Andrew Jones
2016-02-26 17:42   ` Andrew Jones
2016-02-26 17:42     ` Andrew Jones
2016-02-26 17:08 ` [kvm-unit-tests PATCH v2 2/2] powerpc: select endianness Laurent Vivier
2016-02-26 17:08   ` Laurent Vivier
2016-02-26 18:45   ` Andrew Jones
2016-02-26 18:45     ` Andrew Jones
2016-02-29 13:24     ` Laurent Vivier
2016-02-29 13:24       ` Laurent Vivier
2016-02-29 16:06     ` Paolo Bonzini
2016-02-29 16:06       ` Paolo Bonzini
2016-02-29 16:44       ` Laurent Vivier
2016-02-29 16:44         ` Laurent Vivier
2016-02-29 17:53     ` Laurent Vivier
2016-02-29 17:53       ` Laurent Vivier
2019-05-15  0:28 [kvm-unit-tests PATCH v2 1/2] powerpc: Allow for a custom decr value to be specified to load on decr excp Suraj Jitindar Singh
2019-05-15  0:28 ` [kvm-unit-tests PATCH v2 1/2] powerpc: Allow for a custom decr value to be specified to load on decr Suraj Jitindar Singh
2019-05-15  0:28 ` [kvm-unit-tests PATCH v2 2/2] powerpc: Make h_cede_tm test run by default Suraj Jitindar Singh
2019-05-15  0:28   ` Suraj Jitindar Singh
2019-05-15 16:25   ` Laurent Vivier
2019-05-15 16:25     ` Laurent Vivier
2019-05-17 10:13   ` Thomas Huth
2019-05-17 10:13     ` Thomas Huth
2019-05-15 16:22 ` [kvm-unit-tests PATCH v2 1/2] powerpc: Allow for a custom decr value to be specified to load on decr excp Laurent Vivier
2019-05-15 16:22   ` [kvm-unit-tests PATCH v2 1/2] powerpc: Allow for a custom decr value to be specified to load on Laurent Vivier
2019-05-15 23:27   ` [kvm-unit-tests PATCH v2 1/2] powerpc: Allow for a custom decr value to be specified to load on decr excp Suraj Jitindar Singh
2019-05-15 23:27     ` [kvm-unit-tests PATCH v2 1/2] powerpc: Allow for a custom decr value to be specified to load on Suraj Jitindar Singh
2019-05-17 10:20     ` [kvm-unit-tests PATCH v2 1/2] powerpc: Allow for a custom decr value to be specified to load on decr excp Thomas Huth
2019-05-17 10:20       ` [kvm-unit-tests PATCH v2 1/2] powerpc: Allow for a custom decr value to be specified to load on Thomas Huth

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=1456506526-10803-2-git-send-email-lvivier@redhat.com \
    --to=lvivier@redhat.com \
    --cc=agraf@suse.de \
    --cc=dgibson@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=thuth@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.