build: refactor Linux binary stripping to align with upstream #47932
+245
−263
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
We occasionally see a transient issue in our published Linux releases where the
electron
binary gets relinked after we've stripped it when we rune build --target electron:electron_dist_zip
due to inconsistent timestamps on an input file. The binary stripping being out-of-band with the rest of these steps means we're always going to be at risk of that target causing a relink of the binary.Upstream Chromium has their own GN actions for doing stripping for their Linux releases. They do all of the same steps we currently do in CI (copy debug symbols, strip binary, add debug link), with the one exception that we pass
--compress-debug-sections
toobjcopy
when copying the debug symbols. To retain that step that required me copy-paste-modifyingbuild/linux/strip_binary.{gni,py}
from upstream Chromium. I can try to upstream the extra option since it's a minimal change, and if they accept it then we can drop these files and directly use upstream's.Chromium's
strip_binary
action outputs the stripped binaries to separate files (defaults to<name>.stripped
, which I've used in this PR), so this required some changes to thebuild/zip.py
script to take the stripped version of the file when it is present. Using upstream'sstrip_binary
also required setting the GN argenable_linux_installer = false
so that upstream's strip actions aren't pulled into the GN build, otherwise we get a GN error about target collision having the same output file (since we're stripping the same files as upstream, but we want our own target for them because we need to output the debug symbols to thedebug/
directory, in addition to setting the compress option to true).One benefit of aligning with upstream here is that we'll be using
llvm-strip
andllvm-objcopy
from the Chromium toolchain, so we'll achieve greater consistency there, and currently we skip copying debug symbols on Linux ARM/ARM64 with a note aboutobjcopy
not being available - that should work now, I bellieve.Things still to test:
mksnapshot
stuff works on Linux ARMChecklist
Release Notes
Notes: none