Skip to content

Commit 94b0852

Browse files
authored
[Runner] Make clang_use_lld a keyword argument (#357)
1 parent f07e738 commit 94b0852

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BinaryBuilderBase"
22
uuid = "7f725544-6523-48cd-82d1-3fa08ff4056e"
33
authors = ["Elliot Saba <staticfloat@gmail.com>"]
4-
version = "1.28.0"
4+
version = "1.29.0"
55

66
[deps]
77
Bzip2_jll = "6e34b625-4abd-537c-b88f-471c36dfa7a0"

src/Runner.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,14 @@ function runner_setup!(workspaces, mappings, workspace_root, verbose, kwargs, pl
13441344

13451345
clang = filter(s -> s.name == "LLVMBootstrap", shards)
13461346
clang_version = length(clang) == 1 ? only(clang).version : nothing
1347-
clang_use_lld = (!isnothing(gcc_version) && !isnothing(clang_version) && clang_version >= v"16" && gcc_version >= v"6")
1347+
clang_use_lld = let
1348+
kw = collect(extract_kwargs(kwargs, (:clang_use_lld,)))
1349+
# Default `clang_use_lld` to `true` if not specified.
1350+
value = isone(length(kw)) ? last(only(kw)) : true
1351+
# The user can ask for using `lld` as linker with Clang, but we can
1352+
# actually use it only under certain conditions.
1353+
value && (!isnothing(gcc_version) && !isnothing(clang_version) && clang_version >= v"16" && gcc_version >= v"6")
1354+
end
13481355
# Construct environment variables we'll use from here on out
13491356
platform::Platform = get_concrete_platform(platform; compilers..., extract_kwargs(kwargs, (:preferred_gcc_version,:preferred_llvm_version))...)
13501357
envs::Dict{String,String} = merge(platform_envs(platform, src_name; rust_version, verbose, compilers...), extra_env)

test/runners.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,20 @@ end
487487
seekstart(iobuff)
488488
@test occursin(r"lld", readchomp(iobuff))
489489
end
490+
491+
mktempdir() do dir
492+
platform = Platform("x86_64", "linux", libc="musl")
493+
ur = preferred_runner()(dir; platform, preferred_gcc_version=v"9", clang_use_lld=false)
494+
iobuff = IOBuffer()
495+
test_script = raw"""
496+
cat $(which clang)
497+
"""
498+
cmd = `/bin/bash -c "$(test_script)"`
499+
@test run(ur, cmd, iobuff)
500+
seekstart(iobuff)
501+
@test occursin("-fuse-ld=$(aatriplet(platform))", readchomp(iobuff))
502+
end
503+
490504
end
491505

492506

0 commit comments

Comments
 (0)