From f6c130c4823e36058c454af2a21c78eb82248f91 Mon Sep 17 00:00:00 2001 From: Hailiang Date: Mon, 3 Mar 2025 18:17:07 +0800 Subject: [PATCH] add sw_64 support --- 0001-test1.patch | 35 ++++++++++++++++++++++++++++++ libffi-Add-sw64-architecture.patch | 29 +++++++++++++++---------- 2 files changed, 52 insertions(+), 12 deletions(-) create mode 100644 0001-test1.patch diff --git a/0001-test1.patch b/0001-test1.patch new file mode 100644 index 0000000..83b84aa --- /dev/null +++ b/0001-test1.patch @@ -0,0 +1,35 @@ +From 0eb582c348755f9b8f527c066535f95b10deddbf Mon Sep 17 00:00:00 2001 +From: Hailiang +Date: Mon, 3 Mar 2025 18:12:21 +0800 +Subject: [PATCH] test1 + +--- + config.guess | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/config.guess b/config.guess +index fe6f8bc..1239812 100644 +--- a/config.guess ++++ b/config.guess +@@ -990,10 +990,14 @@ EOF + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; +- sw_64:Linux:*:* | sw64:Linux:*:*) +- UNAME_MACHINE=sw_64 +- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" +- exit ;; ++ sw_64:Linux:*:*) ++ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in ++ sw) UNAME_MACHINE=sw_64 ;; ++ esac ++ objdump --private-headers /bin/sh | grep -q ld.so.1 ++ if test "$?" = 0 ; then LIBC=gnulibc1 ; fi ++ GUESS=$UNAME_MACHINE-sunway-linux-$LIBC ++ ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; +-- +2.20.1 + diff --git a/libffi-Add-sw64-architecture.patch b/libffi-Add-sw64-architecture.patch index 0456bdd..c33ad2f 100644 --- a/libffi-Add-sw64-architecture.patch +++ b/libffi-Add-sw64-architecture.patch @@ -1,10 +1,11 @@ -Description: Add support for sunway -Author: Miao Changwei -Last-Update: 2022-04-07 +From 54fd7709a7985d7b93cf2de11415ca3e1f7a55ce Mon Sep 17 00:00:00 2001 +From: Hailiang +Date: Mon, 3 Mar 2025 18:14:32 +0800 +Subject: [PATCH] libffi Add sw64 architecture --- Makefile.am | 2 + - config.guess | 4 + + config.guess | 8 + config.sub | 2 +- configure.host | 7 + src/sw64/ffi.c | 517 ++++++++++++++++++ @@ -12,7 +13,7 @@ Last-Update: 2022-04-07 src/sw64/internal.h | 23 + src/sw64/sysv.S | 283 ++++++++++ .../libffi.complex/cls_complex_va_float.c | 4 +- - 9 files changed, 897 insertions(+), 3 deletions(-) + 9 files changed, 901 insertions(+), 3 deletions(-) create mode 100644 src/sw64/ffi.c create mode 100644 src/sw64/ffitarget.h create mode 100644 src/sw64/internal.h @@ -39,17 +40,21 @@ index a4a4887..747d129 100644 src/x86/ffiw64.c src/x86/win64.S src/x86/ffi64.c \ src/x86/unix64.S src/x86/sysv_intel.S src/x86/win64_intel.S \ diff --git a/config.guess b/config.guess -index 7f76b62..fe6f8bc 100644 +index 7f76b62..1239812 100644 --- a/config.guess +++ b/config.guess -@@ -990,6 +990,10 @@ EOF +@@ -990,6 +990,14 @@ EOF if test "$?" = 0 ; then LIBC=gnulibc1 ; fi GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; -+ sw_64:Linux:*:* | sw64:Linux:*:*) -+ UNAME_MACHINE=sw_64 -+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" -+ exit ;; ++ sw_64:Linux:*:*) ++ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in ++ sw) UNAME_MACHINE=sw_64 ;; ++ esac ++ objdump --private-headers /bin/sh | grep -q ld.so.1 ++ if test "$?" = 0 ; then LIBC=gnulibc1 ; fi ++ GUESS=$UNAME_MACHINE-sunway-linux-$LIBC ++ ;; arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; @@ -1008,5 +1013,5 @@ index 2b17826..0861ac6 100644 #include "complex_defs_float.inc" #include "cls_complex_va.inc" -- -2.31.1 +2.20.1