aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2024-07-10 16:28:00 +0200
committerJakub Konka <kubkon@jakubkonka.com>2024-07-18 09:13:08 +0200
commit5b4c0cc1f9c4cb047064cffb70bc649b83681814 (patch)
tree596178ec6c3d67e1e55c206ea197a2cee56fd821 /src/codegen.zig
parentf8b5466aef4131821b259aa5f0d6b9654a5595ce (diff)
downloadzig-5b4c0cc1f9c4cb047064cffb70bc649b83681814.tar.gz
zig-5b4c0cc1f9c4cb047064cffb70bc649b83681814.zip
macho: update ZigObject to use new ownership model
Diffstat (limited to 'src/codegen.zig')
-rw-r--r--src/codegen.zig9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/codegen.zig b/src/codegen.zig
index 33a0b556f7..3dc3d415be 100644
--- a/src/codegen.zig
+++ b/src/codegen.zig
@@ -901,15 +901,16 @@ fn genDeclRef(
}
return GenResult.mcv(.{ .load_symbol = sym.esym_index });
} else if (lf.cast(link.File.MachO)) |macho_file| {
+ const zo = macho_file.getZigObject().?;
if (is_extern) {
const name = decl.name.toSlice(ip);
const lib_name = if (decl.getOwnedVariable(zcu)) |ov| ov.lib_name.toSlice(ip) else null;
const sym_index = try macho_file.getGlobalSymbol(name, lib_name);
- macho_file.getSymbol(macho_file.getZigObject().?.symbols.items[sym_index]).flags.needs_got = true;
+ zo.symbols.items[sym_index].flags.needs_got = true;
return GenResult.mcv(.{ .load_symbol = sym_index });
}
- const sym_index = try macho_file.getZigObject().?.getOrCreateMetadataForDecl(macho_file, decl_index);
- const sym = macho_file.getSymbol(sym_index);
+ const sym_index = try zo.getOrCreateMetadataForDecl(macho_file, decl_index);
+ const sym = zo.symbols.items[sym_index];
if (is_threadlocal) {
return GenResult.mcv(.{ .load_tlv = sym.nlist_idx });
}
@@ -956,7 +957,7 @@ fn genUnnamedConst(
},
.macho => {
const macho_file = lf.cast(link.File.MachO).?;
- const local = macho_file.getSymbol(local_sym_index);
+ const local = macho_file.getZigObject().?.symbols.items[local_sym_index];
return GenResult.mcv(.{ .load_symbol = local.nlist_idx });
},
.coff => {