From bc4535c83b41ed511eaff1e4f729f0c105e03822 Mon Sep 17 00:00:00 2001 From: chenyiyuan Date: Mon, 9 Sep 2024 09:54:59 +0800 Subject: [PATCH] Enable PAC in Verifier SO Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/IAPSN6 Signed-off-by: chenyiyuan Change-Id: I6cac34e96114c85cb587c1499f3b92e494037228 --- BUILD.gn | 6 ------ ark_config.gni | 7 ++++--- libpandafile/BUILD.gn | 10 ++++++++++ verifier/BUILD.gn | 3 +++ 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 4153a62487..99ae0fb5b6 100755 --- a/BUILD.gn +++ b/BUILD.gn @@ -250,12 +250,6 @@ config("ark_config") { configs += [ "$ark_root/plugins/$plugin:ark_config" ] } - if (enabled_pac_data_protect) { - cflags_c += [ "-march=armv8.4-a" ] - cflags_cc += [ "-march=armv8.4-a" ] - defines += [ "PANDA_ENABLE_DATA_PROTECT" ] - } - if (current_cpu == "arm") { cflags_cc += [ "-march=armv7-a", diff --git a/ark_config.gni b/ark_config.gni index 171e42c384..aab5838e76 100644 --- a/ark_config.gni +++ b/ark_config.gni @@ -21,12 +21,13 @@ if (is_standard_system) { declare_args() { enabled_plugins = default_enabled_plugins - pandas_support_pac_oh_pac_data_protect = false enabled_pac_data_protect = false } -if (defined(target_cpu) && target_cpu == "arm64" && - pandas_support_pac_oh_pac_data_protect && !is_emulator) { +if (!ark_standalone_build && !(defined(is_arkui_x) && is_arkui_x) && is_ohos && + is_standard_system && target_cpu == "arm64" && !is_emulator && + defined(global_parts_info) && + defined(global_parts_info.security_code_signature)) { enabled_pac_data_protect = true } diff --git a/libpandafile/BUILD.gn b/libpandafile/BUILD.gn index 7f2c3d0c47..7f071bd58a 100644 --- a/libpandafile/BUILD.gn +++ b/libpandafile/BUILD.gn @@ -31,6 +31,11 @@ config("arkfile_public_config") { } } +config("data_protect_configs") { + cflags_cc = [ "-march=armv8.4-a" ] + defines = [ "PANDA_ENABLE_DATA_PROTECT" ] +} + config("arkfile_fuzz_config") { configs = [ "$build_root/config/compiler:exceptions" ] defines = [ "SUPPORT_KNOWN_EXCEPTION" ] @@ -100,6 +105,11 @@ ohos_static_library("libarkfile_static") { public_configs = libarkfile_configs + if (enabled_pac_data_protect) { + configs = libarkfile_configs + configs += [ ":data_protect_configs" ] + } + deps = [ ":arkfile_header_deps", "$ark_root/libpandabase:libarkbase_static", diff --git a/verifier/BUILD.gn b/verifier/BUILD.gn index eb6163a9f7..2d435550c7 100755 --- a/verifier/BUILD.gn +++ b/verifier/BUILD.gn @@ -57,6 +57,9 @@ libarkverifier_sources = [ ] ohos_shared_library("libarkverifier") { + if (!ark_standalone_build) { + branch_protector_ret = "pac_ret" + } sources = libarkverifier_sources deps = [ "$ark_root/libpandafile:libarkfile_static_verifier" ]