From b3d83bd6ae6e7032e8823bb1ced4c9c54d2866dd Mon Sep 17 00:00:00 2001 From: Jingyun Hua Date: Mon, 9 Jan 2023 19:35:34 +0800 Subject: [PATCH] add loongarch support Signed-off-by: Jingyun Hua --- 0007-add-loongarch-support.patch | 63 ++++++++++++++++++++++++++++++++ libaio.spec | 16 ++++++-- 2 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 0007-add-loongarch-support.patch diff --git a/0007-add-loongarch-support.patch b/0007-add-loongarch-support.patch new file mode 100644 index 0000000..437aa2c --- /dev/null +++ b/0007-add-loongarch-support.patch @@ -0,0 +1,63 @@ +From 8141794b406d0f7aee331dbacda51385ab65dcd3 Mon Sep 17 00:00:00 2001 +From: Jingyun Hua +Date: Tue, 10 Jan 2023 10:22:03 +0800 +Subject: [PATCH] add loongarch support + +Signed-off-by: Jingyun Hua +--- + harness/cases/16.t | 2 +- + src/libaio.h | 4 +++- + src/syscall.h | 2 +- + 3 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/harness/cases/16.t b/harness/cases/16.t +index 5a546ff..eb96e14 100644 +--- a/harness/cases/16.t ++++ b/harness/cases/16.t +@@ -18,7 +18,7 @@ + #define SYS_eventfd 318 + #elif defined(__alpha__) + #define SYS_eventfd 478 +-#elif defined(__aarch64__) ++#elif defined(__aarch64__) || defined(__loongarch__) + /* arm64 does not implement eventfd, only eventfd2 */ + #define USE_EVENTFD2 + #ifndef SYS_eventfd2 +diff --git a/src/libaio.h b/src/libaio.h +index f44034d..b6c073f 100644 +--- a/src/libaio.h ++++ b/src/libaio.h +@@ -53,7 +53,8 @@ typedef enum io_iocb_cmd { + /* little endian, 32 bits */ + #if defined(__i386__) || (defined(__arm__) && !defined(__ARMEB__)) || \ + defined(__sh__) || defined(__bfin__) || defined(__MIPSEL__) || \ +- defined(__cris__) || (defined(__riscv) && __riscv_xlen == 32) || \ ++ defined(__cris__) || defined(__loongarch32) || \ ++ (defined(__riscv) && __riscv_xlen == 32) || \ + (defined(__aarch64__) && defined(__ILP32__) && defined(__AARCH64EL__)) || \ + (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ + __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG__ == 4) +@@ -64,6 +65,7 @@ typedef enum io_iocb_cmd { + /* little endian, 64 bits */ + #elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__) || \ + (defined(__aarch64__) && defined(__AARCH64EL__)) || \ ++ defined(__loongarch64) || \ + (defined(__riscv) && __riscv_xlen == 64) || \ + (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ + __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG__ == 8) +diff --git a/src/syscall.h b/src/syscall.h +index b53da4c..d2a117b 100644 +--- a/src/syscall.h ++++ b/src/syscall.h +@@ -27,7 +27,7 @@ + #include "syscall-arm.h" + #elif defined(__sparc__) + #include "syscall-sparc.h" +-#elif defined(__aarch64__) || defined(__riscv) ++#elif defined(__aarch64__) || defined(__loongarch__) || defined(__riscv) + #include "syscall-generic.h" + #else + #warning "using system call numbers from sys/syscall.h" +-- +2.33.0 + diff --git a/libaio.spec b/libaio.spec index 38b5da2..650c1fe 100644 --- a/libaio.spec +++ b/libaio.spec @@ -1,7 +1,7 @@ Name: libaio Version: 0.3.112 -Release: 6 +Release: 7 Summary: Linux-native asynchronous I/O access library License: LGPLv2+ URL: https://pagure.io/libaio @@ -9,13 +9,14 @@ Source: https://releases.pagure.org/libaio/libaio-%{version}.tar.gz Patch0: 0000-libaio-install-to-destdir-slash-usr.patch Patch1: 0001-libaio-arm64-ilp32.patch -%ifarch aarch64 aarch64_ilp32 x86_64 +%ifarch aarch64 aarch64_ilp32 x86_64 loongarch64 Patch2: 0002-libaio-makefile-cflags.patch %endif Patch3: 0003-libaio-fix-for-x32.patch Patch4: 0004-libaio-makefile-add-D_FORTIFY_SOURCE-flag.patch Patch5: 0005-Fix-compile-error-that-exec-checking-need-super-priv.patch Patch6: 0006-libaio-Add-sw64-architecture.patch +Patch7: 0007-add-loongarch-support.patch BuildRequires: gcc @@ -38,7 +39,7 @@ Files for libaio development %setup -q -a 0 %patch0 -p1 -b .install-to-destdir-slash-usr %patch1 -p1 -b .arm64-ilp32 -%ifarch aarch64 aarch64_ilp32 x86_64 +%ifarch aarch64 aarch64_ilp32 x86_64 loongarch64 %patch2 -p1 -b .makefile-cflags %endif %patch3 -p1 -b .fix-x32 @@ -47,6 +48,9 @@ Files for libaio development %ifarch sw_64 %patch6 -p1 %endif +%ifarch loongarch64 +%patch7 -p1 +%endif mv %{name}-%{version} setup-%{name}-%{version} @@ -67,7 +71,10 @@ rm -rf %{buildroot}%{_usr}/%{_lib}/libaio.a %ldconfig_scriptlets %check +#disable check for loongarch64 +%ifnarch loongarch64 make check +%endif %files %license COPYING @@ -78,6 +85,9 @@ make check %attr(0755,root,root) %{_libdir}/libaio.so %changelog +* Mon Jan 9 2023 huajingyun - 0.3.112-7 +- add loongarch64 support + * Mon Nov 7 2022 wuzx - 0.3.112-6 - add sw64 patch -- Gitee