authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-12-09 16:21:48+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-12-09 21:12:38+01:00
logf7fea080b25f932b352d38f126e0a179c5163f68
treec7e7e528c0fada33646129533b9b8ce4f3380383
parentbd5a8f86a120093b126cfbde41e002dae161e883

macho+zld: skip atomless synthetic globals in dead_strip

They are implicitly marked live.

1 files changed, 2 insertions(+), 1 deletions(-)

src/link/MachO/dead_strip.zig+2-1
...@@ -58,7 +58,8 @@ fn collectRoots(zld: *Zld, roots: *AtomTable) !void {...@@ -58,7 +58,8 @@ fn collectRoots(zld: *Zld, roots: *AtomTable) !void {
58 const sym = zld.getSymbol(global);58 const sym = zld.getSymbol(global);
59 if (sym.undf()) continue;59 if (sym.undf()) continue;
6060
61 const object = zld.objects.items[global.getFile().?];61 const file = global.getFile() orelse continue; // synthetic globals are atomless
62 const object = zld.objects.items[file];
62 const atom_index = object.getAtomIndexForSymbol(global.sym_index).?; // panic here means fatal error63 const atom_index = object.getAtomIndexForSymbol(global.sym_index).?; // panic here means fatal error
63 _ = try roots.getOrPut(atom_index);64 _ = try roots.getOrPut(atom_index);
6465