| ... | ... | @@ -99,11 +99,10 @@ pub fn parse(self: *Object, allocator: Allocator, cpu_arch: std.Target.Cpu.Arch) |
| 99 | 99 | }, |
| 100 | 100 | .SYMTAB => { |
| 101 | 101 | const symtab = cmd.cast(macho.symtab_command).?; |
| 102 | | // Sadly, SYMTAB may be at an unaligned offset within the object file. |
| 103 | | self.in_symtab = @alignCast(@alignOf(macho.nlist_64), @ptrCast( |
| 104 | | [*]align(1) const macho.nlist_64, |
| 105 | | self.contents.ptr + symtab.symoff, |
| 106 | | ))[0..symtab.nsyms]; |
| 102 | self.in_symtab = @ptrCast( |
| 103 | [*]const macho.nlist_64, |
| 104 | @alignCast(@alignOf(macho.nlist_64), &self.contents[symtab.symoff]), |
| 105 | )[0..symtab.nsyms]; |
| 107 | 106 | self.in_strtab = self.contents[symtab.stroff..][0..symtab.strsize]; |
| 108 | 107 | try self.symtab.appendSlice(allocator, self.in_symtab); |
| 109 | 108 | }, |
| ... | ... | @@ -303,10 +302,10 @@ pub fn splitIntoAtomsOneShot(self: *Object, macho_file: *MachO, object_id: u32) |
| 303 | 302 | const code: ?[]const u8 = if (!sect.isZerofill()) try self.getSectionContents(sect) else null; |
| 304 | 303 | |
| 305 | 304 | // Read section's list of relocations |
| 306 | | const relocs = @alignCast(@alignOf(macho.relocation_info), @ptrCast( |
| 307 | | [*]align(1) const macho.relocation_info, |
| 308 | | self.contents.ptr + sect.reloff, |
| 309 | | ))[0..sect.nreloc]; |
| 305 | const relocs = @ptrCast( |
| 306 | [*]const macho.relocation_info, |
| 307 | @alignCast(@alignOf(macho.relocation_info), &self.contents[sect.reloff]), |
| 308 | )[0..sect.nreloc]; |
| 310 | 309 | |
| 311 | 310 | // Symbols within this section only. |
| 312 | 311 | const filtered_syms = filterSymbolsByAddress( |
| ... | ... | @@ -549,10 +548,10 @@ pub fn parseDataInCode(self: Object) ?[]const macho.data_in_code_entry { |
| 549 | 548 | .DATA_IN_CODE => { |
| 550 | 549 | const dice = cmd.cast(macho.linkedit_data_command).?; |
| 551 | 550 | const ndice = @divExact(dice.datasize, @sizeOf(macho.data_in_code_entry)); |
| 552 | | return @alignCast(@alignOf(macho.data_in_code_entry), @ptrCast( |
| 553 | | [*]align(1) const macho.data_in_code_entry, |
| 554 | | self.contents.ptr + dice.dataoff, |
| 555 | | ))[0..ndice]; |
| 551 | return @ptrCast( |
| 552 | [*]const macho.data_in_code_entry, |
| 553 | @alignCast(@alignOf(macho.data_in_code_entry), &self.contents[dice.dataoff]), |
| 554 | )[0..ndice]; |
| 556 | 555 | }, |
| 557 | 556 | else => {}, |
| 558 | 557 | } |