Trait object::read::elf::SectionHeader [−][src]
pub trait SectionHeader: Debug + Pod {
type Elf: FileHeader<SectionHeader = Self, Endian = Self::Endian, Word = Self::Word>;
type Word: Into<u64>;
type Endian: Endian;
Show 20 methods
fn sh_name(&self, endian: Self::Endian) -> u32;
fn sh_type(&self, endian: Self::Endian) -> u32;
fn sh_flags(&self, endian: Self::Endian) -> Self::Word;
fn sh_addr(&self, endian: Self::Endian) -> Self::Word;
fn sh_offset(&self, endian: Self::Endian) -> Self::Word;
fn sh_size(&self, endian: Self::Endian) -> Self::Word;
fn sh_link(&self, endian: Self::Endian) -> u32;
fn sh_info(&self, endian: Self::Endian) -> u32;
fn sh_addralign(&self, endian: Self::Endian) -> Self::Word;
fn sh_entsize(&self, endian: Self::Endian) -> Self::Word;
fn name<'data>(
&self,
endian: Self::Endian,
strings: StringTable<'data>
) -> Result<&'data [u8]> { ... }
fn file_range(&self, endian: Self::Endian) -> Option<(u64, u64)> { ... }
fn data<'data, R: ReadRef<'data>>(
&self,
endian: Self::Endian,
data: R
) -> Result<&'data [u8], ()> { ... }
fn data_as_array<'data, T: Pod, R: ReadRef<'data>>(
&self,
endian: Self::Endian,
data: R
) -> Result<&'data [T], ()> { ... }
fn symbols<'data, R: ReadRef<'data>>(
&self,
endian: Self::Endian,
data: R,
sections: &SectionTable<'_, Self::Elf>,
section_index: usize
) -> Result<Option<SymbolTable<'data, Self::Elf>>> { ... }
fn rel<'data, R: ReadRef<'data>>(
&self,
endian: Self::Endian,
data: R
) -> Result<Option<&'data [<Self::Elf as FileHeader>::Rel]>> { ... }
fn rela<'data, R: ReadRef<'data>>(
&self,
endian: Self::Endian,
data: R
) -> Result<Option<&'data [<Self::Elf as FileHeader>::Rela]>> { ... }
fn relocation_symbols<'data, R: ReadRef<'data>>(
&self,
endian: Self::Endian,
data: R,
sections: &SectionTable<'data, Self::Elf>
) -> Result<SymbolTable<'data, Self::Elf>> { ... }
fn notes<'data, R: ReadRef<'data>>(
&self,
endian: Self::Endian,
data: R
) -> Result<Option<NoteIterator<'data, Self::Elf>>> { ... }
fn group<'data, R: ReadRef<'data>>(
&self,
endian: Self::Endian,
data: R
) -> Result<Option<(u32, &'data [U32Bytes<Self::Endian>])>> { ... }
}
Expand description
A trait for generic access to SectionHeader32
and SectionHeader64
.
Associated Types
type Elf: FileHeader<SectionHeader = Self, Endian = Self::Endian, Word = Self::Word>
Required methods
fn sh_addralign(&self, endian: Self::Endian) -> Self::Word
fn sh_entsize(&self, endian: Self::Endian) -> Self::Word
Provided methods
Parse the section name from the string table.
Return the offset and size of the section in the file.
Returns None
for sections that have no data in the file.
Return the section data.
Returns Ok(&[])
if the section has no data.
Returns Err
for invalid values.
fn data_as_array<'data, T: Pod, R: ReadRef<'data>>(
&self,
endian: Self::Endian,
data: R
) -> Result<&'data [T], ()>
fn data_as_array<'data, T: Pod, R: ReadRef<'data>>(
&self,
endian: Self::Endian,
data: R
) -> Result<&'data [T], ()>
Return the section data as a slice of the given type.
Allows padding at the end of the data.
Returns Ok(&[])
if the section has no data.
Returns Err
for invalid values, including bad alignment.
Return the symbols in the section.
Also finds the corresponding string table in sections
.
section_index
must be the 0-based index of this section, and is used
to find the corresponding extended section index table in sections
.
Returns Ok(None)
if the section does not contain symbols.
Returns Err
for invalid values.
Return the Elf::Rel
entries in the section.
Returns Ok(None)
if the section does not contain relocations.
Returns Err
for invalid values.
Return the Elf::Rela
entries in the section.
Returns Ok(None)
if the section does not contain relocations.
Returns Err
for invalid values.
fn relocation_symbols<'data, R: ReadRef<'data>>(
&self,
endian: Self::Endian,
data: R,
sections: &SectionTable<'data, Self::Elf>
) -> Result<SymbolTable<'data, Self::Elf>>
fn relocation_symbols<'data, R: ReadRef<'data>>(
&self,
endian: Self::Endian,
data: R,
sections: &SectionTable<'data, Self::Elf>
) -> Result<SymbolTable<'data, Self::Elf>>
Return the symbol table for a relocation section.
Returns Err
for invalid values, including if the section does not contain
relocations.
Return a note iterator for the section data.
Returns Ok(None)
if the section does not contain notes.
Returns Err
for invalid values.
Return the contents of a group section.
The first value is a GRP_*
value, and the remaining values
are section indices.
Returns Ok(None)
if the section does not define a group.
Returns Err
for invalid values.