#[repr(C)]
pub struct SectionHeader { pub sh_name: u32, pub sh_type: u32, pub sh_flags: u32, pub sh_addr: u32, pub sh_offset: u32, pub sh_size: u32, pub sh_link: u32, pub sh_info: u32, pub sh_addralign: u32, pub sh_entsize: u32, }
Expand description

Section Headers are typically used by humans and static linkers for additional information or how to relocate the object

NOTE section headers are strippable from a binary without any loss of portability/executability; do not rely on them being there!

Fields§

§sh_name: u32

Section name (string tbl index)

§sh_type: u32

Section type

§sh_flags: u32

Section flags

§sh_addr: u32

Section virtual addr at execution

§sh_offset: u32

Section file offset

§sh_size: u32

Section size in bytes

§sh_link: u32

Link to another section

§sh_info: u32

Additional section information

§sh_addralign: u32

Section alignment

§sh_entsize: u32

Entry size if section holds table

Implementations§

source§

impl SectionHeader

source

pub fn from_bytes(bytes: &[u8], shnum: usize) -> Vec<SectionHeader>

source

pub fn from_fd( fd: &mut File, offset: u64, shnum: usize ) -> Result<Vec<SectionHeader>>

Trait Implementations§

source§

impl Clone for SectionHeader

source§

fn clone(&self) -> SectionHeader

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 Debug for SectionHeader

source§

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

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

impl Default for SectionHeader

source§

fn default() -> SectionHeader

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

impl From<SectionHeader> for ElfSectionHeader

source§

fn from(sh: SectionHeader) -> Self

Converts to this type from the input type.
source§

impl From<SectionHeader> for SectionHeader

source§

fn from(sh: ElfSectionHeader) -> Self

Converts to this type from the input type.
source§

impl PartialEq for SectionHeader

source§

fn eq(&self, other: &SectionHeader) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Plain for SectionHeader

source§

fn from_bytes(bytes: &[u8]) -> Result<&Self, Error>
where Self: Sized,

source§

fn slice_from_bytes(bytes: &[u8]) -> Result<&[Self], Error>
where Self: Sized,

source§

fn slice_from_bytes_len(bytes: &[u8], len: usize) -> Result<&[Self], Error>
where Self: Sized,

source§

fn from_mut_bytes(bytes: &mut [u8]) -> Result<&mut Self, Error>
where Self: Sized,

source§

fn slice_from_mut_bytes(bytes: &mut [u8]) -> Result<&mut [Self], Error>
where Self: Sized,

source§

fn slice_from_mut_bytes_len( bytes: &mut [u8], len: usize ) -> Result<&mut [Self], Error>
where Self: Sized,

source§

fn copy_from_bytes(&mut self, bytes: &[u8]) -> Result<(), Error>

source§

impl SizeWith<Endian> for SectionHeader

source§

impl<'a> TryFromCtx<'a, Endian> for SectionHeader
where SectionHeader: 'a,

§

type Error = Error

source§

fn try_from_ctx( src: &'a [u8], ctx: Endian ) -> Result<(Self, usize), Self::Error>

source§

impl<'a> TryIntoCtx<Endian> for &'a SectionHeader

§

type Error = Error

source§

fn try_into_ctx(self, dst: &mut [u8], ctx: Endian) -> Result<usize, Self::Error>

source§

impl TryIntoCtx<Endian> for SectionHeader

§

type Error = Error

source§

fn try_into_ctx(self, dst: &mut [u8], ctx: Endian) -> Result<usize, Self::Error>

source§

impl Copy for SectionHeader

source§

impl Eq for SectionHeader

source§

impl StructuralPartialEq for SectionHeader

Auto Trait Implementations§

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> 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

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

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

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

§

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>,

§

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.