aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2020-10-01 20:20:01 +0200
committerJakub Konka <kubkon@jakubkonka.com>2020-10-04 15:31:47 +0200
commit737a8bf2041158b3036bda9130f9ce3f6c1ad582 (patch)
tree3e033ef41421ca05eecd76bbd1016d9ff0f40237 /src/codegen.zig
parent2ba23abd9d267f6e007df1661da32be583145a6b (diff)
downloadzig-737a8bf2041158b3036bda9130f9ce3f6c1ad582.tar.gz
zig-737a8bf2041158b3036bda9130f9ce3f6c1ad582.zip
Redo local symbols and offsets tracking to match Elf's approach
Diffstat (limited to 'src/codegen.zig')
-rw-r--r--src/codegen.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/codegen.zig b/src/codegen.zig
index ccd1bc3b22..57d2f8ff1f 100644
--- a/src/codegen.zig
+++ b/src/codegen.zig
@@ -1532,7 +1532,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
if (func_inst.val.cast(Value.Payload.Function)) |func_val| {
const func = func_val.func;
const got = &macho_file.sections.items[macho_file.got_section_index.?];
- const got_addr = got.addr + func.owner_decl.link.macho.offset_table_index.? * @sizeOf(u64);
+ const got_addr = got.addr + func.owner_decl.link.macho.offset_table_index * @sizeOf(u64);
// Here, we store the got address in %rax, and then call %rax
// movabsq [addr], %rax
try self.genSetReg(inst.base.src, .rax, .{ .memory = got_addr });
@@ -2591,7 +2591,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
} else if (self.bin_file.cast(link.File.MachO)) |macho_file| {
const decl = payload.decl;
const got = &macho_file.sections.items[macho_file.got_section_index.?];
- const got_addr = got.addr + decl.link.macho.offset_table_index.? * ptr_bytes;
+ const got_addr = got.addr + decl.link.macho.offset_table_index * ptr_bytes;
return MCValue{ .memory = got_addr };
} else if (self.bin_file.cast(link.File.Coff)) |coff_file| {
const decl = payload.decl;