From adfa3a6c926b7608d2fc2e50fa071caf5e7e0017 Mon Sep 17 00:00:00 2001 From: klzgrad Date: Tue, 19 May 2020 23:42:14 +0800 Subject: [PATCH] build: Support ARM -mcpu= flag --- src/build/config/arm.gni | 2 ++ src/build/config/compiler/BUILD.gn | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/build/config/arm.gni b/src/build/config/arm.gni index 29434eba92..7b6e40f8ee 100644 --- a/src/build/config/arm.gni +++ b/src/build/config/arm.gni @@ -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" || diff --git a/src/build/config/compiler/BUILD.gn b/src/build/config/compiler/BUILD.gn index c99ce0b477..c6a9e9f831 100644 --- a/src/build/config/compiler/BUILD.gn +++ b/src/build/config/compiler/BUILD.gn @@ -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" ] }