| ... | @@ -5115,6 +5115,23 @@ fn markReferences(wasm: *Wasm) !void { | ... | @@ -5115,6 +5115,23 @@ fn markReferences(wasm: *Wasm) !void { |
| 5115 | if (sym.isExported(wasm.base.options.rdynamic) or sym.isNoStrip()) { | 5115 | if (sym.isExported(wasm.base.options.rdynamic) or sym.isNoStrip()) { |
| 5116 | try wasm.mark(sym_loc); | 5116 | try wasm.mark(sym_loc); |
| 5117 | } | 5117 | } |
| | 5118 | |
| | 5119 | // Debug sections may require to be parsed and marked when it contains |
| | 5120 | // relocations to alive symbols. |
| | 5121 | if (sym.tag == .section and !wasm.base.options.strip) { |
| | 5122 | const file = sym_loc.file orelse continue; // Incremental debug info is done independently |
| | 5123 | const object = &wasm.objects.items[file]; |
| | 5124 | const atom_index = try Object.parseSymbolIntoAtom(object, file, sym_loc.index, wasm); |
| | 5125 | const atom = wasm.getAtom(atom_index); |
| | 5126 | for (atom.relocs.items) |reloc| { |
| | 5127 | const target_loc: SymbolLoc = .{ .index = reloc.index, .file = atom.file }; |
| | 5128 | const target_sym = target_loc.getSymbol(wasm); |
| | 5129 | if (target_sym.isAlive()) { |
| | 5130 | sym.mark(); |
| | 5131 | continue; // Skip all other relocations as this debug atom is already marked now |
| | 5132 | } |
| | 5133 | } |
| | 5134 | } |
| 5118 | } | 5135 | } |
| 5119 | } | 5136 | } |
| 5120 | | 5137 | |