Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improved strip config handling #22

Merged
merged 6 commits into from
Apr 7, 2024
Merged

feat: Improved strip config handling #22

merged 6 commits into from
Apr 7, 2024

Conversation

nikarh
Copy link
Member

@nikarh nikarh commented Apr 4, 2024

Usually in rust you can set strip=true or strip="symbols" in your Cargo.toml. This doesn't work for Vita, since it strips the relocation information from the elf, which causes vita-elf-create to fail.

Previously we had an additional vita-specific strip step configurable via Cargo.toml.

This PR changes the behavior in the following way:

  1. Before calling cargo build it now does an additional cargo build ... -Z unstable-options --unit-graph. This unstable option does a dry-run of the build emitting a JSON with a graph. This JSON is parsed to check if symbol stripping was enabled, and if the build failed AND we stripping was detected, cargo-vita now emits a sensible warning, improving the devx. Since this cargo feature is unstable (for 4 years already), if it fails, the output is ignored and does NOT fail the build.
  2. The additional stripping pass is now configurable separately for dev and release builds, being enabled for release builds by default. This pass always uses --strip-unneeded which does not break vita-elf-create and still yields smaller binaries.
  3. Updated the readme to reflect these changes

@nikarh nikarh requested a review from pheki April 4, 2024 15:34
Copy link
Member

@pheki pheki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty impressed by the lengths you go to improve our DX!

README.md Show resolved Hide resolved
src/meta.rs Outdated Show resolved Hide resolved
@nikarh nikarh changed the title feat: Improved elf stripping feat: Improved elf strip handling Apr 5, 2024
@nikarh nikarh changed the title feat: Improved elf strip handling feat: Improved strip config handling Apr 5, 2024
@nikarh nikarh merged commit 944718a into main Apr 7, 2024
6 checks passed
@nikarh nikarh deleted the strip-v2 branch April 7, 2024 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants