| ... | @@ -7564,11 +7564,25 @@ fn genInlineMemset( | ... | @@ -7564,11 +7564,25 @@ fn genInlineMemset( |
| 7564 | try self.spillRegisters(&.{ .rdi, .al, .rcx }); | 7564 | try self.spillRegisters(&.{ .rdi, .al, .rcx }); |
| 7565 | | 7565 | |
| 7566 | switch (dst_ptr) { | 7566 | switch (dst_ptr) { |
| 7567 | .memory, .linker_load => { | 7567 | .memory => |addr| { |
| 7568 | try self.loadMemPtrIntoRegister(.rdi, Type.usize, dst_ptr); | 7568 | try self.genSetReg(Type.usize, .rdi, .{ .immediate = addr }); |
| 7569 | // Load the pointer, which is stored in memory | 7569 | // Load the pointer, which is stored in memory |
| 7570 | try self.asmRegisterMemory(.mov, .rdi, Memory.sib(.qword, .{ .base = .rdi })); | 7570 | try self.asmRegisterMemory(.mov, .rdi, Memory.sib(.qword, .{ .base = .rdi })); |
| 7571 | }, | 7571 | }, |
| | 7572 | .linker_load => |load_struct| { |
| | 7573 | const atom_index = if (self.bin_file.cast(link.File.MachO)) |macho_file| blk: { |
| | 7574 | const atom = try macho_file.getOrCreateAtomForDecl(self.mod_fn.owner_decl); |
| | 7575 | break :blk macho_file.getAtom(atom).getSymbolIndex().?; |
| | 7576 | } else if (self.bin_file.cast(link.File.Coff)) |coff_file| blk: { |
| | 7577 | const atom = try coff_file.getOrCreateAtomForDecl(self.mod_fn.owner_decl); |
| | 7578 | break :blk coff_file.getAtom(atom).getSymbolIndex().?; |
| | 7579 | } else unreachable; |
| | 7580 | |
| | 7581 | switch (load_struct.type) { |
| | 7582 | .import => unreachable, |
| | 7583 | .got, .direct => try self.asmMovLinker(.rdi, atom_index, load_struct), |
| | 7584 | } |
| | 7585 | }, |
| 7572 | .stack_offset, .ptr_stack_offset => |off| { | 7586 | .stack_offset, .ptr_stack_offset => |off| { |
| 7573 | try self.asmRegisterMemory(switch (dst_ptr) { | 7587 | try self.asmRegisterMemory(switch (dst_ptr) { |
| 7574 | .stack_offset => .mov, | 7588 | .stack_offset => .mov, |