build: Support ARM -mcpu= flag

This commit is contained in:
klzgrad 2020-05-19 23:42:14 +08:00
parent 81e4b25181
commit adfa3a6c92
2 changed files with 6 additions and 2 deletions

View File

@ -41,6 +41,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 = ""
}
assert(arm_float_abi == "" || arm_float_abi == "hard" ||

View File

@ -741,21 +741,23 @@ config("compiler_cpu_abi") {
]
}
} else if (current_cpu == "arm") {
if (is_clang && !is_android && !is_nacl) {
if (is_clang && !is_android && !is_nacl && custom_toolchain == "") {
cflags += [ "--target=arm-linux-gnueabihf" ]
ldflags += [ "--target=arm-linux-gnueabihf" ]
}
if (!is_nacl) {
cflags += [
"-march=$arm_arch",
"-mcpu=$arm_cpu",
"-mfloat-abi=$arm_float_abi",
]
ldflags += [ "-mfloat-abi=$arm_float_abi" ]
}
if (arm_tune != "") {
cflags += [ "-mtune=$arm_tune" ]
}
} else if (current_cpu == "arm64") {
if (is_clang && !is_android && !is_nacl && !is_fuchsia) {
if (is_clang && !is_android && !is_nacl && !is_fuchsia && custom_toolchain == "") {
cflags += [ "--target=aarch64-linux-gnu" ]
ldflags += [ "--target=aarch64-linux-gnu" ]
}