void-packages/srcpkgs/qemu/patches/xxx-ppcle.patch

114 lines
3.7 KiB
Diff

From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Sun, 7 Mar 2021 01:47:42 +0100
Subject: [PATCH] support ppcle architecture
---
configure | 14 ++++++++++++--
configs/targets/ppcle-linux-user.mak | 4 ++++
linux-user/ppc/target_syscall.h | 4 ++++
scripts/qemu-binfmt-conf.sh | 6 +++++-
tests/tcg/configure.sh | 2 ++
5 files changed, 27 insertions(+), 3 deletions(-)
create mode 100644 configs/targets/ppcle-linux-user.mak
diff --git a/configure b/configure
index 18c26e0..03d3e18 100755
--- a/configure
+++ b/configure
@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
cpu="ppc64"
fi
else
- cpu="ppc"
+ if check_define _LITTLE_ENDIAN ; then
+ cpu="ppcle"
+ else
+ cpu="ppc"
+ fi
fi
elif check_define __mips__ ; then
cpu="mips"
@@ -638,6 +642,9 @@
ppc)
CPU_CFLAGS="-m32" ;;
+ ppcle)
+ cpu="ppc"
+ CPU_CFLAGS="-m32 -mlittle-endian" ;;
ppc64)
CPU_CFLAGS="-m64 -mbig-endian" ;;
ppc64le)
diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
new file mode 100644
index 0000000..2259243
--- /dev/null
+++ b/configs/targets/ppcle-linux-user.mak
@@ -0,0 +1,4 @@
+TARGET_ARCH=ppc
+TARGET_SYSTBL_ABI=common,nospu,32
+TARGET_SYSTBL=syscall.tbl
+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
index b9c4b81..cf26497 100644
--- a/linux-user/ppc/target_syscall.h
+++ b/linux-user/ppc/target_syscall.h
@@ -65,7 +65,11 @@ struct target_revectored_struct {
#define UNAME_MACHINE "ppc64le"
#endif
#else
+#if TARGET_BIG_ENDIAN
#define UNAME_MACHINE "ppc"
+#else
+#define UNAME_MACHINE "ppcle"
+#endif
#endif
#define UNAME_MINIMUM_RELEASE "2.6.32"
diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index 9f1580a..393943f 100755
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
ppc_family=ppc
+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
+ppc_family=ppcle
+
ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
ppc64_family=ppc
@@ -148,7 +152,7 @@ qemu_get_family() {
"Power Macintosh"|ppc64|powerpc|ppc)
echo "ppc"
;;
- ppc64el|ppc64le)
+ ppc64el|ppc64le|ppcel|ppcle)
echo "ppcle"
;;
arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
diff --git a/configure b/configure
index 72ab03f11a..0691929d76 100755
--- a/configure
+++ b/configure
@@ -1866,6 +1866,7 @@ fi
: ${cross_prefix_mips="mips-linux-gnu-"}
: ${cross_prefix_nios2="nios2-linux-gnu-"}
: ${cross_prefix_ppc="powerpc-linux-gnu-"}
+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
: ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
: ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
: ${cross_prefix_riscv64="riscv64-linux-gnu-"}
@@ -1883,6 +1884,7 @@ fi
: ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
: ${cross_cc_cflags_i386="-m32"}
: ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
+: ${cross_cc_cflags_ppcle="-m32"}
: ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
: ${cross_cc_ppc64le="$cross_cc_ppc64"}
: ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
2.30.1