| ... | @@ -50,7 +50,7 @@ pub fn getTargetAtomIndex(self: Relocation, macho_file: *MachO) ?Atom.Index { | ... | @@ -50,7 +50,7 @@ pub fn getTargetAtomIndex(self: Relocation, macho_file: *MachO) ?Atom.Index { |
| 50 | return macho_file.getAtomIndexForSymbol(self.target); | 50 | return macho_file.getAtomIndexForSymbol(self.target); |
| 51 | } | 51 | } |
| 52 | | 52 | |
| 53 | pub fn resolve(self: Relocation, macho_file: *MachO, atom_index: Atom.Index, code: []u8) !void { | 53 | pub fn resolve(self: Relocation, macho_file: *MachO, atom_index: Atom.Index, code: []u8) void { |
| 54 | const arch = macho_file.base.options.target.cpu.arch; | 54 | const arch = macho_file.base.options.target.cpu.arch; |
| 55 | const atom = macho_file.getAtom(atom_index); | 55 | const atom = macho_file.getAtom(atom_index); |
| 56 | const source_sym = atom.getSymbol(macho_file); | 56 | const source_sym = atom.getSymbol(macho_file); |
| ... | @@ -68,18 +68,13 @@ pub fn resolve(self: Relocation, macho_file: *MachO, atom_index: Atom.Index, cod | ... | @@ -68,18 +68,13 @@ pub fn resolve(self: Relocation, macho_file: *MachO, atom_index: Atom.Index, cod |
| 68 | }); | 68 | }); |
| 69 | | 69 | |
| 70 | switch (arch) { | 70 | switch (arch) { |
| 71 | .aarch64 => return self.resolveAarch64(source_addr, target_addr, code), | 71 | .aarch64 => self.resolveAarch64(source_addr, target_addr, code), |
| 72 | .x86_64 => return self.resolveX8664(source_addr, target_addr, code), | 72 | .x86_64 => self.resolveX8664(source_addr, target_addr, code), |
| 73 | else => unreachable, | 73 | else => unreachable, |
| 74 | } | 74 | } |
| 75 | } | 75 | } |
| 76 | | 76 | |
| 77 | fn resolveAarch64( | 77 | fn resolveAarch64(self: Relocation, source_addr: u64, target_addr: i64, code: []u8) void { |
| 78 | self: Relocation, | | |
| 79 | source_addr: u64, | | |
| 80 | target_addr: i64, | | |
| 81 | code: []u8, | | |
| 82 | ) !void { | | |
| 83 | const rel_type = @intToEnum(macho.reloc_type_arm64, self.type); | 78 | const rel_type = @intToEnum(macho.reloc_type_arm64, self.type); |
| 84 | if (rel_type == .ARM64_RELOC_UNSIGNED) { | 79 | if (rel_type == .ARM64_RELOC_UNSIGNED) { |
| 85 | return switch (self.length) { | 80 | return switch (self.length) { |
| ... | @@ -212,12 +207,7 @@ fn resolveAarch64( | ... | @@ -212,12 +207,7 @@ fn resolveAarch64( |
| 212 | } | 207 | } |
| 213 | } | 208 | } |
| 214 | | 209 | |
| 215 | fn resolveX8664( | 210 | fn resolveX8664(self: Relocation, source_addr: u64, target_addr: i64, code: []u8) void { |
| 216 | self: Relocation, | | |
| 217 | source_addr: u64, | | |
| 218 | target_addr: i64, | | |
| 219 | code: []u8, | | |
| 220 | ) !void { | | |
| 221 | const rel_type = @intToEnum(macho.reloc_type_x86_64, self.type); | 211 | const rel_type = @intToEnum(macho.reloc_type_x86_64, self.type); |
| 222 | switch (rel_type) { | 212 | switch (rel_type) { |
| 223 | .X86_64_RELOC_BRANCH, | 213 | .X86_64_RELOC_BRANCH, |