From c44ca08fcd344f4ae58651de5a8787e5173ee35f Mon Sep 17 00:00:00 2001 From: zhaixiaojuan Date: Wed, 4 Dec 2024 14:57:24 +0800 Subject: [PATCH] Add loongarch64 support 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 3d2a454e6..68efd8ce2 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 7bd573338..f1b3fc5eb 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 cb70d558c..795f3f97c 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) { }