From 8bde2ed27add5d2d387211944591fabe6f89359c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 17 Nov 2026 16:48:35 -0700 Subject: [PATCH] Hook up `debug_names` to `--strip-all` Look for the corresponding LLD option and hook it up to `debug_names` when creating a component to respect the original settings. This'll end up inserting more debug names by default when the option isn't specified, but that matches core wasm behavior as well. --- src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 7e1c5b7..dcd9005 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -702,6 +702,7 @@ impl App { let mut encoder = wit_component::ComponentEncoder::default(); encoder + .debug_names(!self.strip_all()) .reject_legacy_names(self.component.reject_legacy_names) .realloc_via_memory_grow(self.component.realloc_via_memory_grow) .shim_return_call_ref(self.component.return_call_ref); @@ -748,6 +749,13 @@ impl App { Ok(()) } + /// Returns whether `-s` or `--strip-all` was passed to `wasm-ld`. + fn strip_all(&self) -> bool { + self.lld_args + .iter() + .any(|s| s == "-s" || s == "--strip-all" || s == "-strip-all") + } + fn skip_wit_component(&self) -> bool { self.component.skip_wit_component // Skip componentization with `--shared` since that's creating a