From 454c1e17dff7a67c0d7115c6b1a4bc3ff98a575d Mon Sep 17 00:00:00 2001 From: Fahd Ashour Date: Tue, 7 Apr 2026 08:38:43 +0200 Subject: [PATCH 1/4] fix: copying debug symbols from debug info section --- libwild/src/elf_writer.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/libwild/src/elf_writer.rs b/libwild/src/elf_writer.rs index ba58fd3f5..4a3dad2af 100644 --- a/libwild/src/elf_writer.rs +++ b/libwild/src/elf_writer.rs @@ -1860,6 +1860,7 @@ fn write_symbols<'data>( if let Some(section_index) = object.object.symbol_section(sym, sym_index)? { match &object.sections[section_index.0] { SectionSlot::Loaded(section) => section.output_section_id(), + SectionSlot::LoadedDebugInfo(section) => section.output_section_id(), SectionSlot::MergeStrings(section) => section.part_id.output_section_id(), SectionSlot::FrameData(..) => output_section_id::EH_FRAME, _ => bail!( From 82a0b0e4949ef16bebb5f6c6868d527e66208924 Mon Sep 17 00:00:00 2001 From: Fahd Ashour Date: Thu, 9 Apr 2026 09:19:02 +0200 Subject: [PATCH 2/4] add an integration test that doesn't work for now --- .../linker-plugin-lto-debug-info.c | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 wild/tests/sources/elf/linker-plugin-lto-debug-info/linker-plugin-lto-debug-info.c diff --git a/wild/tests/sources/elf/linker-plugin-lto-debug-info/linker-plugin-lto-debug-info.c b/wild/tests/sources/elf/linker-plugin-lto-debug-info/linker-plugin-lto-debug-info.c new file mode 100644 index 000000000..a30c7b712 --- /dev/null +++ b/wild/tests/sources/elf/linker-plugin-lto-debug-info/linker-plugin-lto-debug-info.c @@ -0,0 +1,24 @@ +//#AbstractConfig:default +//#RequiresLinkerPlugin:true +//#RequiresCompilerFlags:-flto=auto -fno-fat-lto-objects +//#DiffEnabled:false +//#RunEnabled:false +//#SkipLinker:ld + +//#Config:gcc:default +//#CompArgs:-O2 -g -DRELDEBUG -flto=auto -fno-fat-lto-objects +//#Object:runtime.c +//#LinkerDriver:gcc +//#LinkArgs:-flto=auto -nostdlib -Wl,--export-dynamic -rdynamic +//#ExpectSym:debug_sym section=".debug_info" + +#include "runtime.h" + +int debug_sym __attribute__((used, section(".debug_info"))) = 123; + +int foo() { return 42; } + +void _start(void) { + runtime_init(); + exit_syscall(foo()); +} From 8bec8ba40ac882573abbbdeaa016b494ebb77b76 Mon Sep 17 00:00:00 2001 From: Fahd Ashour Date: Thu, 9 Apr 2026 09:31:06 +0200 Subject: [PATCH 3/4] stop skipping relocatable-debug-info.sh as it passes now --- wild/tests/external_tests/mold_skip_tests.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/wild/tests/external_tests/mold_skip_tests.toml b/wild/tests/external_tests/mold_skip_tests.toml index 2ac85bb7d..35cf5dc38 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 5d9b928de8aed39492d7735a4e37f10416035fec Mon Sep 17 00:00:00 2001 From: Fahd Ashour Date: Thu, 9 Apr 2026 10:31:31 +0200 Subject: [PATCH 4/4] add debug info arg for relocatables.c test --- wild/tests/sources/elf/relocatables/relocatables.c | 1 + 1 file changed, 1 insertion(+) diff --git a/wild/tests/sources/elf/relocatables/relocatables.c b/wild/tests/sources/elf/relocatables/relocatables.c index ebf7c1733..f60b864c5 100644 --- a/wild/tests/sources/elf/relocatables/relocatables.c +++ b/wild/tests/sources/elf/relocatables/relocatables.c @@ -1,5 +1,6 @@ //#EnableLinker:lld //#Object:runtime.c +//#CompArgs:-g //#Relocatable:relocatable-1.c,relocatable-2.c #include "runtime.h"