Skip to content

Commit 3eee6eb

Browse files
authored
BinaryPlatforms: Recognize MacOS(:aarch64) (#1916)
Also normalize arm64 -> aarch64, c.f. https://lists.gnu.org/archive/html/config-patches/2020-07/msg00002.html
1 parent a8cc6d6 commit 3eee6eb

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/BinaryPlatforms.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ struct MacOS <: Platform
140140
libc::Union{Nothing,Symbol}=nothing,
141141
call_abi::Union{Nothing,Symbol}=nothing,
142142
compiler_abi::CompilerABI=CompilerABI())
143-
if arch !== :x86_64
143+
if arch !== :x86_64 && arch !== :aarch64
144144
throw(ArgumentError("Unsupported architecture '$arch' for macOS"))
145145
end
146146
if libc !== nothing
@@ -404,7 +404,7 @@ function platform_key_abi(machine::AbstractString)
404404
arch_mapping = Dict(
405405
:x86_64 => "(x86_|amd)64",
406406
:i686 => "i\\d86",
407-
:aarch64 => "aarch64",
407+
:aarch64 => "(aarch|arm)64",
408408
:armv7l => "arm(v7l)?", # if we just see `arm-linux-gnueabihf`, we assume it's `armv7l`
409409
:armv6l => "armv6l",
410410
:powerpc64le => "p(ower)?pc64le",
@@ -458,6 +458,7 @@ function platform_key_abi(machine::AbstractString)
458458
))
459459

460460
m = match(triplet_regex, machine)
461+
msg = ""
461462
if m !== nothing
462463
# Helper function to find the single named field within the giant regex
463464
# that is not `nothing` for each mapping we give it.
@@ -502,11 +503,14 @@ function platform_key_abi(machine::AbstractString)
502503
cxxstring_abi=cxxstring_abi
503504
)
504505
return T(arch, libc=libc, call_abi=call_abi, compiler_abi=compiler_abi)
505-
catch
506+
catch err
507+
if isa(err, ArgumentError)
508+
msg = " ($(err.msg))"
509+
end
506510
end
507511
end
508512

509-
@warn("Platform `$(machine)` is not an officially supported platform")
513+
@warn("Platform `$(machine)` is not an officially supported platform$msg")
510514
return UnknownPlatform()
511515
end
512516

test/binaryplatforms.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ const platform = platform_key_abi()
133133
@test platform_key_abi("i686-unknown-freebsd11.1") == FreeBSD(:i686)
134134
@test platform_key_abi("amd64-unknown-freebsd12.0") == FreeBSD(:x86_64)
135135
@test platform_key_abi("i386-unknown-freebsd10.3") == FreeBSD(:i686)
136+
@test platform_key_abi("arm64-apple-darwin20.0") == MacOS(:aarch64)
136137

137138
# Test inclusion of ABI stuff, both old-style and new-style
138139
@test platform_key_abi("x86_64-linux-gnu-gcc7") == Linux(:x86_64, compiler_abi=CompilerABI(libgfortran_version=v"4"))

0 commit comments

Comments
 (0)