Skip to content

Commit

Permalink
write/macho: support ARM64 relocations (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu authored Jan 15, 2022
1 parent 9e18692 commit 5117c57
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/write/macho.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,11 +584,25 @@ impl<'a> Object<'a> {
return Err(Error(format!("unimplemented relocation {:?}", reloc)));
}
},
Architecture::Aarch64 => match (reloc.kind, reloc.encoding, reloc.addend) {
(RelocationKind::Absolute, RelocationEncoding::Generic, 0) => {
(false, macho::ARM64_RELOC_UNSIGNED)
}
(
RelocationKind::MachO { value, relative },
RelocationEncoding::Generic,
0,
) => (relative, value),
_ => {
return Err(Error(format!("unimplemented relocation {:?}", reloc)));
}
},
_ => {
return Err(Error(format!(
"unimplemented architecture {:?}",
self.architecture
)));
if let RelocationKind::MachO { value, relative } = reloc.kind {
(relative, value)
} else {
return Err(Error(format!("unimplemented relocation {:?}", reloc)));
}
}
};
let reloc_info = macho::RelocationInfo {
Expand Down

0 comments on commit 5117c57

Please sign in to comment.