Struct Header

Source
#[repr(C)]
pub struct Header<Addr: Copy> {
Show 14 fields pub ident: HeaderIdent, pub file_type: FileType, pub machine: Machine, pub version: u32, pub entry_point: Addr, pub program_header_offset: Addr, pub section_header_offset: Addr, pub flags: u32, pub header_size: u16, pub program_header_size: u16, pub program_header_count: u16, pub section_header_size: u16, pub section_header_count: u16, pub section_names_index: u16,
}
Expand description

File header for an ELF file with a specific address size.

Fields§

§ident: HeaderIdent

Header common to all ELF variants.

§file_type: FileType

Distinguishes executables, libraries, etc.

§machine: Machine

CPU architecture

§version: u32

ELF format version

§entry_point: Addr

Virtual address of executable entry point. Zero if not present.

§program_header_offset: Addr

File offset to the array of program section headers which control executable loading. Zero if not present.

§section_header_offset: Addr

File offset to the array of section header which control linking. Zero if not present.

§flags: u32

CPU architecture-specific flags.

§header_size: u16

Size in bytes of this header. May be longer than the structure in code.

§program_header_size: u16

Size in bytes of of each program segment header. May be longer than the structure in code.

§program_header_count: u16

Number of program segment headers.

§section_header_size: u16

Size in bytes of each section header. May be longer than the structure in code.

§section_header_count: u16

Number of section headers.

§section_names_index: u16

Index of the section header which contains the list of section names.

Implementations§

Source§

impl<Addr: Copy> Header<Addr>

Source

pub const VERSION: u32 = 1u32

Expected value of the version field.

Source

pub fn verify_native(&self)

Checks that the header represents a valid ELF file for the current platform, and panics otherwise

§Panics

Panics when the header is not valid for the current platform.

Trait Implementations§

Source§

impl<Addr: Clone + Copy> Clone for Header<Addr>

Source§

fn clone(&self) -> Header<Addr>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Addr: Debug + Copy> Debug for Header<Addr>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Addr: Default + Copy> Default for Header<Addr>

Source§

fn default() -> Header<Addr>

Returns the “default value” for a type. Read more
Source§

impl<Addr: PartialEq + Copy> PartialEq for Header<Addr>

Source§

fn eq(&self, other: &Header<Addr>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Addr: Copy + Copy> Copy for Header<Addr>

Source§

impl<Addr: Eq + Copy> Eq for Header<Addr>

Source§

impl<Addr: Copy> StructuralPartialEq for Header<Addr>

Auto Trait Implementations§

§

impl<Addr> Freeze for Header<Addr>
where Addr: Freeze,

§

impl<Addr> RefUnwindSafe for Header<Addr>
where Addr: RefUnwindSafe,

§

impl<Addr> Send for Header<Addr>
where Addr: Send,

§

impl<Addr> Sync for Header<Addr>
where Addr: Sync,

§

impl<Addr> Unpin for Header<Addr>
where Addr: Unpin,

§

impl<Addr> UnwindSafe for Header<Addr>
where Addr: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.