pub struct SectionTable<'data, Elf: FileHeader, R = &'data [u8]> where
R: ReadRef<'data>, { /* private fields */ }
Expand description
The table of section headers in an ELF file.
Also includes the string table used for the section names.
Implementations
sourceimpl<'data, Elf: FileHeader, R: ReadRef<'data>> SectionTable<'data, Elf, R>
impl<'data, Elf: FileHeader, R: ReadRef<'data>> SectionTable<'data, Elf, R>
sourcepub fn new(
sections: &'data [Elf::SectionHeader],
strings: StringTable<'data, R>
) -> Self
pub fn new(
sections: &'data [Elf::SectionHeader],
strings: StringTable<'data, R>
) -> Self
Create a new section table.
sourcepub fn iter(&self) -> Iter<'data, Elf::SectionHeader>
pub fn iter(&self) -> Iter<'data, Elf::SectionHeader>
Iterate over the section headers.
sourcepub fn section(&self, index: SectionIndex) -> Result<&'data Elf::SectionHeader>
pub fn section(&self, index: SectionIndex) -> Result<&'data Elf::SectionHeader>
Return the section header at the given index.
sourcepub fn section_by_name(
&self,
endian: Elf::Endian,
name: &[u8]
) -> Option<(usize, &'data Elf::SectionHeader)>
pub fn section_by_name(
&self,
endian: Elf::Endian,
name: &[u8]
) -> Option<(usize, &'data Elf::SectionHeader)>
Return the section header with the given name.
Ignores sections with invalid names.
sourcepub fn section_name(
&self,
endian: Elf::Endian,
section: &'data Elf::SectionHeader
) -> Result<&'data [u8]>
pub fn section_name(
&self,
endian: Elf::Endian,
section: &'data Elf::SectionHeader
) -> Result<&'data [u8]>
Return the section name for the given section header.
sourcepub fn strings(
&self,
endian: Elf::Endian,
data: R,
index: SectionIndex
) -> Result<StringTable<'data, R>>
pub fn strings(
&self,
endian: Elf::Endian,
data: R,
index: SectionIndex
) -> Result<StringTable<'data, R>>
Return the string table at the given section index.
Returns an error if the section is not a string table.
sourcepub fn symbols(
&self,
endian: Elf::Endian,
data: R,
sh_type: u32
) -> Result<SymbolTable<'data, Elf, R>>
pub fn symbols(
&self,
endian: Elf::Endian,
data: R,
sh_type: u32
) -> Result<SymbolTable<'data, Elf, R>>
Return the symbol table of the given section type.
Returns an empty symbol table if the symbol table does not exist.
sourcepub fn symbol_table_by_index(
&self,
endian: Elf::Endian,
data: R,
index: SectionIndex
) -> Result<SymbolTable<'data, Elf, R>>
pub fn symbol_table_by_index(
&self,
endian: Elf::Endian,
data: R,
index: SectionIndex
) -> Result<SymbolTable<'data, Elf, R>>
Return the symbol table at the given section index.
Returns an error if the section is not a symbol table.
sourcepub fn relocation_sections(
&self,
endian: Elf::Endian,
symbol_section: SectionIndex
) -> Result<RelocationSections>
pub fn relocation_sections(
&self,
endian: Elf::Endian,
symbol_section: SectionIndex
) -> Result<RelocationSections>
Create a mapping from section index to associated relocation sections.
sourcepub fn dynamic(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<(&'data [Elf::Dyn], SectionIndex)>>
pub fn dynamic(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<(&'data [Elf::Dyn], SectionIndex)>>
Return the contents of a dynamic section.
Also returns the linked string table index.
Returns Ok(None)
if there is no SHT_DYNAMIC
section.
Returns Err
for invalid values.
sourcepub fn hash_header(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<&'data HashHeader<Elf::Endian>>>
pub fn hash_header(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<&'data HashHeader<Elf::Endian>>>
Return the header of a SysV hash section.
Returns Ok(None)
if there is no SysV GNU hash section.
Returns Err
for invalid values.
sourcepub fn hash(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<(HashTable<'data, Elf>, SectionIndex)>>
pub fn hash(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<(HashTable<'data, Elf>, SectionIndex)>>
Return the contents of a SysV hash section.
Also returns the linked symbol table index.
Returns Ok(None)
if there is no SysV hash section.
Returns Err
for invalid values.
sourcepub fn gnu_hash_header(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<&'data GnuHashHeader<Elf::Endian>>>
pub fn gnu_hash_header(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<&'data GnuHashHeader<Elf::Endian>>>
Return the header of a GNU hash section.
Returns Ok(None)
if there is no GNU hash section.
Returns Err
for invalid values.
sourcepub fn gnu_hash(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<(GnuHashTable<'data, Elf>, SectionIndex)>>
pub fn gnu_hash(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<(GnuHashTable<'data, Elf>, SectionIndex)>>
Return the contents of a GNU hash section.
Also returns the linked symbol table index.
Returns Ok(None)
if there is no GNU hash section.
Returns Err
for invalid values.
sourcepub fn gnu_versym(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<(&'data [Versym<Elf::Endian>], SectionIndex)>>
pub fn gnu_versym(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<(&'data [Versym<Elf::Endian>], SectionIndex)>>
Return the contents of a SHT_GNU_VERSYM
section.
Also returns the linked symbol table index.
Returns Ok(None)
if there is no SHT_GNU_VERSYM
section.
Returns Err
for invalid values.
sourcepub fn gnu_verdef(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<(VerdefIterator<'data, Elf>, SectionIndex)>>
pub fn gnu_verdef(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<(VerdefIterator<'data, Elf>, SectionIndex)>>
Return the contents of a SHT_GNU_VERDEF
section.
Also returns the linked string table index.
Returns Ok(None)
if there is no SHT_GNU_VERDEF
section.
Returns Err
for invalid values.
sourcepub fn gnu_verneed(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<(VerneedIterator<'data, Elf>, SectionIndex)>>
pub fn gnu_verneed(
&self,
endian: Elf::Endian,
data: R
) -> Result<Option<(VerneedIterator<'data, Elf>, SectionIndex)>>
Return the contents of a SHT_GNU_VERNEED
section.
Also returns the linked string table index.
Returns Ok(None)
if there is no SHT_GNU_VERNEED
section.
Returns Err
for invalid values.
Trait Implementations
sourceimpl<'data, Elf: Clone + FileHeader, R: Clone> Clone for SectionTable<'data, Elf, R> where
R: ReadRef<'data>,
Elf::SectionHeader: Clone,
impl<'data, Elf: Clone + FileHeader, R: Clone> Clone for SectionTable<'data, Elf, R> where
R: ReadRef<'data>,
Elf::SectionHeader: Clone,
sourcefn clone(&self) -> SectionTable<'data, Elf, R>
fn clone(&self) -> SectionTable<'data, Elf, R>
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<'data, Elf: Debug + FileHeader, R: Debug> Debug for SectionTable<'data, Elf, R> where
R: ReadRef<'data>,
Elf::SectionHeader: Debug,
impl<'data, Elf: Debug + FileHeader, R: Debug> Debug for SectionTable<'data, Elf, R> where
R: ReadRef<'data>,
Elf::SectionHeader: Debug,
sourceimpl<'data, Elf: Default + FileHeader, R: Default> Default for SectionTable<'data, Elf, R> where
R: ReadRef<'data>,
Elf::SectionHeader: Default,
impl<'data, Elf: Default + FileHeader, R: Default> Default for SectionTable<'data, Elf, R> where
R: ReadRef<'data>,
Elf::SectionHeader: Default,
sourcefn default() -> SectionTable<'data, Elf, R>
fn default() -> SectionTable<'data, Elf, R>
Returns the “default value” for a type. Read more
impl<'data, Elf: Copy + FileHeader, R: Copy> Copy for SectionTable<'data, Elf, R> where
R: ReadRef<'data>,
Elf::SectionHeader: Copy,
Auto Trait Implementations
impl<'data, Elf, R> RefUnwindSafe for SectionTable<'data, Elf, R> where
R: RefUnwindSafe,
<Elf as FileHeader>::SectionHeader: RefUnwindSafe,
impl<'data, Elf, R> Send for SectionTable<'data, Elf, R> where
R: Send,
<Elf as FileHeader>::SectionHeader: Sync,
impl<'data, Elf, R> Sync for SectionTable<'data, Elf, R> where
R: Sync,
<Elf as FileHeader>::SectionHeader: Sync,
impl<'data, Elf, R> Unpin for SectionTable<'data, Elf, R> where
R: Unpin,
impl<'data, Elf, R> UnwindSafe for SectionTable<'data, Elf, R> where
R: UnwindSafe,
<Elf as FileHeader>::SectionHeader: RefUnwindSafe,
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more