build: Support -mcpu= on ARM and ARM64

This commit is contained in:
klzgrad 2020-05-19 23:42:14 +08:00
parent 7fe5d2752c
commit 23ae57f2c2
2 changed files with 12 additions and 0 deletions

View File

@ -36,6 +36,8 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
# Thumb is a reduced instruction set available on some ARM processors that
# has increased code density.
arm_use_thumb = true
arm_cpu = ""
}
if (current_os == "android" || target_os == "android") {
@ -123,6 +125,9 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
# arm64 supports only "hard".
arm_float_abi = "hard"
arm_use_neon = true
declare_args() {
arm_cpu = ""
}
declare_args() {
# Enables the new Armv8 branch protection features. Valid strings are:
# - "standard": Enables both Pointer Authentication Code (featured in

View File

@ -874,6 +874,10 @@ config("compiler_cpu_abi") {
"-march=$arm_arch",
"-mfloat-abi=$arm_float_abi",
]
if (arm_cpu != "") {
cflags += [ "-mcpu=$arm_cpu" ]
}
ldflags += [ "-mfloat-abi=$arm_float_abi" ]
}
if (arm_tune != "") {
cflags += [ "-mtune=$arm_tune" ]
@ -883,6 +887,9 @@ config("compiler_cpu_abi") {
cflags += [ "--target=aarch64-linux-gnu" ]
ldflags += [ "--target=aarch64-linux-gnu" ]
}
if (arm_cpu != "") {
cflags += [ "-mcpu=$arm_cpu" ]
}
} else if (current_cpu == "mipsel" && !is_nacl) {
ldflags += [ "-Wl,--hash-style=sysv" ]
if (custom_toolchain == "") {