aboutsummaryrefslogtreecommitdiff
path: root/src/link/Plan9.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2022-02-11 12:16:32 +0100
committerJakub Konka <kubkon@jakubkonka.com>2022-02-11 12:16:32 +0100
commit066758b1a296aa6f01d505f7b90d5aee2f387d30 (patch)
tree50c15027ca05182f8f47e55d2891d9b9d318db66 /src/link/Plan9.zig
parentb9b1ab024063105a9adfe3828692867c91015dc6 (diff)
downloadzig-066758b1a296aa6f01d505f7b90d5aee2f387d30.tar.gz
zig-066758b1a296aa6f01d505f7b90d5aee2f387d30.zip
macho: correctly lower slices incl reloc and rebase tracking
Match changes required to `Elf` linker, which enable lowering of const slices on `MachO` targets. Expand `Mir` instructions requiring the knowledge of the containing atom - pass the symbol index into the linker's table from codegen via mir to emitter, to then utilise it in the linker.
Diffstat (limited to 'src/link/Plan9.zig')
-rw-r--r--src/link/Plan9.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/link/Plan9.zig b/src/link/Plan9.zig
index ee7272ca8d..4eaa6ed26b 100644
--- a/src/link/Plan9.zig
+++ b/src/link/Plan9.zig
@@ -302,7 +302,9 @@ pub fn updateDecl(self: *Plan9, module: *Module, decl: *Module.Decl) !void {
var code_buffer = std.ArrayList(u8).init(self.base.allocator);
defer code_buffer.deinit();
const decl_val = if (decl.val.castTag(.variable)) |payload| payload.data.init else decl.val;
- const res = try codegen.generateSymbol(&self.base, @intCast(u32, decl.link.plan9.sym_index.?), decl.srcLoc(), .{
+ // TODO we need the symbol index for symbol in the table of locals for the containing atom
+ const sym_index = decl.link.plan9.sym_index orelse 0;
+ const res = try codegen.generateSymbol(&self.base, @intCast(u32, sym_index), decl.srcLoc(), .{
.ty = decl.ty,
.val = decl_val,
}, &code_buffer, .{ .none = .{} });