Struct goblin::elf::section_header::SectionHeader
source · [−]pub struct SectionHeader {
pub sh_name: usize,
pub sh_type: u32,
pub sh_flags: u64,
pub sh_addr: u64,
pub sh_offset: u64,
pub sh_size: u64,
pub sh_link: u32,
pub sh_info: u32,
pub sh_addralign: u64,
pub sh_entsize: u64,
}
Expand description
A unified SectionHeader - convertable to and from 32-bit and 64-bit variants
Fields
sh_name: usize
Section name (string tbl index)
sh_type: u32
Section type
sh_flags: u64
Section flags
sh_addr: u64
Section virtual addr at execution
sh_offset: u64
Section file offset
sh_size: u64
Section size in bytes
sh_link: u32
Link to another section
sh_info: u32
Additional section information
sh_addralign: u64
Section alignment
sh_entsize: u64
Entry size if section holds table
Implementations
sourceimpl SectionHeader
impl SectionHeader
sourcepub fn size(ctx: Ctx) -> usize
pub fn size(ctx: Ctx) -> usize
Return the size of the underlying program header, given a container
pub fn new() -> Self
sourcepub fn file_range(&self) -> Option<Range<usize>>
pub fn file_range(&self) -> Option<Range<usize>>
Returns this section header’s file offset range, if the section occupies space in fhe file.
sourcepub fn parse(
bytes: &[u8],
offset: usize,
count: usize,
ctx: Ctx
) -> Result<Vec<SectionHeader>>
pub fn parse(
bytes: &[u8],
offset: usize,
count: usize,
ctx: Ctx
) -> Result<Vec<SectionHeader>>
Parse count
section headers from bytes
at offset
, using the given ctx
pub fn check_size(&self, size: usize) -> Result<()>
pub fn is_relocation(&self) -> bool
pub fn is_executable(&self) -> bool
pub fn is_writable(&self) -> bool
pub fn is_alloc(&self) -> bool
Trait Implementations
sourceimpl Clone for SectionHeader
impl Clone for SectionHeader
sourcefn clone(&self) -> SectionHeader
fn clone(&self) -> SectionHeader
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SectionHeader
impl Debug for SectionHeader
sourceimpl Default for SectionHeader
impl Default for SectionHeader
sourcefn default() -> SectionHeader
fn default() -> SectionHeader
Returns the “default value” for a type. Read more
sourceimpl From<SectionHeader> for ElfSectionHeader
impl From<SectionHeader> for ElfSectionHeader
sourcefn from(sh: SectionHeader) -> Self
fn from(sh: SectionHeader) -> Self
Converts to this type from the input type.
sourceimpl From<SectionHeader> for ElfSectionHeader
impl From<SectionHeader> for ElfSectionHeader
sourcefn from(sh: SectionHeader) -> Self
fn from(sh: SectionHeader) -> Self
Converts to this type from the input type.
sourceimpl From<SectionHeader> for SectionHeader
impl From<SectionHeader> for SectionHeader
sourcefn from(sh: ElfSectionHeader) -> Self
fn from(sh: ElfSectionHeader) -> Self
Converts to this type from the input type.
sourceimpl From<SectionHeader> for SectionHeader
impl From<SectionHeader> for SectionHeader
sourcefn from(sh: ElfSectionHeader) -> Self
fn from(sh: ElfSectionHeader) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<SectionHeader> for SectionHeader
impl PartialEq<SectionHeader> for SectionHeader
sourcefn eq(&self, other: &SectionHeader) -> bool
fn eq(&self, other: &SectionHeader) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SectionHeader) -> bool
fn ne(&self, other: &SectionHeader) -> bool
This method tests for !=
.
sourceimpl<'a> TryFromCtx<'a, Ctx, [u8]> for SectionHeader
impl<'a> TryFromCtx<'a, Ctx, [u8]> for SectionHeader
sourceimpl TryIntoCtx<Ctx, [u8]> for SectionHeader
impl TryIntoCtx<Ctx, [u8]> for SectionHeader
impl StructuralPartialEq for SectionHeader
Auto Trait Implementations
impl RefUnwindSafe for SectionHeader
impl Send for SectionHeader
impl Sync for SectionHeader
impl Unpin for SectionHeader
impl UnwindSafe for SectionHeader
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more