diff --git a/src/link/Elf2.zig b/src/link/Elf2.zig index b7d441e8ad1f2dee1d5e670caff8ca9063067fb5..479c96d7c824736e29da8d857e1e8159d07ecc06 100644 --- a/src/link/Elf2.zig +++ b/src/link/Elf2.zig @@ -7625,11 +7625,15 @@ fn loadObject( }) catch |err| switch (err) { else => |e| return e, error.StripSection => continue, - error.TlsSectionUnavailable => return diags.failParse( - path, - "thread-local storage section '{s}' is incompatible with '-fsingle-threaded'", - .{name}, - ), + error.TlsSectionUnavailable => { + if (section.shdr.size == 0) continue; + + return diags.failParse( + path, + "thread-local storage section '{s}' is incompatible with '-fsingle-threaded'", + .{name}, + ); + }, error.UnsupportedSectionFlags => if (!section.shdr.flags.shf.ALLOC) { // It probably doesn't matter, just skip this section. continue;