diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2024-01-18 19:11:48 +0100 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2024-01-24 12:34:41 +0100 |
| commit | a79a038e61541d6faffaab70c82a18a812c2e9df (patch) | |
| tree | fa231a598afc9a1b8671ecd6095180ffa8603704 /src/arch/x86_64/CodeGen.zig | |
| parent | 96cc9fafbf0a382c0ed0b6142986cd8373cffaa3 (diff) | |
| download | zig-a79a038e61541d6faffaab70c82a18a812c2e9df.tar.gz zig-a79a038e61541d6faffaab70c82a18a812c2e9df.zip | |
codegen: implement more missing bits
Diffstat (limited to 'src/arch/x86_64/CodeGen.zig')
| -rw-r--r-- | src/arch/x86_64/CodeGen.zig | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 2b4932c5c2..2cc5fe267e 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -13507,24 +13507,27 @@ fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerEr }, .lea_symbol => |sym_index| { const atom_index = try self.owner.getSymbolIndex(self); - if (self.bin_file.cast(link.File.Elf)) |_| { - try self.asmRegisterMemory( - .{ ._, .lea }, - dst_reg.to64(), - .{ - .base = .{ .reloc = .{ - .atom_index = atom_index, - .sym_index = sym_index.sym, - } }, - .mod = .{ .rm = .{ - .size = .qword, - .disp = sym_index.off, - } }, - }, - ); - } else return self.fail("TODO emit symbol sequence on {s}", .{ - @tagName(self.bin_file.tag), - }); + switch (self.bin_file.tag) { + .elf, .macho => { + try self.asmRegisterMemory( + .{ ._, .lea }, + dst_reg.to64(), + .{ + .base = .{ .reloc = .{ + .atom_index = atom_index, + .sym_index = sym_index.sym, + } }, + .mod = .{ .rm = .{ + .size = .qword, + .disp = sym_index.off, + } }, + }, + ); + }, + else => return self.fail("TODO emit symbol sequence on {s}", .{ + @tagName(self.bin_file.tag), + }), + } }, .lea_direct, .lea_got => |sym_index| { const atom_index = try self.owner.getSymbolIndex(self); @@ -16066,7 +16069,7 @@ fn resolveInst(self: *Self, ref: Air.Inst.Ref) InnerError!MCValue { ); break :init .{ .load_frame = .{ .index = frame_index } }; } else if (self.bin_file.cast(link.File.MachO)) |_| { - return self.fail("TODO implement lowering TLV variable to stack", .{}); + return self.fail("TODO implement saving TLV variable to stack", .{}); } else break :init const_mcv, else => break :init const_mcv, } |
