void-packages/srcpkgs/qemu/patches/xxx-ppcle.patch
Đoàn Trần Công Danh 695ba748ce qemu: fix patches -Np1
2021-06-25 08:37:15 +07:00

126 lines
4 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 ++++++++++++--
default-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 default-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"
@@ -683,6 +687,9 @@ ARCH=
case "$cpu" in
ppc|ppc64|s390x|sparc64|x32|riscv32|riscv64)
;;
+ ppcle)
+ ARCH="ppc"
+ ;;
ppc64le)
ARCH="ppc64"
;;
@@ -6783,7 +6790,7 @@ if test "$linux" = "yes" ; then
i386|x86_64|x32)
linux_arch=x86
;;
- ppc|ppc64|ppc64le)
+ ppc|ppcle|ppc64|ppc64le)
linux_arch=powerpc
;;
s390x)
@@ -6960,6 +6967,9 @@ if test -n "$cross_prefix"; then
i386|x86_64)
echo "cpu_family = 'x86'" >> $cross
;;
+ ppcle)
+ echo "cpu_family = 'ppc'" >> $cross
+ ;;
ppc64le)
echo "cpu_family = 'ppc64'" >> $cross
;;
diff --git a/default-configs/targets/ppcle-linux-user.mak b/default-configs/targets/ppcle-linux-user.mak
new file mode 100644
index 0000000..2259243
--- /dev/null
+++ b/default-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
+#ifdef TARGET_WORDS_BIGENDIAN
#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/tests/tcg/configure.sh b/tests/tcg/configure.sh
index e1b70e2..e07f5fe 100755
--- a/tests/tcg/configure.sh
+++ b/tests/tcg/configure.sh
@@ -59,6 +59,8 @@ fi
: $(cross_cc_mips="mips-linux-gnu-gcc")
: ${cross_cc_ppc="powerpc-linux-gnu-gcc"}
: ${cross_cc_cflags_ppc="-m32"}
+: ${cross_cc_ppcle="powerpcle-linux-gnu-gcc"}
+: ${cross_cc_cflags_ppcle="-m32"}
: ${cross_cc_ppc64="powerpc64-linux-gnu-gcc"}
: ${cross_cc_ppc64le="powerpc64le-linux-gnu-gcc"}
: $(cross_cc_riscv64="riscv64-linux-gnu-gcc")
--
2.30.1