Fix incorrect LLD used when bundling (#65183)

Follow-up to https://github.com/zed-industries/zed/pull/65169
Fixes
https://github.com/zed-industries/zed/actions/runs/37313460920/job/111774290269#logs

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov
2026-10-05 15:03:19 +00:00
committed by GitHub
parent a6169ca969
commit 204362325c
5 changed files with 14 additions and 3 deletions
+7 -3
View File
@@ -114,15 +114,19 @@ if "$rustup_installed"; then
fi
export CC=${CC:-$(which clang)}
lld=$("$CC" -print-prog-name=ld.lld)
lld=${LLD:-$("$CC" -print-prog-name=ld.lld)}
if [[ "$lld" != /* || ! -x "$lld" ]]; then
echo "Bundling requires an absolute executable linker path; set LLD (e.g. LLD=/usr/bin/ld.lld-18)." >&2
exit 1
fi
lld_version=$("$lld" --version)
if [[ ! "$lld_version" =~ LLD\ ([0-9]+)\. ]] || (( BASH_REMATCH[1] < 12 )); then
echo "Bundling requires LLD 12 or newer for safe ICF; select a matching compiler with CC (e.g. CC=clang-18)." >&2
echo "Bundling requires LLD 12 or newer for safe ICF; set LLD to a supported linker (e.g. LLD=/usr/bin/ld.lld-18)." >&2
exit 1
fi
# Build binary in release mode
cargo --config .cargo/bundle-config.toml rustc --release --target "${target_triple}" --package zed --bin zed -- -C linker="$CC" -C llvm-args=-addrsig -C link-arg=-fuse-ld=lld -C link-arg=-Wl,--icf=safe
cargo --config .cargo/bundle-config.toml rustc --release --target "${target_triple}" --package zed --bin zed -- -C linker="$CC" -C llvm-args=-addrsig -C link-arg=-fuse-ld=lld -C link-arg=--ld-path="$lld" -C link-arg=-Wl,--icf=safe
cargo --config .cargo/bundle-config.toml build --release --target "${target_triple}" --package cli
# Build remote_server in separate invocation to prevent feature unification from other crates
# from influencing dynamic libraries required by it.