Type Alias object::build::elf::Segments

source ·
pub type Segments<'data> = Table<Segment<'data>>;
Expand description

A segment table.

Aliased Type§

struct Segments<'data>(/* private fields */);

Implementations§

source§

impl<'data> Segments<'data>

source

pub fn add(&mut self) -> &mut Segment<'data>

Add a new segment to the table.

source

pub fn find_load_segment_from_offset( &self, offset: u64 ) -> Option<&Segment<'data>>

Find a PT_LOAD segment containing the given offset.

source

pub fn add_load_segment( &mut self, flags: u32, align: u64 ) -> &mut Segment<'data>

Add a new PT_LOAD segment to the table.

The file offset and address will be derived from the current maximum for any segment. The address will be chosen so that p_paddr % align == p_offset % align. You may wish to use Builder::load_align for the alignment.

source

pub fn copy(&mut self, id: SegmentId) -> &mut Segment<'data>

Add a copy of a segment to the table.

This will copy the segment type, flags and alignment.

Additionally, if the segment type is PT_LOAD, then the file offset and address will be set as in add_load_segment.