authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-05-25 09:19:57+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-05-26 06:48:53+01:00
log32fa9eea52505b657e2c31a85b8a737740a1014e
tree65a877274af569ad52cac90a076684ac4972ae5a
parent9ce9ee9ae2e2c74c782de416ed735a77e94d3c07
signaturelock-open Commit is signed but in an unrecognized format.

Elf2: strip input debug info sections under `-fstrip`


1 files changed, 10 insertions(+), 0 deletions(-)

src/link/Elf2.zig+10
......@@ -2847,6 +2847,14 @@ fn mapInputSection(elf: *Elf, opts: struct {
28472847 assert(!elf.base.comp.config.any_non_single_threaded);
28482848 return error.TlsSectionUnavailable;
28492849 }
2850
2851 if (elf.base.comp.config.debug_format == .strip and
2852 std.mem.startsWith(u8, opts.name, ".debug_") and
2853 !opts.flags.ALLOC)
2854 {
2855 return error.StripSection;
2856 }
2857
28502858 const name: []const u8 = switch (elf.ehdrField(.type)) {
28512859 .NONE, .CORE, _ => unreachable,
28522860 .REL => opts.name,
......@@ -2971,6 +2979,7 @@ fn navMapIndex(elf: *Elf, zcu: *Zcu, nav_index: InternPool.Nav.Index) !Node.NavM
29712979 })) |shndx| {
29722980 break :section shndx;
29732981 } else |err| switch (err) {
2982 error.StripSection,
29742983 error.TlsSectionUnavailable,
29752984 error.UnsupportedSectionFlags,
29762985 error.SectionTypeConflict,
......@@ -3271,6 +3280,7 @@ fn loadObject(
32713280 .addralign = section.shdr.addralign,
32723281 .entsize = section.shdr.entsize,
32733282 }) catch |err| switch (err) {
3283 error.StripSection => continue,
32743284 error.TlsSectionUnavailable => return diags.failParse(
32753285 path,
32763286 "thread-local storage section '{s}' is incompatible with '-fsingle-threaded'",