Add C-style definitions for Elf[32|64]_Ehdr

This commit is contained in:
Christopher Cole 2023-01-26 17:43:14 -08:00
parent e786ecfcf9
commit e6a1b963f6
No known key found for this signature in database
GPG Key ID: 0AC856975983E9DB

View File

@ -10,6 +10,48 @@ pub enum Class {
ELF64, ELF64,
} }
/// C-style 32-bit ELF File Header definition
///
/// These C-style definitions are for users who want to implement their own ELF manipulation logic.
#[repr(C)]
pub struct Elf32_Ehdr {
pub e_ident: [u8; abi::EI_NIDENT],
pub e_type: u16,
pub e_machine: u16,
pub e_version: u32,
pub e_entry: u32,
pub e_phoff: u32,
pub e_shoff: u32,
pub e_flags: u32,
pub e_ehsize: u16,
pub e_phentsize: u16,
pub e_phnum: u16,
pub e_shentsize: u16,
pub e_shnum: u16,
pub e_shstrndx: u16,
}
/// C-style 64-bit ELF File Header definition
///
/// These C-style definitions are for users who want to implement their own ELF manipulation logic.
#[repr(C)]
pub struct Elf64_Ehdr {
pub e_ident: [u8; abi::EI_NIDENT],
pub e_type: u16,
pub e_machine: u16,
pub e_version: u32,
pub e_entry: u64,
pub e_phoff: u64,
pub e_shoff: u64,
pub e_flags: u32,
pub e_ehsize: u16,
pub e_phentsize: u16,
pub e_phnum: u16,
pub e_shentsize: u16,
pub e_shnum: u16,
pub e_shstrndx: u16,
}
/// Encapsulates the contents of the ELF File Header /// Encapsulates the contents of the ELF File Header
/// ///
/// The ELF File Header starts off every ELF file and both identifies the /// The ELF File Header starts off every ELF file and both identifies the