Skip to content

Commit

Permalink
FileFlags::Elf: Add os_abi
Browse files Browse the repository at this point in the history
  • Loading branch information
mkroening committed Jun 1, 2022
1 parent b706982 commit 79e9579
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ pub enum FileFlags {
None,
/// ELF file flags.
Elf {
/// `os_abi` field in the ELF file header.
os_abi: u8,
/// `e_flags` field in the ELF file header.
e_flags: u32,
},
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 @@ -419,6 +419,7 @@ where

fn flags(&self) -> FileFlags {
FileFlags::Elf {
os_abi: self.header.e_ident().os_abi,
e_flags: self.header.e_flags(self.endian),
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/write/elf/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,13 @@ impl<'a> Object<'a> {
)));
}
};
let e_flags = if let FileFlags::Elf { e_flags } = self.flags {
e_flags
let (os_abi, e_flags) = if let FileFlags::Elf { os_abi, e_flags } = self.flags {
(os_abi, e_flags)
} else {
0
(elf::ELFOSABI_NONE, 0)
};
writer.write_file_header(&FileHeader {
os_abi: elf::ELFOSABI_NONE,
os_abi,
abi_version: 0,
e_type,
e_machine,
Expand Down

0 comments on commit 79e9579

Please sign in to comment.