aboutsummaryrefslogtreecommitdiff
path: root/src/arch/x86_64/CodeGen.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2024-08-13 11:11:16 +0200
committerJakub Konka <kubkon@jakubkonka.com>2024-08-13 13:30:24 +0200
commitafaec5c3e477a66695fdfca30bcc662fd1c73cd4 (patch)
tree67b0a57a557a9cbb502ab372917bc1fd83b8dbb7 /src/arch/x86_64/CodeGen.zig
parentedd72c75eb4164f5799d56128ce6e17668efb0e2 (diff)
downloadzig-afaec5c3e477a66695fdfca30bcc662fd1c73cd4.tar.gz
zig-afaec5c3e477a66695fdfca30bcc662fd1c73cd4.zip
x86_64: fix generating lazy symbol refs
Diffstat (limited to 'src/arch/x86_64/CodeGen.zig')
-rw-r--r--src/arch/x86_64/CodeGen.zig9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig
index 116911c409..1edf208d4c 100644
--- a/src/arch/x86_64/CodeGen.zig
+++ b/src/arch/x86_64/CodeGen.zig
@@ -15304,7 +15304,7 @@ fn genLazySymbolRef(
if (self.mod.pic) {
switch (tag) {
.lea, .call => try self.genSetReg(reg, Type.usize, .{
- .load_symbol = .{ .sym = sym_index },
+ .lea_symbol = .{ .sym = sym_index },
}, .{}),
.mov => try self.genSetReg(reg, Type.usize, .{
.load_symbol = .{ .sym = sym_index },
@@ -15322,14 +15322,11 @@ fn genLazySymbolRef(
.sym_index = sym_index,
};
switch (tag) {
- .lea, .mov => try self.asmRegisterMemory(.{ ._, .mov }, reg.to64(), .{
- .base = .{ .reloc = reloc },
- .mod = .{ .rm = .{ .size = .qword } },
- }),
- .call => try self.asmMemory(.{ ._, .call }, .{
+ .lea, .mov => try self.asmRegisterMemory(.{ ._, tag }, reg.to64(), .{
.base = .{ .reloc = reloc },
.mod = .{ .rm = .{ .size = .qword } },
}),
+ .call => try self.asmImmediate(.{ ._, .call }, Immediate.rel(reloc)),
else => unreachable,
}
}