From 73fd702bb7cabdff156eaf4ef8db5b92b098583e Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 13 Jul 2021 15:53:17 -0500 Subject: [PATCH] Don't assume all custom sections are dwarf info (#3083) This incorrectly assumed that we had unparsed dwarf information, regardless of custom section name. This commit updates the logic to calculate that by first checking the section name before we set the flag indicating that there's unparsed debuginfo. --- crates/environ/src/module_environ.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/environ/src/module_environ.rs b/crates/environ/src/module_environ.rs index 17f92cdd7e..2fc012b675 100644 --- a/crates/environ/src/module_environ.rs +++ b/crates/environ/src/module_environ.rs @@ -191,12 +191,11 @@ impl<'data> ModuleEnvironment<'data> { } fn register_dwarf_section(&mut self, name: &str, data: &'data [u8]) { - if !self.tunables.generate_native_debuginfo && !self.tunables.parse_wasm_debuginfo { - self.result.has_unparsed_debuginfo = true; + if !name.starts_with(".debug_") { return; } - - if !name.starts_with(".debug_") { + if !self.tunables.generate_native_debuginfo && !self.tunables.parse_wasm_debuginfo { + self.result.has_unparsed_debuginfo = true; return; } let info = &mut self.result.debuginfo;