Skip to content

Commit

Permalink
Use lld as linker on all targets
Browse files Browse the repository at this point in the history
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
  • Loading branch information
NobodyXu committed Jan 17, 2023
1 parent 663bf52 commit 3cd4069
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,14 @@ rustc-miropt := if for-release != "" { " -Z mir-opt-level=4" } else { "" }
# it requires the gold linker
rustc-icf := if for-release != "" { if target-os == "windows" { " -C link-arg=-Wl,--icf=safe" } else { "" } } else { "" }

# lld is the fastest linker for lto build and only mold is faster than lld
# for non-lto builds.
#
# It also supports --icf=safe.
linker := " -C link-arg=-fuse-ld=lld"

cargo-build-args := (if for-release != "" { " --release" } else { "" }) + (if target != target-host { " --target " + target } else if cargo-buildstd != "" { " --target " + target } else { "" }) + (cargo-buildstd) + (if extra-build-args != "" { " " + extra-build-args } else { "" }) + (cargo-no-default-features) + (cargo-split-debuginfo) + (if cargo-features != "" { " --features " + cargo-features } else { "" }) + (win-arm64-ring16)
export RUSTFLAGS := (rustc-gcclibs) + (rustc-miropt) + (rustc-icf)
export RUSTFLAGS := (rustc-gcclibs) + (rustc-miropt) + (linker) + (rustc-icf)


# libblocksruntime-dev provides compiler-rt
Expand Down

0 comments on commit 3cd4069

Please sign in to comment.