authorgravatar for loic@gregoire.devLoïc Grégoire <loic@gregoire.dev> 2026-10-10 07:54:26-04:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-10-16 12:41:30+01:00
logad039bd70c55b85122343ac41cfd104b32e2d211
tree0985257de00deaaf2c1596cc81be315bbc0a1e1a
parentbdd6bc06ca5f9b4cc6dc141470a6efe1ed7e1f6c
signature Commit is signed but in an unrecognized format.

Elf2: check size of TLS section before erroring


1 files changed, 9 insertions(+), 5 deletions(-)

src/link/Elf2.zig+9-5
...@@ -7625,11 +7625,15 @@ fn loadObject(...@@ -7625,11 +7625,15 @@ fn loadObject(
7625 }) catch |err| switch (err) {7625 }) catch |err| switch (err) {
7626 else => |e| return e,7626 else => |e| return e,
7627 error.StripSection => continue,7627 error.StripSection => continue,
7628 error.TlsSectionUnavailable => return diags.failParse(7628 error.TlsSectionUnavailable => {
7629 path,7629 if (section.shdr.size == 0) continue;
7630 "thread-local storage section '{s}' is incompatible with '-fsingle-threaded'",7630
7631 .{name},7631 return diags.failParse(
7632 ),7632 path,
7633 "thread-local storage section '{s}' is incompatible with '-fsingle-threaded'",
7634 .{name},
7635 );
7636 },
7633 error.UnsupportedSectionFlags => if (!section.shdr.flags.shf.ALLOC) {7637 error.UnsupportedSectionFlags => if (!section.shdr.flags.shf.ALLOC) {
7634 // It probably doesn't matter, just skip this section.7638 // It probably doesn't matter, just skip this section.
7635 continue;7639 continue;