From a45e6fcdfc69d87467548b268579cbb5bda5a89d Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Tue, 1 Sep 2020 18:14:49 -0400 Subject: [PATCH] Allow sparse GCC version support per architecture Right now we assume that every GCC version is available for every architecture. E.g. we always try to use the GCC 4.8 for auditing. For Darwin Aarch64, we won't have any GCC shard smaller than 11. We do already support falling back to the closest available version if the preferred version is not supported. This simply extends that check to only include compiler shards that we actually have artifacts for. --- src/Rootfs.jl | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Rootfs.jl b/src/Rootfs.jl index df02f387..207d0092 100644 --- a/src/Rootfs.jl +++ b/src/Rootfs.jl @@ -476,11 +476,19 @@ function choose_shards(p::Platform; preferred_llvm_version::VersionNumber = getversion(LLVM_builds[end]), ) - GCC_build = select_gcc_version(p, GCC_builds, preferred_gcc_version) - LLVM_build = select_closest_version(preferred_llvm_version, getversion.(LLVM_builds)) # Our host platform is x86_64-linux-musl host_platform = Linux(:x86_64; libc=:musl) + make_gcc_shard(GCC_build, target) = CompilerShard("GCCBootstrap", GCC_build, host_platform, archive_type; target=target) + + this_platform_GCC_builds = filter(GCC_builds) do GCC_build + make_gcc_shard(getversion(GCC_build), p) in all_compiler_shards() && + make_gcc_shard(getversion(GCC_build), host_platform) in all_compiler_shards() + end + + GCC_build = select_gcc_version(p, this_platform_GCC_builds, preferred_gcc_version) + LLVM_build = select_closest_version(preferred_llvm_version, getversion.(LLVM_builds)) + shards = CompilerShard[] if isempty(bootstrap_list) append!(shards, [ @@ -492,14 +500,14 @@ function choose_shards(p::Platform; platform_match(a, b) = ((typeof(a) <: typeof(b)) && (arch(a) == arch(b)) && (libc(a) == libc(b))) if :c in compilers append!(shards, [ - CompilerShard("GCCBootstrap", GCC_build, host_platform, archive_type; target=p), + make_gcc_shard(GCC_build, p), CompilerShard("LLVMBootstrap", LLVM_build, host_platform, archive_type), ]) # If we're not building for the host platform, then add host shard for host tools if !platform_match(p, host_platform) append!(shards, [ CompilerShard("PlatformSupport", ps_build, host_platform, archive_type; target=host_platform), - CompilerShard("GCCBootstrap", GCC_build, host_platform, archive_type; target=host_platform), + make_gcc_shard(GCC_build, host_platform) ]) end end @@ -517,7 +525,7 @@ function choose_shards(p::Platform; # We have to add these as well for access to linkers and whatnot for Rust. Sigh. push!(shards, CompilerShard("PlatformSupport", ps_build, host_platform, archive_type; target=Rust_host)) - push!(shards, CompilerShard("GCCBootstrap", GCC_build, host_platform, archive_type; target=Rust_host)) + push!(shards, make_gcc_shard(GCC_build, Rust_host)) end if !platform_match(p, host_platform) push!(shards, CompilerShard("RustToolchain", Rust_build, Rust_host, archive_type; target=host_platform)) @@ -532,6 +540,7 @@ function choose_shards(p::Platform; versions = [cs.version for cs in all_compiler_shards() if cs.name == name && cs.archive_type == archive_type && (something(cs.target, p) == p) ] + isempty(versions) && error("No latest shard found for $name") return maximum(versions) end