From affcec1b9c5b5177e53cc5871fe8857e4fa9d27c Mon Sep 17 00:00:00 2001 From: wengchangcheng Date: Tue, 1 Nov 2022 14:47:11 +0800 Subject: [PATCH] Descriptor: Fix for standalone build Details: Modify gn error Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I5YQMQ Signed-off-by: wengchangcheng Change-Id: I6a44ba5c30cfac555c972ae0f3e7c4aab682ee44 --- BUILD.gn | 1 - build/compile_script/ark.py | 13 ++++++------- build/config/BUILD.gn | 8 ++++++-- build/config/BUILDCONFIG.gn | 23 ++++++----------------- build/config/sanitizers/sanitizers.gni | 6 ++---- build/core/gn/BUILD.gn | 11 ++++++++++- inspector/BUILD.gn | 2 -- tooling/BUILD.gn | 1 - 8 files changed, 30 insertions(+), 35 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 81c127b6..2942d1e9 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -12,7 +12,6 @@ # limitations under the License. import("//arkcompiler/toolchain/toolchain.gni") -import("//build/ohos.gni") config("ark_toolchain_common_config") { defines = [ "PANDA_ENABLE_LTO" ] diff --git a/build/compile_script/ark.py b/build/compile_script/ark.py index 5553f399..44c973ad 100644 --- a/build/compile_script/ark.py +++ b/build/compile_script/ark.py @@ -138,14 +138,13 @@ def Get_templete(args_list): print("\033[34mUnkown word: %s\033[0m" % part) PrintHelp() sys.exit(1) +# Determine the target CPU + target_cpu = "target_cpu = \"%s\"" % global_arche # Determine the target CPU if global_arche in ("arm", "arm64"): - ARK_cpu = global_arche + ARK_os = "ohos" else: - ARK_cpu = "x64" - target_cpu = "target_cpu = \"%s\"" % ARK_cpu -# Determine the target OS,Only ohos for now - ARK_os = "ohos" + ARK_os = "linux" target_os = "target_os = \"%s\"" % ARK_os if global_mode == "debug": is_debug = "is_debug = true" @@ -214,9 +213,9 @@ def Main(argvs): if pass_code == 0: pass_code += RunTest(templete) if pass_code == 0: - print('\033[32mDone!\033[0m', '\033[32mARK_{} compilation finished successfully.\033[0m'.format(argvs[0].split('.')[0])) + print('\033[32mDone!\033[0m', '\033[32m{} compilation finished successfully.\033[0m'.format(argvs[0])) else: - print('\033[31mError!\033[0m', '\033[31mARK_{} compilation finished with errors.\033[0m'.format(argvs[0].split('.')[0])) + print('\033[31mError!\033[0m', '\033[31m{} compilation finished with errors.\033[0m'.format(argvs[0])) return pass_code diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn index 2ca5eca2..e119a21c 100644 --- a/build/config/BUILD.gn +++ b/build/config/BUILD.gn @@ -22,11 +22,15 @@ config("complier_defaults") { config("executable_ldconfig") { if (!is_mac) { + cflags = [ "-fPIE" ] + asmflags = [ "-fPIE" ] ldflags = [ "-Wl,-rpath=\$ORIGIN/", "-Wl,-rpath-link=", - "-fPIE", - "-pthread", + "-pie", ] + if (current_os == "linux") { + ldflags += [ "-lpthread" ] + } } } diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn index 214ca291..a866edfa 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -23,17 +23,17 @@ if (target_os == "") { if (target_cpu == "") { if (target_os == "ohos") { - target_cpu = "x64" + target_cpu = "arm" } else { target_cpu = host_cpu } } if (current_cpu == "") { - current_cpu = host_cpu + current_cpu = target_cpu } if (current_os == "") { - current_os = host_os + current_os = target_os } # different host platform tools directory. @@ -100,21 +100,10 @@ if (host_toolchain == "") { } } -_default_toolchain = "" +assert(host_os == "linux" || host_os == "mac", + "ohos builds are only supported on Linux and Mac hosts.") -if (target_os == "ohos") { - assert(host_os == "linux" || host_os == "mac", - "ohos builds are only supported on Linux and Mac hosts.") - _default_toolchain = "$build_root/toolchain/ark:ark_clang_$target_cpu" -} else if (target_os == "linux") { - if (is_clang) { - _default_toolchain = "$build_root/toolchain/linux:clang_$target_cpu" - } else { - _default_toolchain = "$build_root/toolchain/linux:$target_cpu" - } -} else { - assert(false, "Unsupported target_os: $target_os") -} +_default_toolchain = "$build_root/toolchain/ark:ark_clang_$target_cpu" # If a custom toolchain has been set in the args, set it as default. Otherwise, # set the default toolchain for the platform (if any). diff --git a/build/config/sanitizers/sanitizers.gni b/build/config/sanitizers/sanitizers.gni index fb193d91..457a9627 100644 --- a/build/config/sanitizers/sanitizers.gni +++ b/build/config/sanitizers/sanitizers.gni @@ -63,15 +63,13 @@ declare_args() { # Compile with Control Flow Integrity to protect virtual calls and casts. # See http://clang.llvm.org/docs/ControlFlowIntegrity.html - is_cfi = target_os == "linux" && !is_chromeos && target_cpu == "x64" && - is_official_build + is_cfi = target_os == "linux" && target_cpu == "x64" # Enable checks for bad casts: derived cast and unrelated cast. use_cfi_cast = false # Enable checks for indirect function calls via a function pointer. - use_cfi_icall = target_os == "linux" && !is_chromeos && target_cpu == "x64" && - is_official_build + use_cfi_icall = target_os == "linux" && target_cpu == "x64" # Print detailed diagnostics when Control Flow Integrity detects a violation. use_cfi_diag = false diff --git a/build/core/gn/BUILD.gn b/build/core/gn/BUILD.gn index 77b0c0d9..a9a93187 100644 --- a/build/core/gn/BUILD.gn +++ b/build/core/gn/BUILD.gn @@ -17,6 +17,7 @@ import("//arkcompiler/ets_runtime/js_runtime_config.gni") print("root_out_dir=$root_out_dir") print("root_build_dir=$root_build_dir") print("root_gen_dir=$root_gen_dir") +print("default_toolchain=$default_toolchain") print("current_toolchain=$current_toolchain") print("host_toolchain=$host_toolchain") print("current_os=$current_os, current_cpu=$current_cpu") @@ -36,12 +37,13 @@ group("linux_packages") { deps = [ ":ets_frontend($host_toolchain)", ":ets_runtime($host_toolchain)", + ":runtime_core($host_toolchain)", ] } } group("ets_runtime") { - deps = [ "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm" ] + deps = [ "//arkcompiler/ets_runtime:ark_js_packages" ] } group("ets_frontend") { @@ -51,3 +53,10 @@ group("ets_frontend") { "//arkcompiler/ets_frontend/ts2panda:ts2abc_build", ] } + +group("runtime_core") { + deps = [ + "//arkcompiler/runtime_core/assembler:ark_asm", + "//arkcompiler/runtime_core/disassembler:ark_disasm", + ] +} diff --git a/inspector/BUILD.gn b/inspector/BUILD.gn index 7a84f766..d418d9a5 100644 --- a/inspector/BUILD.gn +++ b/inspector/BUILD.gn @@ -12,8 +12,6 @@ # limitations under the License. import("//arkcompiler/toolchain/toolchain.gni") -import("//build/ohos.gni") -import("//foundation/arkui/ace_engine/ace_config.gni") config("ark_debugger_config") { cflags_cc = [ diff --git a/tooling/BUILD.gn b/tooling/BUILD.gn index 845b2d25..80c5b6d1 100644 --- a/tooling/BUILD.gn +++ b/tooling/BUILD.gn @@ -12,7 +12,6 @@ # limitations under the License. import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//build/ohos.gni") config("ark_ecma_debugger_config") { configs = [ -- Gitee