From 89df4fb08da35a65e9d5ea6e95b84af0fc2faa97 Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Tue, 15 Oct 2024 14:55:14 +0200 Subject: [PATCH] LLVM: Add unified LLD JLL, and add driver entrypoints. (#9615) --- .buildkite/utils.jl | 2 +- L/LLVM/Clang_unified/build_tarballs.jl | 6 +-- L/LLVM/LLD@14/build_tarballs.jl | 2 +- L/LLVM/LLD@15/build_tarballs.jl | 2 + L/LLVM/LLD@16/build_tarballs.jl | 2 + L/LLVM/LLD@17/build_tarballs.jl | 2 + L/LLVM/LLD@18/build_tarballs.jl | 3 +- L/LLVM/LLD@19/build_tarballs.jl | 3 +- L/LLVM/LLD_unified/build_tarballs.jl | 63 ++++++++++++++++++++++++++ L/LLVM/common.jl | 9 ++++ 10 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 L/LLVM/LLD_unified/build_tarballs.jl diff --git a/.buildkite/utils.jl b/.buildkite/utils.jl index 17af2894ba6..627626ec38b 100644 --- a/.buildkite/utils.jl +++ b/.buildkite/utils.jl @@ -125,7 +125,7 @@ function register_step(NAME, PROJECT, SKIP_BUILD) # parallelism during upload of the artifacts we exceed GitHub's API secondary rate # limits. Should that happen with more packages, we'll probably need to do this for # more/all packages. Ref: https://github.com/JuliaPackaging/BinaryBuilder.jl/pull/1334. - if NAME in ("Enzyme", "mlir_jl_tblgen", "LLVMExtra") + if NAME in ("Enzyme", "mlir_jl_tblgen", "LLVMExtra", "Clang_unified", "LLD_unified") register_env["BINARYBUILDER_GHR_CONCURRENCY"] = "4" end diff --git a/L/LLVM/Clang_unified/build_tarballs.jl b/L/LLVM/Clang_unified/build_tarballs.jl index 856f3fb7268..e9e749e9a9c 100644 --- a/L/LLVM/Clang_unified/build_tarballs.jl +++ b/L/LLVM/Clang_unified/build_tarballs.jl @@ -11,7 +11,9 @@ version = v"0.1" llvm_full_versions = [ v"15.0.7+10", v"16.0.6+4", - v"17.0.6+5" + v"17.0.6+5", + v"18.1.7+3", + v"19.1.1+0", ] augment_platform_block = """ @@ -59,5 +61,3 @@ for (i, build) in enumerate(builds) skip_audit=true, dont_dlopen=true, julia_compat="1.10", augment_platform_block) end - -# bump diff --git a/L/LLVM/LLD@14/build_tarballs.jl b/L/LLVM/LLD@14/build_tarballs.jl index ef20541f2a5..9cd6cd52ff6 100644 --- a/L/LLVM/LLD@14/build_tarballs.jl +++ b/L/LLVM/LLD@14/build_tarballs.jl @@ -38,4 +38,4 @@ for (i, build) in enumerate(builds) augment_platform_block) end -#let's build! +# bump diff --git a/L/LLVM/LLD@15/build_tarballs.jl b/L/LLVM/LLD@15/build_tarballs.jl index c87fca9bef4..8520349afe5 100644 --- a/L/LLVM/LLD@15/build_tarballs.jl +++ b/L/LLVM/LLD@15/build_tarballs.jl @@ -37,3 +37,5 @@ for (i, build) in enumerate(builds) skip_audit=true, julia_compat="1.9", augment_platform_block) end + +# bump diff --git a/L/LLVM/LLD@16/build_tarballs.jl b/L/LLVM/LLD@16/build_tarballs.jl index 16338f40158..ae9bce140e3 100644 --- a/L/LLVM/LLD@16/build_tarballs.jl +++ b/L/LLVM/LLD@16/build_tarballs.jl @@ -37,3 +37,5 @@ for (i, build) in enumerate(builds) skip_audit=true, julia_compat="1.11", augment_platform_block) end + +# bump diff --git a/L/LLVM/LLD@17/build_tarballs.jl b/L/LLVM/LLD@17/build_tarballs.jl index 11aa323b45e..4f569995b44 100644 --- a/L/LLVM/LLD@17/build_tarballs.jl +++ b/L/LLVM/LLD@17/build_tarballs.jl @@ -37,3 +37,5 @@ for (i, build) in enumerate(builds) skip_audit=true, julia_compat="1.11", augment_platform_block) end + +# bump diff --git a/L/LLVM/LLD@18/build_tarballs.jl b/L/LLVM/LLD@18/build_tarballs.jl index 8e5788d0bc4..f61d647ca25 100644 --- a/L/LLVM/LLD@18/build_tarballs.jl +++ b/L/LLVM/LLD@18/build_tarballs.jl @@ -37,4 +37,5 @@ for (i, build) in enumerate(builds) skip_audit=true, julia_compat="1.12", augment_platform_block) end -#! + +# bump diff --git a/L/LLVM/LLD@19/build_tarballs.jl b/L/LLVM/LLD@19/build_tarballs.jl index 89b4e714cef..a7142e90d71 100644 --- a/L/LLVM/LLD@19/build_tarballs.jl +++ b/L/LLVM/LLD@19/build_tarballs.jl @@ -37,4 +37,5 @@ for (i, build) in enumerate(builds) skip_audit=true, julia_compat="1.12", augment_platform_block) end -#! + +# bump diff --git a/L/LLVM/LLD_unified/build_tarballs.jl b/L/LLVM/LLD_unified/build_tarballs.jl new file mode 100644 index 00000000000..138373579d3 --- /dev/null +++ b/L/LLVM/LLD_unified/build_tarballs.jl @@ -0,0 +1,63 @@ +using BinaryBuilder, Pkg +using Base.BinaryPlatforms + +const YGGDRASIL_DIR = "../../.." +include(joinpath(YGGDRASIL_DIR, "fancy_toys.jl")) +include(joinpath(YGGDRASIL_DIR, "platforms", "llvm.jl")) +include("../common.jl") + +name = "LLD_unified" +version = v"0.1" +llvm_full_versions = [ + v"15.0.7+10", + v"16.0.6+4", + v"17.0.6+5", + v"18.1.7+3", + v"19.1.1+0", +] + +augment_platform_block = """ + using Base.BinaryPlatforms + + $(LLVM.augment) + + function augment_platform!(platform::Platform) + augment_llvm!(platform) + end""" + +# determine exactly which tarballs we should build +builds = [] +for llvm_assertions in (false, true), llvm_full_version in llvm_full_versions + llvm_full_version >= v"15" || continue + libllvm_version = llvm_full_version + _, _, sources, script, platforms, products, dependencies = + configure_extraction(ARGS, llvm_full_version, "LLD", libllvm_version; + assert=llvm_assertions, augmentation=true, + dont_dlopen=false) + # ignore the output version, as we want a unified JLL + dependencies = map(dependencies) do dep + # ignore the version of any LLVM dependency, as we'll automatically load + # an appropriate version of LLD via platform augmentations + # TODO: make this an argument to `configure_extraction`? + if isa(dep, Dependency) && contains(dep.pkg.name, "LLVM") + Dependency(dep.pkg.name; dep.platforms) + else + dep + end + end + push!(builds, [name, version, sources, script, platforms, products, dependencies]) +end + +# don't allow `build_tarballs` to override platform selection based on ARGS. +# we handle that ourselves by calling `should_build_platform` +non_platform_ARGS = filter(arg -> startswith(arg, "--"), ARGS) + +# `--register` should only be passed to the latest `build_tarballs` invocation +non_reg_ARGS = filter(arg -> arg != "--register", non_platform_ARGS) + +for (i, build) in enumerate(builds) + build_tarballs(i == lastindex(builds) ? non_platform_ARGS : non_reg_ARGS, + build...; + skip_audit=true, dont_dlopen=true, julia_compat="1.10", + augment_platform_block) +end diff --git a/L/LLVM/common.jl b/L/LLVM/common.jl index 2513bd1abde..720a3f71b64 100644 --- a/L/LLVM/common.jl +++ b/L/LLVM/common.jl @@ -728,6 +728,11 @@ function configure_extraction(ARGS, LLVM_full_version, name, libLLVM_version=not script = lldscript products = [ ExecutableProduct("lld", :lld, "tools"), + ExecutableProduct("ld.lld", :ld_lld, "tools"), # Unix + ExecutableProduct("ld64.lld", :ld64_lld, "tools"), # macOS + ExecutableProduct("lld-link", :lld_link, "tools"), # Windows + ExecutableProduct("wasm-ld", :wasm_ld, "tools"), # WebAssembly + ExecutableProduct("dsymutil", :dsymutil, "tools"), ] @@ -756,6 +761,10 @@ function configure_extraction(ARGS, LLVM_full_version, name, libLLVM_version=not # We don't build LLVM 15 for i686-linux-musl. filter!(p -> !(arch(p) == "i686" && libc(p) == "musl"), platforms) end + if version < v"18" + # We only have LLVM builds for AArch64 BSD starting from LLVM 18 + filter!(p -> !(Sys.isfreebsd(p) && arch(p) == "aarch64"), platforms) + end platforms = expand_cxxstring_abis(platforms) if augmentation