| ... | ... | @@ -790,11 +790,22 @@ pub fn getDeclVAddr( |
| 790 | 790 | reloc_info: link.File.RelocInfo, |
| 791 | 791 | ) !u64 { |
| 792 | 792 | const target = wasm_file.base.comp.root_mod.resolved_target.result; |
| 793 | | const gpa = pt.zcu.gpa; |
| 794 | | const decl = pt.zcu.declPtr(decl_index); |
| 793 | const zcu = pt.zcu; |
| 794 | const ip = &zcu.intern_pool; |
| 795 | const gpa = zcu.gpa; |
| 796 | const decl = zcu.declPtr(decl_index); |
| 795 | 797 | |
| 796 | 798 | const target_atom_index = try zig_object.getOrCreateAtomForDecl(wasm_file, pt, decl_index); |
| 797 | | const target_symbol_index = @intFromEnum(wasm_file.getAtom(target_atom_index).sym_index); |
| 799 | const target_atom = wasm_file.getAtom(target_atom_index); |
| 800 | const target_symbol_index = @intFromEnum(target_atom.sym_index); |
| 801 | if (decl.isExtern(zcu)) { |
| 802 | const name = decl.name.toSlice(ip); |
| 803 | const lib_name = if (decl.getOwnedExternFunc(zcu)) |ext_fn| |
| 804 | ext_fn.lib_name.toSlice(ip) |
| 805 | else |
| 806 | decl.getOwnedVariable(zcu).?.lib_name.toSlice(ip); |
| 807 | try zig_object.addOrUpdateImport(wasm_file, name, target_atom.sym_index, lib_name, null); |
| 808 | } |
| 798 | 809 | |
| 799 | 810 | std.debug.assert(reloc_info.parent_atom_index != 0); |
| 800 | 811 | const atom_index = wasm_file.symbol_atom.get(.{ .file = zig_object.index, .index = @enumFromInt(reloc_info.parent_atom_index) }).?; |