Skip to contentSkip to conversation

spapr/rtas: Force big endian compile for rtas

PATCH In review Alexey Kardashevskiy 2 participants 5 messages Feb 1, 2019 – Jun 12, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spapr/rtas: Force big endian compile for rtas

At the moment the rtas's Makefile uses generic QEMU rules which means that when QEMU is compiled on a little endian system, the spapr-rtas.bin is compiled as little endian too which is incorrect as it is always executed in big endian mode.

This enforces -mbig by defining %.o:%.S rule as spapr-rtas.bin is a standalone guest binary which should not depend on QEMU flags anyway.

---
 pc-bios/spapr-rtas/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
pc-bios/spapr-rtas/Makefile +4 -1
index f26dd42..4b9bb12 100644
@@ -14,8 +14,11 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/spapr-rtas)
 
 build-all: spapr-rtas.bin
 
+%.o: %.S
+	$(call quiet-command,$(CCAS) -mbig -c -o $@ $<,"CCAS","$(TARGET_DIR)$@")
+
 %.img: %.o
-	$(call quiet-command,$(CC) -nostdlib -o $@ $<,"Building","$(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) -nostdlib -mbig -o $@ $<,"Building","$(TARGET_DIR)$@")
 
 %.bin: %.img
 	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"Building","$(TARGET_DIR)$@")
Signature · 1 line
2.17.1
#1 lore raw
Quoted 7 lines · Alexey Kardashevskiy

At the moment the rtas's Makefile uses generic QEMU rules which means that when QEMU is compiled on a little endian system, the spapr-rtas.bin is compiled as little endian too which is incorrect as it is always executed in big endian mode.

This enforces -mbig by defining %.o:%.S rule as spapr-rtas.bin is a standalone guest binary which should not depend on QEMU flags anyway.

Bag? Good? Useless? :)

Quoted 24 lines
---
 pc-bios/spapr-rtas/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
pc-bios/spapr-rtas/Makefile +4 -1
index f26dd42..4b9bb12 100644
@@ -14,8 +14,11 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/spapr-rtas)
 
 build-all: spapr-rtas.bin
 
+%.o: %.S
+	$(call quiet-command,$(CCAS) -mbig -c -o $@ $<,"CCAS","$(TARGET_DIR)$@")
+
 %.img: %.o
-	$(call quiet-command,$(CC) -nostdlib -o $@ $<,"Building","$(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) -nostdlib -mbig -o $@ $<,"Building","$(TARGET_DIR)$@")
 
 %.bin: %.img
 	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"Building","$(TARGET_DIR)$@")
Signature · 1 line
Alexey
#2 lore raw
Quoted 8 lines · Alexey Kardashevskiy
Quoted 5 lines · Alexey Kardashevskiy

At the moment the rtas's Makefile uses generic QEMU rules which means that when QEMU is compiled on a little endian system, the spapr-rtas.bin is compiled as little endian too which is incorrect as it is always executed in big endian mode.

Quoted 4 lines
Quoted 2 lines

This enforces -mbig by defining %.o:%.S rule as spapr-rtas.bin is a standalone guest binary which should not depend on QEMU flags anyway.

Bag? Good? Useless? :)

I missed the original send of this, I'm afraid. Looks like a good idea.

Quoted 27 lines
Quoted 26 lines
---
 pc-bios/spapr-rtas/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
pc-bios/spapr-rtas/Makefile +4 -1
index f26dd42..4b9bb12 100644
@@ -14,8 +14,11 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/spapr-rtas)
 
 build-all: spapr-rtas.bin
 
+%.o: %.S
+	$(call quiet-command,$(CCAS) -mbig -c -o $@ $<,"CCAS","$(TARGET_DIR)$@")
+
 %.img: %.o
-	$(call quiet-command,$(CC) -nostdlib -o $@ $<,"Building","$(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) -nostdlib -mbig -o $@ $<,"Building","$(TARGET_DIR)$@")
 
 %.bin: %.img
 	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"Building","$(TARGET_DIR)$@")
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#3 lore raw
Quoted 9 lines · David Gibson
Quoted 8 lines · Alexey Kardashevskiy
Quoted 5 lines · Alexey Kardashevskiy

At the moment the rtas's Makefile uses generic QEMU rules which means that when QEMU is compiled on a little endian system, the spapr-rtas.bin is compiled as little endian too which is incorrect as it is always executed in big endian mode.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

This enforces -mbig by defining %.o:%.S rule as spapr-rtas.bin is a standalone guest binary which should not depend on QEMU flags anyway.

Bag? Good? Useless? :)

I missed the original send of this, I'm afraid. Looks like a good idea.

Totally forgot this one. It is still in pw:
https://patchwork.ozlabs.org/patch/1034543/

Or you want a repost?

Quoted 30 lines
Quoted 29 lines
Quoted 28 lines
---
 pc-bios/spapr-rtas/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
pc-bios/spapr-rtas/Makefile +4 -1
index f26dd42..4b9bb12 100644
@@ -14,8 +14,11 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/spapr-rtas)
 
 build-all: spapr-rtas.bin
 
+%.o: %.S
+	$(call quiet-command,$(CCAS) -mbig -c -o $@ $<,"CCAS","$(TARGET_DIR)$@")
+
 %.img: %.o
-	$(call quiet-command,$(CC) -nostdlib -o $@ $<,"Building","$(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) -nostdlib -mbig -o $@ $<,"Building","$(TARGET_DIR)$@")
 
 %.bin: %.img
 	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"Building","$(TARGET_DIR)$@")
Signature · 1 line
Alexey
#4 lore raw
Quoted 17 lines · Alexey Kardashevskiy
Quoted 14 lines · David Gibson
Quoted 12 lines · Alexey Kardashevskiy
Quoted 7 lines · Alexey Kardashevskiy

At the moment the rtas's Makefile uses generic QEMU rules which means that when QEMU is compiled on a little endian system, the spapr-rtas.bin is compiled as little endian too which is incorrect as it is always executed in big endian mode.

This enforces -mbig by defining %.o:%.S rule as spapr-rtas.bin is a standalone guest binary which should not depend on QEMU flags anyway.

Bag? Good? Useless? :)

Quoted 7 lines
Quoted 2 lines

I missed the original send of this, I'm afraid. Looks like a good idea.

Totally forgot this one. It is still in pw:
https://patchwork.ozlabs.org/patch/1034543/

Or you want a repost?

Repost, please.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson