Skip to content

Commit

Permalink
macho: add handling of powerpc architecture (gimli-rs#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
uglyoldbob authored Sep 1, 2022
1 parent ca203c6 commit 4c78e18
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/read/macho/fat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ pub trait FatArch: Pod {
macho::CPU_TYPE_X86 => Architecture::I386,
macho::CPU_TYPE_X86_64 => Architecture::X86_64,
macho::CPU_TYPE_MIPS => Architecture::Mips,
macho::CPU_TYPE_POWERPC => Architecture::PowerPc,
macho::CPU_TYPE_POWERPC64 => Architecture::PowerPc64,
_ => Architecture::Unknown,
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/read/macho/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ where
macho::CPU_TYPE_X86 => Architecture::I386,
macho::CPU_TYPE_X86_64 => Architecture::X86_64,
macho::CPU_TYPE_MIPS => Architecture::Mips,
macho::CPU_TYPE_POWERPC => Architecture::PowerPc,
macho::CPU_TYPE_POWERPC64 => Architecture::PowerPc64,
_ => Architecture::Unknown,
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/write/macho.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ impl<'a> Object<'a> {
Architecture::Aarch64 => (macho::CPU_TYPE_ARM64, macho::CPU_SUBTYPE_ARM64_ALL),
Architecture::I386 => (macho::CPU_TYPE_X86, macho::CPU_SUBTYPE_I386_ALL),
Architecture::X86_64 => (macho::CPU_TYPE_X86_64, macho::CPU_SUBTYPE_X86_64_ALL),
Architecture::PowerPc => (macho::CPU_TYPE_POWERPC, macho::CPU_SUBTYPE_POWERPC_ALL),
Architecture::PowerPc64 => (macho::CPU_TYPE_POWERPC64, macho::CPU_SUBTYPE_POWERPC_ALL),
_ => {
return Err(Error(format!(
"unimplemented architecture {:?}",
Expand Down

0 comments on commit 4c78e18

Please sign in to comment.