diff --git a/libffi-Add-sw64-architecture.patch b/libffi-Add-sw64-architecture.patch new file mode 100644 index 0000000000000000000000000000000000000000..0d64a998c6489041ad66d405621b2c1bc3db9f2c --- /dev/null +++ b/libffi-Add-sw64-architecture.patch @@ -0,0 +1,100 @@ +From 2cf76089d9ae46e020f13c5f3379bda848c2b574 Mon Sep 17 00:00:00 2001 +From: Miao Changwei +Date: Sat, 1 Mar 2025 12:15:27 +0800 +Subject: [PATCH] Add support for sunway + +--- + Makefile.am | 2 ++ + config.guess | 4 ++++ + config.sub | 2 +- + configure.host | 7 +++++++ + testsuite/libffi.complex/cls_complex_va_float.c | 4 ++-- + 5 files changed, 16 insertions(+), 3 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 1f8aa9c..4abcb35 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -62,6 +62,7 @@ noinst_HEADERS = src/aarch64/ffitarget.h src/aarch64/internal.h \ + src/s390/ffitarget.h src/s390/internal.h src/sh/ffitarget.h \ + src/sh64/ffitarget.h src/sparc/ffitarget.h \ + src/sparc/internal.h src/tile/ffitarget.h src/vax/ffitarget.h \ ++ src/sw64/ffitarget.h src/sw64/internal.h \ + src/wasm32/ffitarget.h \ + src/x86/ffitarget.h src/x86/internal.h src/x86/internal64.h \ + src/x86/asmnames.h src/xtensa/ffitarget.h src/dlmalloc.c \ +@@ -92,6 +93,7 @@ EXTRA_libffi_la_SOURCES = src/aarch64/ffi.c src/aarch64/sysv.S \ + src/s390/sysv.S src/sh/ffi.c src/sh/sysv.S src/sh64/ffi.c \ + src/sh64/sysv.S src/sparc/ffi.c src/sparc/ffi64.c \ + src/sparc/v8.S src/sparc/v9.S src/tile/ffi.c src/tile/tile.S \ ++ src/sw64/ffi.c src/sw64/sysv.S \ + src/vax/ffi.c src/vax/elfbsd.S src/x86/ffi.c src/x86/sysv.S \ + src/wasm32/ffi.c \ + src/x86/ffiw64.c src/x86/win64.S src/x86/ffi64.c \ +diff --git a/config.guess b/config.guess +index f6d217a..2e53d17 100644 +--- a/config.guess ++++ b/config.guess +@@ -1022,6 +1022,10 @@ EOF + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; ++ sw_64:Linux:*:* | sw64:Linux:*:*) ++ UNAME_MACHINE=sw_64 ++ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ++ ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; +diff --git a/config.sub b/config.sub +index 2c5120f..4b28003 100644 +--- a/config.sub ++++ b/config.sub +@@ -1246,7 +1246,7 @@ case $cpu-$vendor in + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ + | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ +- | spu \ ++ | spu | sw_64 \ + | tahoe \ + | thumbv7* \ + | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ +diff --git a/configure.host b/configure.host +index c69a49c..eb4a869 100644 +--- a/configure.host ++++ b/configure.host +@@ -250,6 +250,13 @@ case "${host}" in + SOURCES="ffi.c ffi64.c v8.S v9.S" + ;; + ++ sw_64*-*-* | sw64*-*-*) ++ TARGET=SW64; TARGETDIR=sw64; ++ # Support 128-bit long double, changeable via command-line switch. ++ HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)' ++ SOURCES="ffi.c sysv.S" ++ ;; ++ + tile*-*) + TARGET=TILE; TARGETDIR=tile + SOURCES="ffi.c tile.S" +diff --git a/testsuite/libffi.complex/cls_complex_va_float.c b/testsuite/libffi.complex/cls_complex_va_float.c +index 2b17826..0861ac6 100644 +--- a/testsuite/libffi.complex/cls_complex_va_float.c ++++ b/testsuite/libffi.complex/cls_complex_va_float.c +@@ -6,11 +6,11 @@ + + /* { dg-do run } */ + +-/* Alpha splits _Complex into two arguments. It's illegal to pass ++/* Alpha/Sunway splits _Complex into two arguments. It's illegal to pass + float through varargs, so _Complex float goes badly. In sort of + gets passed as _Complex double, but the compiler doesn't agree + with itself on this issue. */ +-/* { dg-do run { xfail alpha*-*-* } } */ ++/* { dg-do run { xfail alpha*-*-* sw64*-*-* sw_64*-*-* } } */ + + #include "complex_defs_float.inc" + #include "cls_complex_va.inc" +-- +2.47.1 + diff --git a/libffi.spec b/libffi.spec index 508159637ed2f27086cb66b71459970db3d6cc10..08495675c5391817c57b622a4aa7c3f2368a1020 100644 --- a/libffi.spec +++ b/libffi.spec @@ -1,6 +1,6 @@ Name: libffi Version: 3.4.7 -Release: 1 +Release: 2 Summary: A Portable Foreign Function Interface Library License: MIT URL: https://sourceware.org/libffi @@ -9,6 +9,7 @@ Source1: ffi-multilib.h Source2: ffitarget-multilib.h Patch1: fix-AARCH64EB-support.patch +Patch2: libffi-Add-sw64-architecture.patch BuildRequires: gcc gcc-c++ dejagnu BuildRequires: make @@ -79,6 +80,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_infodir}/libffi.info* %changelog +* Sat Mar 01 2025 mahailiang - 3.4.7-2 +- add sw_64 support + * Sat Feb 22 2025 Funda Wang - 3.4.7-1 - update to version 3.4.7