Skip to content

Commit 59f89a6

Browse files
committed
Improve ARM processor checks.
When cross-compiling for ARM, the toolchain file will likely set CMAKE_SYSTEM_PROCESSOR to exactly "arm", but when building for ARM natively, that is not the case and we may encounter values such as "armv7a". Rather than enumerating each and every possible value, treat anything that starts with "arm" other than "arm64" the same.
1 parent d3a526e commit 59f89a6

4 files changed

Lines changed: 7 additions & 8 deletions

File tree

modules/compiler/targets/host/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,8 @@ if(CA_HOST_CROSS_COMPILERS)
151151
else()
152152
set(HostArchitecture x86_64)
153153
endif()
154-
elseif(CMAKE_SYSTEM_PROCESSOR_TOUPPER STREQUAL ARM OR
155-
CMAKE_SYSTEM_PROCESSOR_TOUPPER STREQUAL AARCH64 OR
156-
CMAKE_SYSTEM_PROCESSOR_TOUPPER STREQUAL ARM64)
154+
elseif(CMAKE_SYSTEM_PROCESSOR_TOUPPER MATCHES "^ARM" OR
155+
CMAKE_SYSTEM_PROCESSOR_TOUPPER STREQUAL AARCH64)
157156
if(CA_BUILD_32_BITS OR CMAKE_SIZEOF_VOID_P EQUAL 4)
158157
set(HostArchitecture arm)
159158
else()

modules/compiler/vecz/test/lit/lit.site.cfg.py.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ lit_config.load_config(config, common_lit_cfg_path)
3131

3232
if '@CMAKE_SYSTEM_PROCESSOR@'.casefold() in ['aarch64', 'arm64']:
3333
config.available_features.add('aarch64')
34-
elif '@CMAKE_SYSTEM_PROCESSOR@'.casefold() == 'arm':
34+
elif '@CMAKE_SYSTEM_PROCESSOR@'.casefold().startswith('arm'):
3535
config.available_features.add('arm')
3636

3737
# Some lit tests may fail when cross-compiled, so add the native feature if not

modules/lit/lit.common.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ elif config.system_processor in ('x86', 'i686'):
9898
config.available_features.add('x86')
9999
elif config.system_processor in ('aarch64', 'arm64'):
100100
config.available_features.add('aarch64')
101-
elif config.system_processor in ('arm', 'armv7'):
101+
elif config.system_processor.startswith('arm'):
102102
config.available_features.add('arm32')
103103

104104
config.ca_host_os = '@CMAKE_SYSTEM_NAME@'

modules/mux/targets/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ function(get_ca_host_arch parent_variable_name)
8181
string(TOUPPER "${CMAKE_SYSTEM_PROCESSOR}" ARCH)
8282
endif()
8383

84-
if(ARCH STREQUAL "ARM")
85-
set(${parent_variable_name} "Arm" PARENT_SCOPE)
86-
elseif(ARCH STREQUAL "ARM64" OR ARCH STREQUAL "AARCH64")
84+
if(ARCH STREQUAL "ARM64" OR ARCH STREQUAL "AARCH64")
8785
set(${parent_variable_name} "AArch64" PARENT_SCOPE)
86+
elseif(ARCH MATCHES "^ARM")
87+
set(${parent_variable_name} "Arm" PARENT_SCOPE)
8888
elseif(ARCH MATCHES "^(I[3-6]86|X86)$")
8989
set(${parent_variable_name} "x86" PARENT_SCOPE)
9090
elseif(ARCH STREQUAL "X86_64" OR ARCH STREQUAL "AMD64")

0 commit comments

Comments
 (0)