Commit 02baaac506

Jakub Konka <kubkon@jakubkonka.com>
2020-11-27 20:31:26
Update src/codegen.zig
Co-authored-by: Andrew Kelley <andrew@ziglang.org>
1 parent ebb2f20
Changed files (1)
src/codegen.zig
@@ -2584,7 +2584,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
                     },
                     .register => return self.fail(src, "TODO implement genSetReg for aarch64 {}", .{mcv}),
                     .memory => |addr| {
-                        if (self.bin_file.cast(link.File.MachO)) |macho_file| {
+                        if (self.bin_file.options.pie) {
                             // For MachO, the binary, with the exception of object files, has to be a PIE.
                             // Therefore we cannot load an absolute address.
                             // Instead, we need to make use of PC-relative addressing.