From e8eb9778cccd2f2d23027d9e0d73d7053bf92efe Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Tue, 1 Mar 2022 22:03:18 +0100 Subject: codegen: lower field_ptr to memory across linking backends This requires generating an addend for the target relocation as the field pointer might point at a field inner to the container. --- src/arch/x86_64/CodeGen.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/arch') diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index c1d1c6863e..c511a26eac 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -2565,7 +2565,8 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type const payload = try self.addExtra(Mir.ImmPair{ .dest_off = 0, - .operand = @intCast(u32, imm), + // TODO check if this logic is correct + .operand = @truncate(u32, imm), }); const flags: u2 = switch (abi_size) { 1 => 0b00, -- cgit v1.2.3