Phdr

Struct Phdr 

Source
#[repr(C)]
pub struct Phdr { pub type_: PType, pub p_flags: PFlags, pub p_offset: u64, pub p_vaddr: u64, pub p_paddr: u64, pub p_filesz: u64, pub p_memsz: u64, pub p_align: u64, }
Expand description

ELF program header for 64-bit binaries.

Each Phdr entry describes a segment or other information needed for execution.

Fields§

§type_: PType

Segment type.

§p_flags: PFlags

Segment permissions.

§p_offset: u64

Offset in the file where the segment starts.

§p_vaddr: u64

Virtual address where the segment should be mapped in memory.

§p_paddr: u64

Physical address (not commonly used in modern OSes).

§p_filesz: u64

Size of the segment in the file.

§p_memsz: u64

Size of the segment in memory.

§p_align: u64

Alignment of the segment (must be a power of two).

Implementations§

Source§

impl Phdr

Source

pub fn permission(&self) -> Permission

Get a ELF segment permissions (PFlags) of this Phdr in forms of memory permissions (Permission).

This function translates the permission flags of phdr into the corresponding memory protection flags used by the system and return it. The conversion ensures that the memory is properly set up according to the ELF segment’s requirements.

§Returns
  • A Permission value representing the phdr’s memory permissions.

Trait Implementations§

Source§

impl Clone for Phdr

Source§

fn clone(&self) -> Phdr

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Phdr

Source§

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

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

impl Copy for Phdr

Auto Trait Implementations§

§

impl Freeze for Phdr

§

impl RefUnwindSafe for Phdr

§

impl Send for Phdr

§

impl Sync for Phdr

§

impl Unpin for Phdr

§

impl UnwindSafe for Phdr

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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

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

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.