From 58698377353bd0ea06dd68cefcbd3aee05bb1622 Mon Sep 17 00:00:00 2001 From: Kenjiro Nakayama Date: Thu, 13 Aug 2026 16:30:07 +0900 Subject: ci: test RISC-V with QEMU Cross-compile for riscv64 on Ubuntu 24.04 and run the test suite through QEMU, covering the RISC-V-specific crypto code. --- .github/workflows/linux.yml | 6 ++++++ scripts/test | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index ad13ed8..4fbe987 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -35,6 +35,9 @@ jobs: - os: "ubuntu-24.04" # loong64 arch: "loong64" compiler: "gcc" + - os: "ubuntu-24.04" + arch: "riscv64" + compiler: "gcc" - os: "ubuntu-24.04-arm" arch: "native" compiler: "gcc" @@ -68,6 +71,9 @@ jobs: mips64) packages+=(qemu-user-static binfmt-support g++-mips64el-linux-gnuabi64) ;; + riscv64) + packages+=(qemu-user-static binfmt-support g++-riscv64-linux-gnu) + ;; esac sudo apt-get update sudo apt-get install -y "${packages[@]}" diff --git a/scripts/test b/scripts/test index 0e84b22..7e64bf1 100755 --- a/scripts/test +++ b/scripts/test @@ -161,6 +161,15 @@ elif [ "$ARCH" = "loong64" ]; then file apps/openssl/openssl +elif [ "$ARCH" = "riscv64" ]; then + sudo ln -sf /usr/riscv64-linux-gnu/lib/ld-linux-riscv64-lp64d.so.1 /lib/ + setup_cross_compiler riscv64-linux-gnu + + ./configure --host=riscv64-linux-gnu + LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib make -j 4 check + + file apps/openssl/openssl + elif [ "$ARCH" = "mips32" ] || [ "$ARCH" = "mips64" ]; then if [ "$ARCH" = "mips32" ]; then sudo ln -sf /usr/mips-linux-gnu/lib/ld.so.1 /lib/ -- cgit v1.2.3-55-g6feb From 9d9f450f475fa1fa0bf5efcddeccb24b2b68e929 Mon Sep 17 00:00:00 2001 From: Kenjiro Nakayama Date: Thu, 13 Aug 2026 16:40:47 +0900 Subject: Enable RISC-V BN assembly with autotools Recognize ELF riscv64 as an assembly-capable target so the architecture-specific BN helpers are used unless assembly is explicitly disabled. --- configure.ac | 2 ++ crypto/Makefile.am | 2 ++ 2 files changed, 4 insertions(+) diff --git a/configure.ac b/configure.ac index 23f0c38..c10a33f 100644 --- a/configure.ac +++ b/configure.ac @@ -136,6 +136,8 @@ AM_CONDITIONAL([HOST_ASM_ELF_MIPS], [test "x$HOST_ABI" = "xelf" -a "$host_cpu" = "mips" -a "x$enable_asm" != "xno"]) AM_CONDITIONAL([HOST_ASM_ELF_MIPS64], [test "x$HOST_ABI" = "xelf" -a "$host_cpu" = "mips64" -a "x$enable_asm" != "xno"]) +AM_CONDITIONAL([HOST_ASM_ELF_RISCV64], + [test "x$HOST_ABI" = "xelf" -a "$host_cpu" = "riscv64" -a "x$enable_asm" != "xno"]) AM_CONDITIONAL([HOST_ASM_ELF_X86_64], [test "x$HOST_ABI" = "xelf" -a "$host_cpu" = "x86_64" -a "x$enable_asm" != "xno"]) AM_CONDITIONAL([HOST_ASM_MACOSX_X86_64], diff --git a/crypto/Makefile.am b/crypto/Makefile.am index 7969aee..a4a717d 100644 --- a/crypto/Makefile.am +++ b/crypto/Makefile.am @@ -212,6 +212,7 @@ include Makefile.am.mingw64-x86_64 if !HOST_ASM_ELF_AARCH64 if !HOST_ASM_ELF_MIPS if !HOST_ASM_ELF_MIPS64 +if !HOST_ASM_ELF_RISCV64 if !HOST_ASM_ELF_X86_64 if !HOST_ASM_MACOSX_X86_64 if !HOST_ASM_MASM_X86_64 @@ -224,6 +225,7 @@ endif endif endif endif +endif if HOST_AARCH64 if HOST_DARWIN -- cgit v1.2.3-55-g6feb