From 600348283fa5ea9646f91997e0a32f4632ca30b8 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Fri, 22 Jul 2022 21:19:33 +0200 Subject: [PATCH] macho: include __StaticInit input sections as GC roots --- src/link/MachO/dead_strip.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/link/MachO/dead_strip.zig b/src/link/MachO/dead_strip.zig index b3454dda57..909a0450d6 100644 --- a/src/link/MachO/dead_strip.zig +++ b/src/link/MachO/dead_strip.zig @@ -92,6 +92,7 @@ fn collectRoots(roots: *std.AutoHashMap(*Atom, void), macho_file: *MachO) !void const source_sect = object.getSourceSection(source_sym.n_sect - 1); const is_gc_root = blk: { if (source_sect.isDontDeadStrip()) break :blk true; + if (mem.eql(u8, "__StaticInit", source_sect.sectName())) break :blk true; switch (source_sect.type_()) { macho.S_MOD_INIT_FUNC_POINTERS, macho.S_MOD_TERM_FUNC_POINTERS,