From d99d765f7e8ff73a500261a05628cd95766849c9 Mon Sep 17 00:00:00 2001 From: wenfei6316 Date: Wed, 13 Dec 2023 11:33:05 +0800 Subject: [PATCH] config for riscv64 arch Signed-off-by: wenfei6316 Change-Id: I2d396086df82bc6b50bfcda5be3301777c7f3985 --- build/skia/BUILD.gn | 4 ++-- build/skia/ohos/BUILD.gn | 2 +- engine/flutter/fml/build_config.h | 5 +++++ engine/flutter/sky/tools/objcopy.py | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/build/skia/BUILD.gn b/build/skia/BUILD.gn index f5bfe45c..108c7bbf 100644 --- a/build/skia/BUILD.gn +++ b/build/skia/BUILD.gn @@ -420,7 +420,7 @@ template("ace_skia_opts") { sources = [] - if (target_cpu == "x86_64" || platform == "windows" || platform == "mac" || + if (target_cpu == "x86_64" || target_cpu == "riscv64" || platform == "windows" || platform == "mac" || platform == "linux" || platform == "ios") { cflags -= [ "-march=armv8-a+crc" ] sources += [ @@ -966,7 +966,7 @@ template("ace_skia_core") { libs = [ "GL" ] } else { # Ohos and Android plarform - if (target_cpu != "arm") { + if (target_cpu != "arm" && target_cpu != "riscv64") { defines += [ "SKVM_JIT" ] } diff --git a/build/skia/ohos/BUILD.gn b/build/skia/ohos/BUILD.gn index 5c93a941..81ea7e42 100644 --- a/build/skia/ohos/BUILD.gn +++ b/build/skia/ohos/BUILD.gn @@ -588,7 +588,7 @@ ohos_source_set("skia_core_ohos") { } # Ohos plarform - if (target_cpu != "arm") { + if (target_cpu != "arm" && target_cpu != "riscv64") { defines += [ "SKVM_JIT" ] } diff --git a/engine/flutter/fml/build_config.h b/engine/flutter/fml/build_config.h index 2714f46d..bae00866 100644 --- a/engine/flutter/fml/build_config.h +++ b/engine/flutter/fml/build_config.h @@ -103,6 +103,11 @@ #define ARCH_CPU_32_BITS 1 #define ARCH_CPU_LITTLE_ENDIAN 1 #endif +#elif defined(__riscv) && (__riscv_xlen == 64) +#define ARCH_CPU_RISCV_FAMILY 1 +#define ARCH_CPU_RISCV64 1 +#define ARCH_CPU_64_BITS 1 +#define ARCH_CPU_LITTLE_ENDIAN 1 #else #error Please add support for your architecture in flutter/fml/build_config.h #endif diff --git a/engine/flutter/sky/tools/objcopy.py b/engine/flutter/sky/tools/objcopy.py index 630a6702..2f4e683e 100755 --- a/engine/flutter/sky/tools/objcopy.py +++ b/engine/flutter/sky/tools/objcopy.py @@ -14,6 +14,7 @@ BFD_ARCH = { 'arm64': 'aarch64', 'x86': 'i386', 'x86_64': 'i386:x86-64', + 'riscv64': 'riscv', } # BFD target names recognized by objcopy. @@ -22,6 +23,7 @@ BFD_TARGET = { 'arm64': 'elf64-littleaarch64', 'x86': 'elf32-i386', 'x86_64': 'elf64-x86-64', + 'riscv64': 'elf64-littleriscv', } def main(): -- Gitee