Skip to content

Commit

Permalink
LLVM: Add unified LLD JLL, and add driver entrypoints. (JuliaPackagin…
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt authored and avik-pal committed Oct 25, 2024
1 parent d7ab528 commit 89df4fb
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .buildkite/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions L/LLVM/Clang_unified/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion L/LLVM/LLD@14/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ for (i, build) in enumerate(builds)
augment_platform_block)
end

#let's build!
# bump
2 changes: 2 additions & 0 deletions L/LLVM/LLD@15/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ for (i, build) in enumerate(builds)
skip_audit=true, julia_compat="1.9",
augment_platform_block)
end

# bump
2 changes: 2 additions & 0 deletions L/LLVM/LLD@16/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ for (i, build) in enumerate(builds)
skip_audit=true, julia_compat="1.11",
augment_platform_block)
end

# bump
2 changes: 2 additions & 0 deletions L/LLVM/LLD@17/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ for (i, build) in enumerate(builds)
skip_audit=true, julia_compat="1.11",
augment_platform_block)
end

# bump
3 changes: 2 additions & 1 deletion L/LLVM/LLD@18/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ for (i, build) in enumerate(builds)
skip_audit=true, julia_compat="1.12",
augment_platform_block)
end
#!

# bump
3 changes: 2 additions & 1 deletion L/LLVM/LLD@19/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ for (i, build) in enumerate(builds)
skip_audit=true, julia_compat="1.12",
augment_platform_block)
end
#!

# bump
63 changes: 63 additions & 0 deletions L/LLVM/LLD_unified/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions L/LLVM/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
]

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 89df4fb

Please sign in to comment.