Skip to content

Commit

Permalink
Add Architecture::Sparc32Plus
Browse files Browse the repository at this point in the history
  • Loading branch information
glaubitz committed Jun 27, 2024
1 parent fd693f4 commit 6410f1c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub enum Architecture {
Sbf,
Sharc,
Sparc,
Sparc32Plus,
Sparc64,
Wasm32,
Wasm64,
Expand Down Expand Up @@ -72,6 +73,7 @@ impl Architecture {
Architecture::Sbf => Some(AddressSize::U64),
Architecture::Sharc => Some(AddressSize::U32),
Architecture::Sparc => Some(AddressSize::U32),
Architecture::Sparc32Plus => Some(AddressSize::U32),
Architecture::Sparc64 => Some(AddressSize::U64),
Architecture::Wasm32 => Some(AddressSize::U32),
Architecture::Wasm64 => Some(AddressSize::U64),
Expand Down
1 change: 1 addition & 0 deletions src/read/elf/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ where
(elf::EM_SBF, _) => Architecture::Sbf,
(elf::EM_SHARC, false) => Architecture::Sharc,
(elf::EM_SPARC, false) => Architecture::Sparc,
(elf::EM_SPARC32PLUS, false) => Architecture::Sparc32Plus,
(elf::EM_SPARCV9, true) => Architecture::Sparc64,
(elf::EM_XTENSA, false) => Architecture::Xtensa,
_ => Architecture::Unknown,
Expand Down
4 changes: 3 additions & 1 deletion src/write/elf/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ impl<'a> Object<'a> {
Architecture::Sbf => false,
Architecture::Sharc => true,
Architecture::Sparc => true,
Architecture::Sparc32Plus => true,
Architecture::Sparc64 => true,
Architecture::Xtensa => true,
_ => {
Expand Down Expand Up @@ -412,7 +413,7 @@ impl<'a> Object<'a> {
return Err(Error(format!("unimplemented relocation {:?}", reloc)));
}
},
Architecture::Sparc => match (kind, encoding, size) {
Architecture::Sparc | Architecture::Sparc32Plus => match (kind, encoding, size) {
// TODO: use R_SPARC_32 if aligned.
(RelocationKind::Absolute, _, 32) => elf::R_SPARC_UA32,
_ => {
Expand Down Expand Up @@ -640,6 +641,7 @@ impl<'a> Object<'a> {
(Architecture::Sbf, None) => elf::EM_SBF,
(Architecture::Sharc, None) => elf::EM_SHARC,
(Architecture::Sparc, None) => elf::EM_SPARC,
(Architecture::Sparc32Plus, None) => elf::EM_SPARC32PLUS,
(Architecture::Sparc64, None) => elf::EM_SPARCV9,
(Architecture::Xtensa, None) => elf::EM_XTENSA,
_ => {
Expand Down
1 change: 1 addition & 0 deletions tests/round_trip/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ fn elf_any() {
(Architecture::S390x, Endianness::Big),
(Architecture::Sbf, Endianness::Little),
(Architecture::Sparc, Endianness::Big),
(Architecture::Sparc32Plus, Endianness::Big),
(Architecture::Sparc64, Endianness::Big),
(Architecture::Xtensa, Endianness::Little),
]
Expand Down

0 comments on commit 6410f1c

Please sign in to comment.