From c3b344ef66a4d9407fe71598c897362f17ebc889 Mon Sep 17 00:00:00 2001 From: sybapp Date: Mon, 17 Feb 2025 07:22:40 +0000 Subject: [PATCH] add loongarch64 support Change-Id: I024caeb28f5d38c824095db92ae7db93969f594d Signed-off-by: sybapp --- etc/BUILD.gn | 3 ++- modules/ace_adapter/BUILD.gn | 2 +- modules/asan/BUILD.gn | 2 +- modules/asan/asan_detector.c | 2 +- modules/common/BUILD.gn | 2 +- modules/common/appspawn_common.c | 2 +- modules/modulemgr/appspawn_modulemgr.h | 2 +- modules/native_adapter/BUILD.gn | 2 +- modules/nweb_adapter/BUILD.gn | 5 ++++- modules/nweb_adapter/nwebspawn_adapter.cpp | 3 +++ modules/sandbox/BUILD.gn | 4 ++-- modules/sysevent/BUILD.gn | 2 +- test/unittest/app_spawn_standard_test/BUILD.gn | 6 +++--- 13 files changed, 22 insertions(+), 15 deletions(-) diff --git a/etc/BUILD.gn b/etc/BUILD.gn index dddce63f..1a55cd44 100644 --- a/etc/BUILD.gn +++ b/etc/BUILD.gn @@ -39,7 +39,8 @@ if (defined(appspawn_sandbox_new) && appspawn_sandbox_new) { source = "../appdata-sandbox.json" patterns = [] extra_sandbox_cfgs = [] - if (target_cpu == "arm64" || target_cpu == "x86_64") { + if (target_cpu == "arm64" || target_cpu == "x86_64" || + target_cpu == "loongarch64") { extra_sandbox_cfgs += [ "../appdata-sandbox64.json" ] } if (is_asan || asan_detector) { diff --git a/modules/ace_adapter/BUILD.gn b/modules/ace_adapter/BUILD.gn index 4c274652..37efd911 100644 --- a/modules/ace_adapter/BUILD.gn +++ b/modules/ace_adapter/BUILD.gn @@ -58,7 +58,7 @@ ohos_shared_library("appspawn_ace") { part_name = "${part_name}" install_enable = true if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { module_install_dir = "lib64/appspawn/appspawn" } else { module_install_dir = "lib/appspawn/appspawn" diff --git a/modules/asan/BUILD.gn b/modules/asan/BUILD.gn index 29cec579..371af2ce 100644 --- a/modules/asan/BUILD.gn +++ b/modules/asan/BUILD.gn @@ -38,7 +38,7 @@ ohos_shared_library("appspawn_asan") { subsystem_name = "${subsystem_name}" part_name = "${part_name}" if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { module_install_dir = "lib64/appspawn" } else { module_install_dir = "lib/appspawn" diff --git a/modules/asan/asan_detector.c b/modules/asan/asan_detector.c index 901bc27a..8400c955 100644 --- a/modules/asan/asan_detector.c +++ b/modules/asan/asan_detector.c @@ -25,7 +25,7 @@ extern bool may_init_gwp_asan(bool forceInit); // ide-asan #ifndef ASAN_DETECTOR -#if defined(__aarch64__) || defined(__x86_64__) +#if defined(__aarch64__) || defined(__x86_64__) || defined(__loongarch_lp64) #define ASAN_LD_PRELOAD "/system/lib64/libclang_rt.asan.so" #else #define ASAN_LD_PRELOAD "/system/lib/libclang_rt.asan.so" diff --git a/modules/common/BUILD.gn b/modules/common/BUILD.gn index a8441284..a58ae5fb 100644 --- a/modules/common/BUILD.gn +++ b/modules/common/BUILD.gn @@ -95,7 +95,7 @@ ohos_shared_library("appspawn_common") { part_name = "${part_name}" install_enable = true if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { module_install_dir = "lib64/appspawn/common" } else { module_install_dir = "lib/appspawn/common" diff --git a/modules/common/appspawn_common.c b/modules/common/appspawn_common.c index 6ce56b27..c8eda7a0 100644 --- a/modules/common/appspawn_common.c +++ b/modules/common/appspawn_common.c @@ -153,7 +153,7 @@ static int SetCapabilities(const AppSpawnMgr *content, const AppSpawningCtx *pro static void InitDebugParams(const AppSpawnMgr *content, const AppSpawningCtx *property) { -#if defined(__aarch64__) || defined(__x86_64__) +#if defined(__aarch64__) || defined(__x86_64__) || defined(__loongarch_lp64) const char *debugSoPath = "/system/lib64/libhidebug.so"; #else const char *debugSoPath = "/system/lib/libhidebug.so"; diff --git a/modules/modulemgr/appspawn_modulemgr.h b/modules/modulemgr/appspawn_modulemgr.h index 53d0efb5..a6c76399 100644 --- a/modules/modulemgr/appspawn_modulemgr.h +++ b/modules/modulemgr/appspawn_modulemgr.h @@ -29,7 +29,7 @@ extern "C" { #endif #define HOOK_STOP_WHEN_ERROR 0x2 -#if defined(__aarch64__) || defined(__x86_64__) +#if defined(__aarch64__) || defined(__x86_64__) || defined(__loongarch_lp64) #define ASAN_MODULE_PATH "/system/lib64/appspawn/libappspawn_asan" #else #define ASAN_MODULE_PATH "/system/lib/appspawn/libappspawn_asan" diff --git a/modules/native_adapter/BUILD.gn b/modules/native_adapter/BUILD.gn index 4a41ac59..34fce4c3 100644 --- a/modules/native_adapter/BUILD.gn +++ b/modules/native_adapter/BUILD.gn @@ -44,7 +44,7 @@ ohos_shared_library("nativespawn") { part_name = "${part_name}" install_enable = true if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { module_install_dir = "lib64/appspawn/nativespawn" } else { module_install_dir = "lib/appspawn/nativespawn" diff --git a/modules/nweb_adapter/BUILD.gn b/modules/nweb_adapter/BUILD.gn index acd15abe..da1fc0e3 100644 --- a/modules/nweb_adapter/BUILD.gn +++ b/modules/nweb_adapter/BUILD.gn @@ -31,6 +31,9 @@ ohos_shared_library("appspawn_nweb") { if (target_cpu == "x86_64") { defines += [ "webview_x86_64" ] } + if (target_cpu == "loongarch64") { + defines += [ "webview_loongarch64" ] + } external_deps = [ "c_utils:utils", @@ -48,7 +51,7 @@ ohos_shared_library("appspawn_nweb") { part_name = "${part_name}" install_enable = true if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { module_install_dir = "lib64/appspawn/nwebspawn" } else { module_install_dir = "lib/appspawn/nwebspawn" diff --git a/modules/nweb_adapter/nwebspawn_adapter.cpp b/modules/nweb_adapter/nwebspawn_adapter.cpp index 6a54d3d0..1a6c2672 100644 --- a/modules/nweb_adapter/nwebspawn_adapter.cpp +++ b/modules/nweb_adapter/nwebspawn_adapter.cpp @@ -41,6 +41,9 @@ namespace { #elif defined(webview_x86_64) const std::string ARK_WEB_CORE_HAP_LIB_PATH = "/data/storage/el1/bundle/arkwebcore/libs/x86_64"; +#elif defined(webview_loongarch64) + const std::string ARK_WEB_CORE_HAP_LIB_PATH = + "/data/storage/el1/bundle/arkwebcore/libs/loongarch64"; #else const std::string ARK_WEB_CORE_HAP_LIB_PATH = "/data/storage/el1/bundle/arkwebcore/libs/arm"; diff --git a/modules/sandbox/BUILD.gn b/modules/sandbox/BUILD.gn index 5a7d2d2c..b8f94679 100644 --- a/modules/sandbox/BUILD.gn +++ b/modules/sandbox/BUILD.gn @@ -61,7 +61,7 @@ if (defined(appspawn_sandbox_new) && appspawn_sandbox_new) { part_name = "${part_name}" install_enable = true if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { defines += [ "APPSPAWN_64" ] module_install_dir = "lib64/appspawn/common" } else { @@ -126,7 +126,7 @@ if (defined(appspawn_sandbox_new) && appspawn_sandbox_new) { part_name = "${part_name}" install_enable = true if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { defines += [ "APPSPAWN_64" ] module_install_dir = "lib64/appspawn/common" } else { diff --git a/modules/sysevent/BUILD.gn b/modules/sysevent/BUILD.gn index 7c0ef32e..6e72860e 100644 --- a/modules/sysevent/BUILD.gn +++ b/modules/sysevent/BUILD.gn @@ -30,7 +30,7 @@ ohos_shared_library("event_reporter") { part_name = "${part_name}" install_enable = true if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { module_install_dir = "lib64/appspawn/common" } else { module_install_dir = "lib/appspawn/common" diff --git a/test/unittest/app_spawn_standard_test/BUILD.gn b/test/unittest/app_spawn_standard_test/BUILD.gn index 7a2e1921..3c814d16 100644 --- a/test/unittest/app_spawn_standard_test/BUILD.gn +++ b/test/unittest/app_spawn_standard_test/BUILD.gn @@ -207,7 +207,7 @@ ohos_unittest("AppSpawn_ut") { } if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { defines += [ "APPSPAWN_64" ] } @@ -396,7 +396,7 @@ ohos_unittest("AppSpawn_coldrun_ut") { } if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { defines += [ "APPSPAWN_64" ] } @@ -585,7 +585,7 @@ ohos_unittest("AppSpawn_common_ut") { } if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { defines += [ "APPSPAWN_64" ] } -- Gitee