Skip to content

Commit 8af5c33

Browse files
authored
feat: Added option to skip stripping elf (#20)
Even though in most cases stripping should be enabled since a hello world binary with std with debug symbols yields a ~13mb elf for Vita, debugging isolated problems could benefit from dwarf symbols. This PR adds a flag readable from `Cargo.toml` which can toggle stripping on and off (with on by default)
1 parent f3a4db4 commit 8af5c33

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ title_name = "My application"
7474
assets = "static"
7575
# Optional, this is the default
7676
build_std = "std,panic_unwind"
77+
# Optional, true by default. Will strip debug symbols from the resulting elf when enabled.
78+
strip = true
7779
# Optional, this is the default
7880
vita_strip_flags = ["-g"]
7981
# Optional, this is the default

src/commands/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ impl<'a> BuildContext<'a> {
280280
}
281281

282282
fn strip(&self, art: &ExecutableArtifact) -> anyhow::Result<()> {
283+
if !art.meta.strip {
284+
info!("{}", "Skipping elf strip".yellow());
285+
return Ok(());
286+
}
287+
283288
let mut command = Command::new(self.sdk_binary("arm-vita-eabi-strip"));
284289

285290
command

src/meta.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ impl FromStr for TitleId {
5858
}
5959
}
6060

61+
fn default_strip() -> bool {
62+
true
63+
}
64+
6165
fn default_build_std() -> String {
6266
"std,panic_unwind".to_string()
6367
}
@@ -81,6 +85,8 @@ pub struct PackageMetadata {
8185
pub assets: Option<String>,
8286
#[serde(default = "default_build_std")]
8387
pub build_std: String,
88+
#[serde(default = "default_strip")]
89+
pub strip: bool,
8490
#[serde(default = "default_vita_strip_flags")]
8591
pub vita_strip_flags: Vec<String>,
8692
#[serde(default = "default_vita_make_fself_flags")]
@@ -96,6 +102,7 @@ impl Default for PackageMetadata {
96102
title_name: None,
97103
assets: None,
98104
build_std: default_build_std(),
105+
strip: default_strip(),
99106
vita_strip_flags: default_vita_strip_flags(),
100107
vita_make_fself_flags: default_vita_make_fself_flags(),
101108
vita_mksfoex_flags: default_vita_mksfoex_flags(),

0 commit comments

Comments
 (0)