From 0bfc1bbe700e3891506313b360ffe616004855eb Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Thu, 21 Oct 2021 20:39:49 -0700 Subject: [PATCH] Arm64: Don't fall back to native In the case of Arm64, make sure not to fallback to native if we hit an unsupported CPU. Can cause issues depending on system configuration. --- CMakeLists.txt | 10 +++++----- Scripts/aarch64_fit_native.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 55fa4bf9c..f975a66d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -300,11 +300,6 @@ if(ENUM_ENUM_WARNING) add_compile_options(-Wno-deprecated-enum-enum-conversion) endif() -check_cxx_compiler_flag("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE) -if(COMPILER_SUPPORTS_MARCH_NATIVE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") -endif() - if(ENABLE_WERROR OR ENABLE_STRICT_WERROR) add_compile_options(-Werror) if (NOT ENABLE_STRICT_WERROR) @@ -336,6 +331,11 @@ if(_M_ARM_64) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=${AARCH64_CPU}") endif() endif() +else() + check_cxx_compiler_flag("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE) + if(COMPILER_SUPPORTS_MARCH_NATIVE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") + endif() endif() if (ENABLE_IWYU) diff --git a/Scripts/aarch64_fit_native.py b/Scripts/aarch64_fit_native.py index 3955e8c9e..392dd34ed 100644 --- a/Scripts/aarch64_fit_native.py +++ b/Scripts/aarch64_fit_native.py @@ -60,8 +60,8 @@ with open(sys.argv[1]) as cpuinfo_file: current_part = int(re.findall(r'0x[0-9A-F]+', line, re.I)[0], 16) cpuinfo += {tuple([current_implementer, current_part])} -largest_big = "native" -largest_little = "native" +largest_big = "cortex-a57" +largest_little = "cortex-a53" for core in cpuinfo: if BigCoreIDs.get(core):