Skip to contentSkip to conversation

qemu: Fix cross compilation for mipsel

PATCH In review James Hogan 2 participants 3 messages Aug 27, 2013 – Aug 28, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu: Fix cross compilation for mipsel

The configure script was setting HOST_WORDS_BIGENDIAN for all $cpu = mips|mips64 when cross compiling, since endianness cannot be detected by running a test program. This includes little endian MIPS though. It didn't cause any build errors but does prevent QEMU from working correctly. Instead, detect the endianness similar to how we do for ARM, by checking for the __MIPSEB__ builtin processor definition.

This is from a hunk in the "[PATCH 8/12] KVM/MIPS: Enable KVM/MIPS for MIPS targets. Add MIPS GIC code to the build" patch by Sanjay Lal [1].

[1] https://patchwork.kernel.org/patch/2207251/

---
 configure | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
configure +6 -1
index 0a55c20..a765a9f 100755
@@ -1415,7 +1415,12 @@ case "$cpu" in
       bigendian=yes
     fi
   ;;
-  hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
+  mips|mips64)
+    if check_define __MIPSEB__; then
+      bigendian=yes
+    fi
+  ;;
+  hppa|m68k|ppc|ppc64|s390|s390x|sparc|sparc64)
     bigendian=yes
   ;;
 esac
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 9 lines · James Hogan

The configure script was setting HOST_WORDS_BIGENDIAN for all $cpu = mips|mips64 when cross compiling, since endianness cannot be detected by running a test program. This includes little endian MIPS though. It didn't cause any build errors but does prevent QEMU from working correctly. Instead, detect the endianness similar to how we do for ARM, by checking for the __MIPSEB__ builtin processor definition.

This is from a hunk in the "[PATCH 8/12] KVM/MIPS: Enable KVM/MIPS for MIPS targets. Add MIPS GIC code to the build" patch by Sanjay Lal [1].

Redundant with Mike Frysinger's more general patch,

http://patchwork.ozlabs.org/patch/256001/

r~

#2 lore raw
Quoted 8 lines · Richard Henderson
Quoted 7 lines · James Hogan

The configure script was setting HOST_WORDS_BIGENDIAN for all $cpu = mips|mips64 when cross compiling, since endianness cannot be detected by running a test program. This includes little endian MIPS though. It didn't cause any build errors but does prevent QEMU from working correctly. Instead, detect the endianness similar to how we do for ARM, by checking for the __MIPSEB__ builtin processor definition.

Quoted 6 lines
Quoted 2 lines

This is from a hunk in the "[PATCH 8/12] KVM/MIPS: Enable KVM/MIPS for MIPS targets. Add MIPS GIC code to the build" patch by Sanjay Lal [1].

Redundant with Mike Frysinger's more general patch,

http://patchwork.ozlabs.org/patch/256001/

Even better. Thanks for pointing that out. I've added my tested-by.

Cheers
James