From 8a3bf17b4b107db66d813e24f8509a7a6bc20636 Mon Sep 17 00:00:00 2001 From: Dandan Zhang Date: Mon, 13 Dec 2021 11:36:53 +0800 Subject: [PATCH] Add compilation support for loongarch64 arch --- Configurations/10-main.conf | 7 +++++++ config | 1 + engines/afalg/e_afalg.c | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf index becda790..2cc55516 100644 --- a/Configurations/10-main.conf +++ b/Configurations/10-main.conf @@ -736,6 +736,13 @@ sub vms_info { shared_ldflag => add("-mabi=64"), multilib => "64", }, + "linux64-loongarch64" => { + inherit_from => [ "linux-generic64" ], + cflags => add("-mabi=lp64"), + perlasm_scheme => "64", + shared_ldflag => add("-mabi=lp64"), + multilib => "64", + }, #### IA-32 targets... #### These two targets are a bit aged and are to be used on older Linux diff --git a/config b/config index 1341fd62..28e056ec 100755 --- a/config +++ b/config @@ -565,6 +565,7 @@ case "$GUESSOS" in OUT="linux-mips64" ;; mips*-*-linux2) OUT="linux-mips32" ;; + loongarch64-*-linux2) OUT="linux64-loongarch64" ;; ppc60x-*-vxworks*) OUT="vxworks-ppc60x" ;; ppcgen-*-vxworks*) OUT="vxworks-ppcgen" ;; pentium-*-vxworks*) OUT="vxworks-pentium" ;; diff --git a/engines/afalg/e_afalg.c b/engines/afalg/e_afalg.c index 9837cae9..2796c620 100644 --- a/engines/afalg/e_afalg.c +++ b/engines/afalg/e_afalg.c @@ -105,9 +105,14 @@ static ossl_inline int io_setup(unsigned n, aio_context_t *ctx) return syscall(__NR_io_setup, n, ctx); } +/* Add __NR_eventfd2 syscall for loongarch64 architecture */ static ossl_inline int eventfd(int n) { +#ifdef __loongarch64 + return syscall(__NR_eventfd2, n); +#else return syscall(__NR_eventfd, n); +#endif } static ossl_inline int io_destroy(aio_context_t ctx)