Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ARM64 relocations when writing a Mach-O object #422

Merged
merged 1 commit into from
Jan 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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