From a9812b3b27224cad69178fb9e8b6fb0c4b46573f Mon Sep 17 00:00:00 2001 From: xieyijun3 Date: Wed, 14 Jun 2023 19:08:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?aarch64=E7=BC=96=E8=AF=91=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20Signed-off-by:=20x30034819=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xieyijun3 --- build/configs/arm.gni | 146 +++++++++++++++++++++++++++++ build/gn/configs/compiler/BUILD.gn | 2 +- 2 files changed, 147 insertions(+), 1 deletion(-) create mode 100755 build/configs/arm.gni diff --git a/build/configs/arm.gni b/build/configs/arm.gni new file mode 100755 index 0000000..fec97c8 --- /dev/null +++ b/build/configs/arm.gni @@ -0,0 +1,146 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +#import("//build/configs/v8_target_cpu.gni") +v8_current_cpu = current_cpu +v8_target_cpu = target_cpu + +# These are primarily relevant in current_cpu == "arm" contexts, where +# ARM code is being compiled. But they can also be relevant in the +# other contexts when the code will change its behavior based on the +# cpu it wants to generate code for. +if (current_cpu == "arm" || v8_current_cpu == "arm") { + declare_args() { + # Version of the ARM processor when compiling on ARM. Ignored on non-ARM + # platforms. + arm_version = 7 + + # The ARM architecture. This will be a string like "armv6" or "armv7-a". + # An empty string means to use the default for the arm_version. + arm_arch = "" + + # The ARM floating point hardware. This will be a string like "neon" or + # "vfpv3". An empty string means to use the default for the arm_version. + arm_fpu = "" + + # The ARM floating point mode. This is either the string "hard", "soft", or + # "softfp". An empty string means to use the default one for the + # arm_version. + arm_float_abi = "" + + # The ARM variant-specific tuning mode. This will be a string like "armv6" + # or "cortex-a15". An empty string means to use the default for the + # arm_version. + arm_tune = "" + + # Whether to use the neon FPU instruction set or not. + arm_use_neon = "" + + # Whether to enable optional NEON code paths. + arm_optionally_use_neon = false + + # Thumb is a reduced instruction set available on some ARM processors that + # has increased code density. + arm_use_thumb = true + } + + assert(arm_float_abi == "" || arm_float_abi == "hard" || + arm_float_abi == "soft" || arm_float_abi == "softfp") + + if (arm_use_neon == "") { + if (current_os == "linux" && target_cpu != v8_target_cpu) { + # Don't use neon on V8 simulator builds as a default. + arm_use_neon = false + } else { + arm_use_neon = true + } + } + + if (arm_version == 6) { + if (arm_arch == "") { + arm_arch = "armv6" + } + if (arm_tune != "") { + arm_tune = "" + } + if (arm_float_abi == "") { + arm_float_abi = "softfp" + } + if (arm_fpu == "") { + arm_fpu = "vfp" + } + arm_use_thumb = false + arm_use_neon = false + } else if (arm_version == 7) { + if (arm_arch == "") { + arm_arch = "armv7-a" + } + if (arm_tune == "") { + arm_tune = "generic-armv7-a" + } + + if (arm_float_abi == "") { + if (current_os == "ohos" || target_os == "ohos" || + target_os == "android") { + arm_float_abi = "softfp" + } else if (current_os == "linux" && target_cpu != v8_target_cpu) { + arm_float_abi = "softfp" + } else { + arm_float_abi = "hard" + } + } + + if (arm_fpu == "") { + if (arm_use_neon) { + arm_fpu = "neon" + } else { + arm_fpu = "vfpv3-d16" + } + } + } else if (arm_version == 8) { + if (arm_arch == "") { + arm_arch = "armv8-a" + } + if (arm_tune == "") { + arm_tune = "generic-armv8-a" + } + + if (arm_float_abi == "") { + if (current_os == "ohos" || target_os == "ohos" || + target_os == "android") { + arm_float_abi = "softfp" + } else { + arm_float_abi = "hard" + } + } + + if (arm_fpu == "") { + if (arm_use_neon) { + arm_fpu = "neon" + } else { + arm_fpu = "vfpv3-d16" + } + } + } +} else if (current_cpu == "arm64" || v8_current_cpu == "arm64") { + if (!defined(board_arch)) { + arm_arch = "armv8-a" + } else { + arm_arch = "$board_arch" + } + if (!defined(board_cpu)) { + arm_cpu = "cortex-a55" + } else { + arm_cpu = "$board_cpu" + } + if (!defined(board_fpu)) { + arm_fpu = "neon-fp-armv8" + } else { + arm_fpu = "$board_fpu" + } + + # arm64 supports only "hard". + arm_float_abi = "hard" + arm_use_neon = true +} diff --git a/build/gn/configs/compiler/BUILD.gn b/build/gn/configs/compiler/BUILD.gn index 88e9c08..2de69e5 100755 --- a/build/gn/configs/compiler/BUILD.gn +++ b/build/gn/configs/compiler/BUILD.gn @@ -6,7 +6,7 @@ import("//build/gn/configs/compiler/compiler.gni") import("//build/gn/toolchain/toolchain.gni") if (current_cpu == "arm" || current_cpu == "arm64") { - import("//build/config/arm.gni") + import("//build/configs/arm.gni") } declare_args() { -- Gitee From 567194ab4c1d5dd2c44f28d329041539cb3ef257 Mon Sep 17 00:00:00 2001 From: xieyijun3 Date: Thu, 15 Jun 2023 10:31:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?aarch64=E7=BC=96=E8=AF=91=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20Signed-off-by:=20x30034819=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xieyijun3 --- build/configs/arm.gni | 1 - 1 file changed, 1 deletion(-) diff --git a/build/configs/arm.gni b/build/configs/arm.gni index fec97c8..a0815c4 100755 --- a/build/configs/arm.gni +++ b/build/configs/arm.gni @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -#import("//build/configs/v8_target_cpu.gni") v8_current_cpu = current_cpu v8_target_cpu = target_cpu -- Gitee