cli: mirror Cargo's implicit strip default when manually stripping binaries (fixes wasm-opt SIGABRT) - #5736
Open
nicoburns wants to merge 2 commits into
Open
cli: mirror Cargo's implicit strip default when manually stripping binaries (fixes wasm-opt SIGABRT)#5736nicoburns wants to merge 2 commits into
nicoburns wants to merge 2 commits into
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #5119 (
wasm-opt failed with status code signal: 6 (SIGABRT)/compile unit size was incorrectondx build --web --release).Root cause: since #4966 (0.7.2), dx always builds with
--config profile.<x>.strip=false(to keep manganis symbols alive) and relies onpost_process_executable/get_strip_settingto strip manually afterwards. Butget_strip_settingonly honored an explicitstripkey in Cargo.toml and returnedStripSetting::Noneotherwise — it didn't replicate Cargo's implicit default (since Rust 1.77, Cargo strips debuginfo when the profile's debuginfo is disabled, asreleaseis by default). So ~1.3MB of DWARF from the precompiled std stayed in release wasm. wasm-bindgen (--keep-debug, on by default via--debug-symbols) then rewrites that DWARF, and binaryen's wasm-opt aborts trying to re-emit it (DWARFEmitter.cpp:201). In 0.7.1 the linker stripped the debuginfo (Cargo's default), which is why the same flags worked there.Change in
get_strip_setting, after resolving the profile'sinheritschain:Verification
strip=falsebuild →wasm-bindgen --keep-debug→wasm-opt --debuginforeproduces the exact SIGABRT; the same wasm without the wasm-bindgen rewrite, or with Cargo's default strip, passes.--release; with this patch the build succeeds and the output wasm contains no.debug_*sections (1.6MB → 471KB).wasm-splitbuilds are unaffected (post_process_executablestill returns early), as are dev builds (debugresolves to full → no strip).Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/819f3522f488427cb8df5f6e12b5af56
Requested by: @nicoburns