Skip to content

Commit bba0066

Browse files
committed
More riscv64 support
1 parent 9973159 commit bba0066

File tree

2 files changed

+7
-116
lines changed

2 files changed

+7
-116
lines changed

src/Rootfs.jl

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,6 @@ function gcc_version(p::AbstractPlatform,
435435
GCC_builds::Vector{GCCBuild},
436436
compilers::Vector{Symbol}=[:c];
437437
llvm_version::Union{Nothing,VersionNumber}=nothing)
438-
@show gcc_version p GCC_builds compilers llvm_version
439438
# First, filter by libgfortran version.
440439
if libgfortran_version(p) !== nothing
441440
GCC_builds = filter(b -> getabi(b).libgfortran_version == libgfortran_version(p), GCC_builds)
@@ -602,17 +601,13 @@ function choose_shards(p::AbstractPlatform;
602601
version = v"12.1.0"
603602
end
604603

605-
@show find_shard
606-
@show name version archive_type target
607604
for cs in all_compiler_shards()
608-
@show cs.name cs.version cs.archive_type cs.target
609605
if cs.name == name && cs.version == version &&
610606
(target === nothing || platforms_match(cs.target, target)) &&
611607
cs.archive_type == archive_type
612608
return cs
613609
end
614610
end
615-
@show :notfound
616611
return nothing
617612
end
618613

@@ -639,7 +634,6 @@ function choose_shards(p::AbstractPlatform;
639634

640635
shards = CompilerShard[]
641636
if isempty(bootstrap_list)
642-
@show choose_shards compilers, GCC_builds, LLVM_builds, preferred_gcc_version, preferred_llvm_version
643637
# Select GCC and LLVM versions given the compiler ABI and target requirements given in `p`
644638
GCC_build, LLVM_build = select_compiler_versions(p,
645639
compilers,
@@ -650,16 +644,17 @@ function choose_shards(p::AbstractPlatform;
650644
)
651645

652646
# We _always_ need Rootfs and PlatformSupport for our target, at least
647+
# TODO: Remove this again
653648
ps_build_new = arch(p) == "riscv64" ? v"2024.12.21" : ps_build
654649
append!(shards, [
655-
(@show find_shard("Rootfs", rootfs_build, archive_type)),
656-
(@show find_shard("PlatformSupport", ps_build_new, archive_type; target=p))
650+
find_shard("Rootfs", rootfs_build, archive_type),
651+
find_shard("PlatformSupport", ps_build_new, archive_type; target=p)
657652
])
658653

659654
if :c in compilers
660655
append!(shards, [
661-
(@show find_shard("GCCBootstrap", GCC_build, archive_type; target=p)),
662-
(@show find_shard("LLVMBootstrap", LLVM_build, archive_type)),
656+
find_shard("GCCBootstrap", GCC_build, archive_type; target=p),
657+
find_shard("LLVMBootstrap", LLVM_build, archive_type),
663658
])
664659
end
665660

@@ -680,8 +675,8 @@ function choose_shards(p::AbstractPlatform;
680675
# This is necessary for both rust and c compilers
681676
if !platforms_match(p, default_host_platform)
682677
append!(shards, [
683-
(@show find_shard("PlatformSupport", ps_build, archive_type; target=default_host_platform)),
684-
(@show find_shard("GCCBootstrap", GCC_build, archive_type; target=default_host_platform)),
678+
find_shard("PlatformSupport", ps_build, archive_type; target=default_host_platform),
679+
find_shard("GCCBootstrap", GCC_build, archive_type; target=default_host_platform),
685680
])
686681
end
687682
end

src/riscv64.jl

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -85,108 +85,4 @@ function Base.BinaryPlatforms.validate_tags(tags::Dict)
8585
end
8686
end
8787

88-
#TODO using .BinaryPlatforms: arch_mapping, os_mapping, libc_mapping, call_abi_mapping,
89-
#TODO libgfortran_version_mapping, cxxstring_abi_mapping, libstdcxx_version_mapping
90-
#TODO
91-
#TODO function Base.parse(::Type{Platform}, triplet::AbstractString; validate_strict::Bool = false)
92-
#TODO # Re-insert the architecture because the global assignments above don't stick
93-
#TODO CPUID.ISAs_by_family["riscv64"] = [
94-
#TODO # We have no way to test riscv64 features yet, so we're only going to declare the lowest ISA:
95-
#TODO "riscv64" => CPUID.ISA(Set{UInt32}()),
96-
#TODO ]
97-
#TODO BinaryPlatforms.arch_mapping["riscv64"] = "(rv64|riscv64)"
98-
#TODO BinaryPlatforms.arch_march_isa_mapping["riscv64"] = ["riscv64" => get_set("riscv64", "riscv64")]
99-
#TODO
100-
#TODO # Helper function to collapse dictionary of mappings down into a regex of
101-
#TODO # named capture groups joined by "|" operators
102-
#TODO c(mapping) = string("(",join(["(?<$k>$v)" for (k, v) in mapping], "|"), ")")
103-
#TODO
104-
#TODO # We're going to build a mondo regex here to parse everything:
105-
#TODO triplet_regex = Regex(string(
106-
#TODO "^",
107-
#TODO # First, the core triplet; arch/os/libc/call_abi
108-
#TODO c(arch_mapping),
109-
#TODO c(os_mapping),
110-
#TODO c(libc_mapping),
111-
#TODO c(call_abi_mapping),
112-
#TODO # Next, optional things, like libgfortran/libstdcxx/cxxstring abi
113-
#TODO c(libgfortran_version_mapping),
114-
#TODO c(cxxstring_abi_mapping),
115-
#TODO c(libstdcxx_version_mapping),
116-
#TODO # Finally, the catch-all for extended tags
117-
#TODO "(?<tags>(?:-[^-]+\\+[^-]+)*)?",
118-
#TODO "\$",
119-
#TODO ))
120-
#TODO
121-
#TODO m = match(triplet_regex, triplet)
122-
#TODO if m !== nothing
123-
#TODO # Helper function to find the single named field within the giant regex
124-
#TODO # that is not `nothing` for each mapping we give it.
125-
#TODO get_field(m, mapping) = begin
126-
#TODO for k in keys(mapping)
127-
#TODO if m[k] !== nothing
128-
#TODO # Convert our sentinel `nothing` values to actual `nothing`
129-
#TODO if endswith(k, "_nothing")
130-
#TODO return nothing
131-
#TODO end
132-
#TODO # Convert libgfortran/libstdcxx version numbers
133-
#TODO if startswith(k, "libgfortran")
134-
#TODO return VersionNumber(parse(Int,k[12:end]))
135-
#TODO elseif startswith(k, "libstdcxx")
136-
#TODO return VersionNumber(3, 4, parse(Int,m[k][11:end]))
137-
#TODO else
138-
#TODO return k
139-
#TODO end
140-
#TODO end
141-
#TODO end
142-
#TODO end
143-
#TODO
144-
#TODO # Extract the information we're interested in:
145-
#TODO arch = get_field(m, arch_mapping)
146-
#TODO os = get_field(m, os_mapping)
147-
#TODO libc = get_field(m, libc_mapping)
148-
#TODO call_abi = get_field(m, call_abi_mapping)
149-
#TODO libgfortran_version = get_field(m, libgfortran_version_mapping)
150-
#TODO libstdcxx_version = get_field(m, libstdcxx_version_mapping)
151-
#TODO cxxstring_abi = get_field(m, cxxstring_abi_mapping)
152-
#TODO function split_tags(tagstr)
153-
#TODO tag_fields = filter(!isempty, split(tagstr, "-"))
154-
#TODO if isempty(tag_fields)
155-
#TODO return Pair{String,String}[]
156-
#TODO end
157-
#TODO return map(v -> Symbol(v[1]) => v[2], split.(tag_fields, "+"))
158-
#TODO end
159-
#TODO tags = split_tags(m["tags"])
160-
#TODO
161-
#TODO # Special parsing of os version number, if any exists
162-
#TODO function extract_os_version(os_name, pattern)
163-
#TODO m_osvn = match(pattern, m[os_name])
164-
#TODO if m_osvn !== nothing
165-
#TODO return VersionNumber(m_osvn.captures[1])
166-
#TODO end
167-
#TODO return nothing
168-
#TODO end
169-
#TODO os_version = nothing
170-
#TODO if os == "macos"
171-
#TODO os_version = extract_os_version("macos", r".*darwin([\d\.]+)")
172-
#TODO end
173-
#TODO if os == "freebsd"
174-
#TODO os_version = extract_os_version("freebsd", r".*freebsd([\d.]+)")
175-
#TODO end
176-
#TODO
177-
#TODO return Platform(
178-
#TODO arch, os;
179-
#TODO validate_strict,
180-
#TODO libc,
181-
#TODO call_abi,
182-
#TODO libgfortran_version,
183-
#TODO cxxstring_abi,
184-
#TODO libstdcxx_version,
185-
#TODO os_version,
186-
#TODO tags...,
187-
#TODO )
188-
#TODO end
189-
#TODO throw(ArgumentError("Platform `$(triplet)` is not an officially supported platform"))
190-
#TODO end
191-
19288
end

0 commit comments

Comments
 (0)