Strip local symbols from macOS and Linux release bundles (#63429)

Not sure if this PR is 100% good, since it removes symbols from local
traces, leaving addresses only — but this what Windows seem to do
already, and we have those symbols on Sentry to restore from, which were
needed to normally read Linux perf traces already (see `perf.zip` in
https://github.com/zed-industries/zed/issues/59689#issuecomment-5452720248)

On the upside, uncompressed binaries' are now ~100MB less, which is a
lot — hence decided to open the PR for the review

-------------------

Strips debug info and local symbols from shipped macOS and Linux
binaries, matching what Windows already does with PDBs: `bundle-mac` now
always runs `dsymutil` before a new `strip -x` step, and `bundle-linux`
adds `--discard-all` plus `zed.dbg`/`remote_server.dbg` extraction via
`--only-keep-debug`.

Sentry uploads are unchanged and precede stripping.

The macOS binary UUID and the GNU build id survive stripping, so
user-provided traces stay recoverable without rebuilding at the
reporter's commit: `sample` output resolves via `atos` against the
archived `zed.dwarf`, and `perf.data` via `perf buildid-cache` against
the Sentry-archived binary.

zed binary:
macOS (2026-08-29 nightly): 420478976 -> 316503984 bytes (-24.7%,
-104.0MB)
Linux (v1.17.2 aarch64): 439417448 -> 336967256 bytes (-23.3%, -102.5MB)
Downloads shrink far less, symbols compress ~7:1: the macOS DMG loses
only ~15MB.

Release Notes:

- Improved installed size on macOS and Linux by stripping debug symbols
from release binaries (roughly -25%)
This commit is contained in:
Kirill Bulatov authored and GitHub committed 2026-09-02 19:38:12 +00:00
1 parent 8b32975a05
commit 9be65a8dfe
4 files changed
+80 -20

No files matched your search

+9 -4
View File
@@ -121,12 +121,17 @@ else
fi
fi
# Strip debug symbols and save them for upload to DigitalOcean.
# Split debug symbols into local .dbg files, then strip debug info and local
# symbols from the shipped binaries. Sentry receives the full unstripped
# binaries above; the .dbg files keep symbols recoverable when that upload
# is skipped.
# We use llvm-objcopy because GNU objcopy on older distros (e.g. Ubuntu 20.04)
# doesn't understand CREL sections produced by newer LLVM.
llvm-objcopy --strip-debug "${target_dir}/${target_triple}/release/zed"
llvm-objcopy --strip-debug "${target_dir}/${target_triple}/release/cli"
llvm-objcopy --strip-debug "${target_dir}/${remote_server_triple}/release/remote_server"
llvm-objcopy --only-keep-debug "${target_dir}/${target_triple}/release/zed" "${target_dir}/${target_triple}/release/zed.dbg"
llvm-objcopy --only-keep-debug "${target_dir}/${remote_server_triple}/release/remote_server" "${target_dir}/${remote_server_triple}/release/remote_server.dbg"
llvm-objcopy --strip-debug --discard-all "${target_dir}/${target_triple}/release/zed"
llvm-objcopy --strip-debug --discard-all "${target_dir}/${target_triple}/release/cli"
llvm-objcopy --strip-debug --discard-all "${target_dir}/${remote_server_triple}/release/remote_server"
# Ensure that remote_server does not depend on libssl nor libcrypto, as we got rid of these deps.
if ldd "${target_dir}/${remote_server_triple}/release/remote_server" | grep -q 'libcrypto\|libssl'; then