aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen.zig')
-rw-r--r--src/codegen.zig9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/codegen.zig b/src/codegen.zig
index 511d4c2301..e79003f728 100644
--- a/src/codegen.zig
+++ b/src/codegen.zig
@@ -2840,7 +2840,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
}
} else if (func_value.castTag(.extern_fn)) |func_payload| {
const decl = func_payload.data;
- const where_index = try macho_file.addExternFn(mem.spanZ(decl.name));
+ const resolv = try macho_file.addExternFn(mem.spanZ(decl.name));
const offset = blk: {
switch (arch) {
.x86_64 => {
@@ -2861,8 +2861,11 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
// Add relocation to the decl.
try macho_file.active_decl.?.link.macho.relocs.append(self.bin_file.allocator, .{
.offset = offset,
- .where = .undef,
- .where_index = where_index,
+ .where = switch (resolv.where) {
+ .local => .local,
+ .undef => .undef,
+ },
+ .where_index = resolv.where_index,
.payload = .{ .branch = .{
.arch = arch,
} },