From e3f82794f44384e1269769c8320474d355149fca Mon Sep 17 00:00:00 2001 From: vishruth-thimmaiah Date: Wed, 8 Apr 2026 03:38:42 +0530 Subject: [PATCH 1/2] fix: support symbols referring to debug sections --- libwild/src/elf.rs | 4 +++- libwild/src/elf_writer.rs | 6 ++++++ wild/tests/external_tests/mold_skip_tests.toml | 1 - 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libwild/src/elf.rs b/libwild/src/elf.rs index 864d6ffc6..ffa8574db 100644 --- a/libwild/src/elf.rs +++ b/libwild/src/elf.rs @@ -1889,7 +1889,9 @@ impl platform::Platform for Elf { } _ => {} } - + if let Some(_) = section_name.strip_prefix(b".debug_") { + return SectionRuleOutcome::Debug; + } SectionRuleOutcome::Custom } diff --git a/libwild/src/elf_writer.rs b/libwild/src/elf_writer.rs index f2e3550cd..681faaad4 100644 --- a/libwild/src/elf_writer.rs +++ b/libwild/src/elf_writer.rs @@ -1526,6 +1526,7 @@ fn build_sym_index_map(layout: &ElfLayout<'_>) -> Vec> { SectionSlot::Loaded(sec) => Some(sec.output_section_id()), SectionSlot::MergeStrings(sec) => Some(sec.part_id.output_section_id()), SectionSlot::FrameData(..) => Some(crate::output_section_id::EH_FRAME), + SectionSlot::LoadedDebugInfo(sec) => Some(sec.output_section_id()), _ => None, } { @@ -1958,6 +1959,7 @@ fn write_symbols<'data>( SectionSlot::Loaded(section) => section.output_section_id(), SectionSlot::MergeStrings(section) => section.part_id.output_section_id(), SectionSlot::FrameData(..) => output_section_id::EH_FRAME, + SectionSlot::LoadedDebugInfo(section) => section.output_section_id(), _ => bail!( "Tried to copy a symbol in a section we didn't load. {}", layout.symbol_debug(symbol_id) @@ -4027,6 +4029,10 @@ fn get_symbol_attributes(layout: &ElfLayout, symbol_id: SymbolId) -> Result<(u32 SectionSlot::MergeStrings(section) => { Some(section.part_id.output_section_id()) } + SectionSlot::LoadedDebugInfo(section) => { + Some(section.output_section_id()) + } + _ => None, }) .and_then(|output_section_id| { diff --git a/wild/tests/external_tests/mold_skip_tests.toml b/wild/tests/external_tests/mold_skip_tests.toml index 058a8acd2..600d7e0d6 100644 --- a/wild/tests/external_tests/mold_skip_tests.toml +++ b/wild/tests/external_tests/mold_skip_tests.toml @@ -27,7 +27,6 @@ tests = [ "oformat-binary.sh", "omagic.sh", "package-metadata.sh", - "relocatable-debug-info.sh", "relocatable-exception.sh", "relocatable-merge-sections.sh", "repro.sh", # Note in this test's second half that it uses a custom environment variable called `MOLD_REPRO`. While Wild currently doesn't support `--repro`, it will eventually be moved to the "ignore" group once support is added. From 62df0b1c09fe5f9763d48728d7c7f043f9d1c834 Mon Sep 17 00:00:00 2001 From: vishruth-thimmaiah Date: Wed, 8 Apr 2026 03:51:52 +0530 Subject: [PATCH 2/2] fix: clippy Signed-off-by: vishruth-thimmaiah --- libwild/src/elf.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libwild/src/elf.rs b/libwild/src/elf.rs index ffa8574db..29726e907 100644 --- a/libwild/src/elf.rs +++ b/libwild/src/elf.rs @@ -1889,7 +1889,7 @@ impl platform::Platform for Elf { } _ => {} } - if let Some(_) = section_name.strip_prefix(b".debug_") { + if section_name.strip_prefix(b".debug_").is_some() { return SectionRuleOutcome::Debug; } SectionRuleOutcome::Custom