pub struct Section {
pub name_offset: u32,
pub kind: SectionKind,
pub flags: SectionFlags,
pub virtual_address: u64,
pub offset: u64,
pub size: u64,
pub link: u32,
pub info: u32,
pub align: u64,
pub entry_len: u64,
}Expand description
Section.
Dynamic loader maps sections into virtual address space of a program as part of segments. Usually sections are part of segments, however, some section types exist on their own.
Fields§
§name_offset: u32Offset of the section name in the section that stores section names.
You can find the index of this section via
Header::section_names_index.
kind: SectionKindSection type.
flags: SectionFlagsSection flags.
virtual_address: u64Virtual address (in-memory offset).
offset: u64In-file offset.
size: u64Section size.
link: u32Optional index of the related section.
info: u32Extra information.
Depends on the section type.
align: u64Alignment.
Only virtual address has alignment constraints.
entry_len: u64The size of the entry in the references table.
Only relevant for sections that reference tables.
Implementations§
Source§impl Section
impl Section
Sourcepub fn read_content<R: ElfRead + ElfSeek, T: BlockRead>(
&self,
reader: &mut R,
class: Class,
byte_order: ByteOrder,
) -> Result<T, Error>
pub fn read_content<R: ElfRead + ElfSeek, T: BlockRead>( &self, reader: &mut R, class: Class, byte_order: ByteOrder, ) -> Result<T, Error>
Read section contents as bytes.
Sourcepub fn write_content<W: ElfWrite + ElfSeek, T: BlockWrite + ?Sized>(
&self,
writer: &mut W,
class: Class,
byte_order: ByteOrder,
content: &T,
) -> Result<(), Error>
pub fn write_content<W: ElfWrite + ElfSeek, T: BlockWrite + ?Sized>( &self, writer: &mut W, class: Class, byte_order: ByteOrder, content: &T, ) -> Result<(), Error>
Write section contents.
Sourcepub fn clear_content<W: ElfWrite + ElfSeek>(
&self,
writer: &mut W,
) -> Result<(), Error>
pub fn clear_content<W: ElfWrite + ElfSeek>( &self, writer: &mut W, ) -> Result<(), Error>
Zero out the entry’s content.
Sourcepub const fn virtual_address_range(&self) -> Range<u64>
pub const fn virtual_address_range(&self) -> Range<u64>
Virtual address range.
Sourcepub const fn file_offset_range(&self) -> Range<u64>
pub const fn file_offset_range(&self) -> Range<u64>
In-file location of the segment.