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

This commit is contained in:
Christopher Cole 2023-01-26 13:18:58 -08:00
parent 840dd99239
commit 04242deb6f
No known key found for this signature in database
GPG Key ID: 0AC856975983E9DB

View File

@ -5,6 +5,36 @@ use crate::parse::{ParseAt, ParseError, ParsingTable};
pub type SegmentTable<'data, E> = ParsingTable<'data, E, ProgramHeader>;
/// C-style 32-bit ELF Program Segment Header definition
///
/// These C-style definitions are for users who want to implement their own ELF manipulation logic.
#[repr(C)]
pub struct Elf32_Phdr {
pub p_type: u32,
pub p_offset: u32,
pub p_vaddr: u32,
pub p_paddr: u32,
pub p_filesz: u32,
pub p_memsz: u32,
pub p_flags: u32,
pub p_align: u32,
}
/// C-style 64-bit ELF Program Segment Header definition
///
/// These C-style definitions are for users who want to implement their own ELF manipulation logic.
#[repr(C)]
pub struct Elf64_Phdr {
pub p_type: u32,
pub p_flags: u32,
pub p_offset: u64,
pub p_vaddr: u64,
pub p_paddr: u64,
pub p_filesz: u64,
pub p_memsz: u64,
pub p_align: u64,
}
/// Encapsulates the contents of an ELF Program Header
///
/// The program header table is an array of program header structures describing