Add arm64 args patch

@midzer @gz83 This should enable settings arm64 optimization settings in the args.gn, rather than seperate arm.gni for mac, raspi, windows on arm, etc.

It also makes it where these args will be passed to more targets, because before, when setting arm64 as the target_cpu, it would only accept a subset, i.e. only these:

arm_version = 
arm_float_abi = 
arm_use_neon = 
arm_use_thumb =
arm_control_flow_integrity = 

I also cherry picked a patch from M111 that sets arm_control_flow_integrity = "standard" ONLY if it is android or linux. This will set it to "none" for Mac and Windows on ARM builds, which I think will fix the Mac M1 bugs, and allow building for Windows on ARM with the standard WinSDK toolchain.
This commit is contained in:
Alexander David Frick 2023-02-20 20:19:27 -06:00 committed by GitHub
parent c552ad39b0
commit 31622de594
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -125,29 +125,58 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
}
}
} else if (current_cpu == "arm64" || v8_current_cpu == "arm64") {
# arm64 supports only "hard".
arm_version = 8
arm_float_abi = "hard"
arm_use_neon = true
declare_args() {
# Enables the new Armv8 branch protection features. Valid strings are:
# - "pac": Enables Pointer Authentication Code (PAC, featured in Armv8.3)
# - "standard": Enables both PAC and Branch Target Identification (Armv8.5).
# - "none": No branch protection.
arm_control_flow_integrity = "standard"
# TODO(cavalcantii): enable the feature for the following OSes next.
if (is_mac || is_chromeos || is_fuchsia || is_win ||
target_cpu != "arm64") {
# target_cpu != "arm64" covers some cases (e.g. the ChromeOS x64 MSAN
# build) where the target platform is x64, but V8 is configured to use
# the arm64 simulator. Pointer authentication doesn't work properly
# in this mode (yet).
arm_control_flow_integrity = "none"
# Version of the ARM processor when compiling on ARM. Ignored on non-ARM
# platforms.
arm_version = 8
# arm64 supports only "hard".
arm_float_abi = "hard"
# The ARM64 architecture. This will be a string like "armv8-a" or "armv8.5-a.
# An empty string means to use the default for the arm_version.
arm_arch = "armv8-a"
# 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 = "generic-armv8-a"
# The ARM64 floating point hardware. This will be a string like "neon" or
# "vfpv3-d16". An empty string means to use the default for the arm_version.
arm_fpu = "neon"
# Whether to use the neon FPU instruction set or not.
arm_use_neon = "true"
# 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
if ((is_android || is_linux) && target_cpu == "arm64") {
# Enable PAC and BTI on AArch64 Linux/Android systems.
# target_cpu == "arm64" filters out some cases (e.g. the ChromeOS x64
# MSAN build) where the target platform is x64, but V8 is configured to
# use the arm64 simulator.
arm_control_flow_integrity = "standard"
}
}
# Initial values from upstream.
arm_version = 8
arm_float_abi = "hard"
arm_use_neon = true
assert(arm_control_flow_integrity == "none" ||
arm_control_flow_integrity == "standard" ||
arm_control_flow_integrity == "pac",
"Invalid branch protection option")
"Invalid ARM branch protection option.")
}