From 3cd406998f80ad277efb6bc9cf26dd7f846827c3 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Tue, 17 Jan 2023 22:12:42 +1100 Subject: [PATCH] Use `lld` as linker on all targets Signed-off-by: Jiahao XU --- justfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/justfile b/justfile index fb5ff992c..90c699ee7 100644 --- a/justfile +++ b/justfile @@ -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