mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 05:28:42 +00:00
Enable icf=safe & use rust-lld for targets other than win (#805)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
89b920a876
commit
9c6ab5991e
1 changed files with 15 additions and 3 deletions
18
justfile
18
justfile
|
@ -79,12 +79,24 @@ win-arm64-ring16 := if target == "aarch64-pc-windows-msvc" { " --config='patch.c
|
|||
# MIR optimisation level (defaults to 2, bring it up to 4 for release builds)
|
||||
rustc-miropt := if for-release != "" { " -Z mir-opt-level=4" } else { "" }
|
||||
|
||||
# Use rust-lld that is bundled with rustup to speedup linking
|
||||
# and support for icf=safe.
|
||||
#
|
||||
# -Zgcc-ld=lld uses the rust-lld that is bundled with rustup.
|
||||
#
|
||||
# TODO: There is ongoing effort to stabilise this and we will need to update
|
||||
# this once it is merged.
|
||||
# https://github.com/rust-lang/compiler-team/issues/510
|
||||
rust-lld := if target-os != "windows" { " -Z gcc-ld=lld" } else { "" }
|
||||
|
||||
# ICF: link-time identical code folding
|
||||
# disabled for now, as it requires the gold linker
|
||||
rustc-icf := "" #if for-release != "" { " -C link-arg=-Wl,--icf=all" } else { "" }
|
||||
#
|
||||
# On windows it works out of the box and on other targets it uses
|
||||
# rust-lld.
|
||||
rustc-icf := if for-release != "" { " -C link-arg=-Wl,--icf=safe" } else { "" }
|
||||
|
||||
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) + (rust-lld) + (rustc-icf)
|
||||
|
||||
|
||||
# libblocksruntime-dev provides compiler-rt
|
||||
|
|
Loading…
Add table
Reference in a new issue