From ee0da46c9e9f88c25fbc5d66a30c6a2f51157714 Mon Sep 17 00:00:00 2001 From: zhaixiaojuan <67671683+zhaixiaojuan@users.noreply.github.com> Date: Tue, 10 Dec 2024 09:46:44 +0800 Subject: [PATCH] Add loongarch64 support (#2010) Signed-off-by: zhaixiaojuan --- CMakeLists.txt | 6 ++++++ PLATFORMS.md | 1 + src/common/common.c | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d9b97cdd33..114961ed7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,6 +127,12 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "s390x") endif() elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "riscv") set(ARCH "riscv") +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64") + set(ARCH "loongarch64") + set(ARCH_LOONGARCH64 ON) + if(${OQS_DIST_BUILD}) + set(OQS_DIST_LOONGARCH64_BUILD ON) + endif() elseif(OQS_PERMIT_UNSUPPORTED_ARCHITECTURE) message(WARNING "Unknown or unsupported processor: " ${CMAKE_SYSTEM_PROCESSOR}) message(WARNING "Compilation on an unsupported processor should only be used for testing, as it may result an insecure configuration, for example due to variable-time instructions leaking secret information.") diff --git a/PLATFORMS.md b/PLATFORMS.md index 7bd573338b..f1b3fc5ebd 100644 --- a/PLATFORMS.md +++ b/PLATFORMS.md @@ -62,3 +62,4 @@ In this policy, the words "must" and "must not" specify absolute requirements th - x86 for Windows (Visual Studio Toolchain) - ppc641e for Ubuntu (Focal) - s390x for Ubuntu (Focal) +- loongarch64 for Debian Linux (trixie) diff --git a/src/common/common.c b/src/common/common.c index cb70d558c0..795f3f97c9 100644 --- a/src/common/common.c +++ b/src/common/common.c @@ -206,6 +206,11 @@ static void set_available_cpu_extensions(void) { /* mark that this function has been called */ cpu_ext_data[OQS_CPU_EXT_INIT] = 1; } +#elif defined(OQS_DIST_LOONGARCH64_BUILD) +static void set_available_cpu_extensions(void) { + /* mark that this function has been called */ + cpu_ext_data[OQS_CPU_EXT_INIT] = 1; +} #elif defined(OQS_DIST_BUILD) static void set_available_cpu_extensions(void) { }