From fa756a081b70ea917ddea0375a36e6ae9aa5ebef Mon Sep 17 00:00:00 2001 From: Olshevsky Vladimir Date: Wed, 21 May 2025 10:26:47 +0300 Subject: [PATCH 1/2] GCC warnings suppressed Disabled GCC warnings which caused errors when buildig x86_64 with INTEROP_JS=ON Signed-off-by: Olshevsky Vladimir --- .../plugins/ets/runtime/interop_js/call/arg_convertors.h | 6 ++++++ .../plugins/ets/runtime/interop_js/call/call_ets.cpp | 6 ++++++ static_core/plugins/ets/runtime/interop_js/xgc/xgc.cpp | 9 +++++++++ 3 files changed, 21 insertions(+) diff --git a/static_core/plugins/ets/runtime/interop_js/call/arg_convertors.h b/static_core/plugins/ets/runtime/interop_js/call/arg_convertors.h index dda3d10dd7..8eb9cab316 100644 --- a/static_core/plugins/ets/runtime/interop_js/call/arg_convertors.h +++ b/static_core/plugins/ets/runtime/interop_js/call/arg_convertors.h @@ -22,6 +22,8 @@ namespace ark::ets::interop::js { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wattributes" template static ALWAYS_INLINE bool UnwrapVal(InteropCtx *ctx, napi_env env, napi_value jsVal, FStore &storeRes) { @@ -37,6 +39,7 @@ static ALWAYS_INLINE bool UnwrapVal(InteropCtx *ctx, napi_env env, napi_value js } return true; } +#pragma GCC diagnostic pop template [[nodiscard]] static ALWAYS_INLINE inline bool ConvertRefArgToEts(InteropCtx *ctx, Class *klass, FStore &storeRes, @@ -158,7 +161,10 @@ static ObjectHeader **DoPackRestParameters(EtsCoroutine *coro, InteropCtx *ctx, } if constexpr (!IS_OBJ_ARR) { if constexpr (!IS_VAL_PTR) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" return *reinterpret_cast(&val); +#pragma GCC diagnostic pop } } UNREACHABLE(); diff --git a/static_core/plugins/ets/runtime/interop_js/call/call_ets.cpp b/static_core/plugins/ets/runtime/interop_js/call/call_ets.cpp index 3436b81f30..31b1f47578 100644 --- a/static_core/plugins/ets/runtime/interop_js/call/call_ets.cpp +++ b/static_core/plugins/ets/runtime/interop_js/call/call_ets.cpp @@ -138,12 +138,17 @@ ALWAYS_INLINE inline bool CallETSHandler::ConvertArgs(Span etsArgs) return true; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wattributes" ObjectHeader **CallETSHandler::ConvertRestParams(Span restArgs) { ASSERT(protoReader_.GetType().IsReference()); return PackRestParameters(coro_, ctx_, protoReader_, restArgs); } +#pragma GCC diagnostic pop +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wattributes" bool CallETSHandler::CheckNumArgs(size_t numArgs) const { const auto method = protoReader_.GetMethod(); @@ -169,6 +174,7 @@ bool CallETSHandler::CheckNumArgs(size_t numArgs) const } return true; } +#pragma GCC diagnostic pop template napi_value CallETSHandler::HandleImpl() diff --git a/static_core/plugins/ets/runtime/interop_js/xgc/xgc.cpp b/static_core/plugins/ets/runtime/interop_js/xgc/xgc.cpp index f373278aaa..942c598cc7 100644 --- a/static_core/plugins/ets/runtime/interop_js/xgc/xgc.cpp +++ b/static_core/plugins/ets/runtime/interop_js/xgc/xgc.cpp @@ -83,6 +83,8 @@ XGC::XGC(PandaEtsVM *vm, STSVMInterfaceImpl *stsVmIface, ets_proxy::SharedRefere targetThreasholdSize_.store(minimalThresholdSize_, std::memory_order_relaxed); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wattributes" ALWAYS_INLINE static void MarkJsObject(ets_proxy::SharedReference *ref, STSVMInterfaceImpl *stsVmIface) { ASSERT(ref->HasJSFlag()); @@ -91,7 +93,10 @@ ALWAYS_INLINE static void MarkJsObject(ets_proxy::SharedReference *ref, STSVMInt LOG_XGC(DEBUG) << "Notify to JS waiters"; stsVmIface->NotifyWaiters(); } +#pragma GCC diagnostic pop +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wattributes" ALWAYS_INLINE static void MarkEtsObject(ets_proxy::SharedReference *ref, PandaEtsVM *vm) { ASSERT(ref->HasETSFlag()); @@ -100,6 +105,7 @@ ALWAYS_INLINE static void MarkEtsObject(ets_proxy::SharedReference *ref, PandaEt LOG_XGC(DEBUG) << "Start marking from " << etsObj << " (" << etsObj->GetClass()->GetDescriptor() << ")"; gc->MarkObjectRecursively(etsObj->GetCoreType()); } +#pragma GCC diagnostic pop static auto CreateXObjectHandler(ets_proxy::SharedReferenceStorage *storage, STSVMInterfaceImpl *stsVmIface) { @@ -388,6 +394,8 @@ bool XGC::Trigger(mem::GC *gc, PandaUniquePtr task) return true; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wattributes" ALWAYS_INLINE bool XGC::NeedToTriggerXGC([[maybe_unused]] const mem::GC *gc) const { switch (treiggerPolicy_) { @@ -418,6 +426,7 @@ ALWAYS_INLINE bool XGC::NeedToTriggerXGC([[maybe_unused]] const mem::GC *gc) con #endif // PANDA_TARGET_OHOS return true; } +#pragma GCC diagnostic pop void XGC::TriggerGcIfNeeded(mem::GC *gc) { -- Gitee From 411c2665c9fd3517e0b7fde55fee82d2b126eb0b Mon Sep 17 00:00:00 2001 From: Olshevsky Vladimir Date: Wed, 21 May 2025 14:23:34 +0300 Subject: [PATCH 2/2] build_sdk_lib: INTEROP_JS=ON for linux_tools --- static_core/scripts/sdk/build_sdk_lib | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static_core/scripts/sdk/build_sdk_lib b/static_core/scripts/sdk/build_sdk_lib index db7904311f..0a98e7f921 100644 --- a/static_core/scripts/sdk/build_sdk_lib +++ b/static_core/scripts/sdk/build_sdk_lib @@ -124,11 +124,12 @@ function linux_tools() { -DPANDA_CROSS_AARCH64_TOOLCHAIN_FILE=cmake/toolchain/cross-ohos-musl-aarch64.cmake \ -DTOOLCHAIN_SYSROOT=$OHOS_SDK_NATIVE/sysroot \ -DTOOLCHAIN_CLANG_ROOT=$OHOS_SDK_NATIVE/llvm \ + -DPANDA_ETS_INTEROP_JS=ON \ -DPANDA_LLVM_BACKEND=${PANDA_LLVM_BACKEND} \ ${extra_llvm_opts} \ -DPANDA_BUILD_LLVM_BINARIES=${PANDA_BUILD_LLVM_BINARIES} \ -DPANDA_BUILD_LLVM_BINARIES_PATH_ROOT=${SDK_BUILD_ROOT}/llvm_binaries" - local linux_build_targets="ark ark_aot ark_disasm ark_link es2panda etssdk e2p_test_plugin etsnative verifier ani_helpers aspt_converter" + local linux_build_targets="ark ark_aot ark_disasm ark_link es2panda etssdk ets_interop_js_napi e2p_test_plugin etsnative verifier ani_helpers aspt_converter" build_panda "$linux_build_dir" "$linux_cmake_args" "$linux_build_targets" copy_into_sdk "$linux_build_dir" "$PANDA_SDK_PATH/linux_host_tools" "$SCRIPT_DIR"/linux_host_tools.txt copy_abc_files "$linux_build_dir" -- Gitee