mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-06 15:43:44 +00:00
[新需求]: Enable run_with_asan
Enable run_with_asan for furthur stability tests. Issue: #IASGY0 Signed-off-by: lichenshuai <lichenshuai@huawei.com> Change-Id: Ie176cf06e25a605059b8d7fa6db9a1b3ca0fa339
This commit is contained in:
parent
dcac0f0700
commit
57ffe8ed46
22
BUILD.gn
22
BUILD.gn
@ -13,7 +13,6 @@
|
||||
|
||||
import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
|
||||
import("//arkcompiler/ets_runtime/js_runtime_config.gni")
|
||||
import("$build_root/config/sanitizers/sanitizers.gni")
|
||||
import("$build_root/toolchain/toolchain.gni")
|
||||
|
||||
group("ark_js_packages") {
|
||||
@ -476,24 +475,6 @@ config("ark_jsruntime_common_config") {
|
||||
defines += [ "ENABLE_COW_ARRAY" ]
|
||||
}
|
||||
|
||||
if (run_with_asan && is_linux &&
|
||||
(current_cpu == "x86" || current_cpu == "x64")) {
|
||||
cflags_cc += [
|
||||
"-fno-inline-functions",
|
||||
"-fno-inline",
|
||||
"-fsanitize=address",
|
||||
"-fsanitize-address-use-after-scope",
|
||||
"-fno-omit-frame-pointer",
|
||||
"-fsanitize=leak",
|
||||
]
|
||||
|
||||
if (!use_musl) {
|
||||
libs = [ "$clang_base_path/lib64/clang/$clang_version/lib/linux/libclang_rt.asan-x86_64.a" ]
|
||||
} else {
|
||||
libs = [ "$clang_base_path/lib/clang/$clang_version/lib/x86_64-linux-ohos/libclang_rt.asan.a" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (current_cpu == "arm") {
|
||||
defines += [
|
||||
"PANDA_TARGET_ARM32_ABI_SOFT=1",
|
||||
@ -1167,7 +1148,8 @@ ohos_source_set("libark_jsruntime_test_set") {
|
||||
}
|
||||
|
||||
if (is_ohos && is_standard_system) {
|
||||
stub_an_file_path = "/system/lib64/${arkcompiler_relative_lib_path}/stub.an"
|
||||
stub_an_file_path =
|
||||
"${arkcompiler_lib64_path}/${arkcompiler_relative_lib_path}/stub.an"
|
||||
} else {
|
||||
stub_an_file_path =
|
||||
rebase_path("$root_gen_dir/arkcompiler/ets_runtime/stub.an")
|
||||
|
@ -1424,7 +1424,8 @@ void NewObjectStubBuilder::HeapAlloc(Variable *result, Label *exit, RegionSpaceF
|
||||
}
|
||||
}
|
||||
|
||||
void NewObjectStubBuilder::AllocateInSOldPrologue(Variable *result, Label *callRuntime, Label *exit)
|
||||
void NewObjectStubBuilder::AllocateInSOldPrologue([[maybe_unused]] Variable *result,
|
||||
Label *callRuntime, [[maybe_unused]] Label *exit)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
Label success(env);
|
||||
@ -1473,7 +1474,8 @@ void NewObjectStubBuilder::AllocateInSOld(Variable *result, Label *exit, GateRef
|
||||
}
|
||||
}
|
||||
|
||||
void NewObjectStubBuilder::AllocateInYoungPrologue(Variable *result, Label *callRuntime, Label *exit)
|
||||
void NewObjectStubBuilder::AllocateInYoungPrologue([[maybe_unused]] Variable *result,
|
||||
Label *callRuntime, [[maybe_unused]] Label *exit)
|
||||
{
|
||||
auto env = GetEnvironment();
|
||||
Label success(env);
|
||||
|
@ -105,12 +105,12 @@ public:
|
||||
|
||||
inline void AsanPoisonFreeObject() const
|
||||
{
|
||||
ASAN_POISON_MEMORY_REGION(mem_, size_);
|
||||
ASAN_POISON_MEMORY_REGION((const volatile void *)mem_, size_);
|
||||
}
|
||||
|
||||
inline void AsanUnPoisonFreeObject() const
|
||||
{
|
||||
ASAN_UNPOISON_MEMORY_REGION(mem_, size_);
|
||||
ASAN_UNPOISON_MEMORY_REGION((const volatile void *)mem_, size_);
|
||||
}
|
||||
|
||||
inline void SetInstalled(bool installed)
|
||||
|
@ -23,6 +23,7 @@ declare_args() {
|
||||
|
||||
# If true, enable fuzz option. Default false.
|
||||
enable_fuzz_option = false
|
||||
run_with_asan = false
|
||||
|
||||
# Enable pgo for building.
|
||||
ets_runtime_feature_enable_pgo = false
|
||||
@ -67,13 +68,13 @@ if (!ark_standalone_build) {
|
||||
if (!defined(build_variant)) {
|
||||
build_variant = "root"
|
||||
}
|
||||
import("$build_root/config/sanitizers/sanitizers.gni")
|
||||
ark_root = "//arkcompiler/runtime_core"
|
||||
js_root = "//arkcompiler/ets_runtime"
|
||||
global_root = "//base/global/i18n"
|
||||
hilog_root = "//base/hiviewdfx/hilog/interfaces/native/innerkits"
|
||||
qos_root = "//foundation/resourceschedule/qos_manager"
|
||||
compile_llvm_online = false
|
||||
run_with_asan = false
|
||||
if (enable_fuzz_option) {
|
||||
run_with_asan = true
|
||||
}
|
||||
@ -90,6 +91,11 @@ if (defined(is_arkui_x) && is_arkui_x && defined(runtime_mode) &&
|
||||
asan_lib_path = "/usr/lib/llvm-10/lib/clang/10.0.0/lib/linux"
|
||||
|
||||
# under /system/lib64 dir
|
||||
if (is_asan) {
|
||||
arkcompiler_lib64_path = "/system/asan/lib64"
|
||||
} else {
|
||||
arkcompiler_lib64_path = "/system/lib64"
|
||||
}
|
||||
arkcompiler_relative_lib_path = "module/arkcompiler"
|
||||
if (is_standard_system || ark_standalone_build) {
|
||||
icu_part_name = "icu"
|
||||
@ -190,7 +196,7 @@ template("libark_jsruntime_common_set") {
|
||||
|
||||
if (is_ohos && is_standard_system) {
|
||||
stub_an_file_path =
|
||||
"/system/lib64/${arkcompiler_relative_lib_path}/stub.an"
|
||||
"${arkcompiler_lib64_path}/${arkcompiler_relative_lib_path}/stub.an"
|
||||
} else {
|
||||
stub_an_file_path =
|
||||
rebase_path("$root_gen_dir/arkcompiler/ets_runtime/stub.an")
|
||||
|
Loading…
Reference in New Issue
Block a user