Struct object::build::elf::Section

source ·
pub struct Section<'data> {
Show 13 fields pub delete: bool, pub name: ByteString<'data>, pub sh_type: u32, pub sh_flags: u64, pub sh_addr: u64, pub sh_offset: u64, pub sh_size: u64, pub sh_link_section: Option<SectionId>, pub sh_info: u32, pub sh_info_section: Option<SectionId>, pub sh_addralign: u64, pub sh_entsize: u64, pub data: SectionData<'data>, /* private fields */
}
Expand description

A section in Sections.

This corresponds to elf::SectionHeader32 or elf::SectionHeader64.

Fields§

§delete: bool

Ignore this section when writing the ELF file.

§name: ByteString<'data>

The name of the section.

This is automatically added to the section header string table, and the resulting string table offset is used to set the sh_name field in the ELF section header.

§sh_type: u32

The sh_type field in the ELF section header.

One of the SHT_* constants.

§sh_flags: u64

The sh_flags field in the ELF section header.

A combination of the SHF_* constants.

§sh_addr: u64

The sh_addr field in the ELF section header.

§sh_offset: u64

The sh_offset field in the ELF section header.

This is the file offset of the data in the section. Writing will fail if the data cannot be placed at this offset.

This is only used for sections that have SHF_ALLOC set. For other sections, the section data is written at the next available offset.

§sh_size: u64

The sh_size field in the ELF section header.

This size is not used when writing. The size of the data field is used instead.

§sh_link_section: Option<SectionId>

The ID of the section linked to by the sh_link field in the ELF section header.

§sh_info: u32

The sh_info field in the ELF section header.

Only used if sh_info_section is None.

§sh_info_section: Option<SectionId>

The ID of the section linked to by the sh_info field in the ELF section header.

§sh_addralign: u64

The sh_addralign field in the ELF section header.

§sh_entsize: u64

The sh_entsize field in the ELF section header.

§data: SectionData<'data>

The section data.

Implementations§

source§

impl<'data> Section<'data>

source

pub fn id(&self) -> SectionId

The ID used for referring to this section.

source

pub fn is_alloc(&self) -> bool

Returns true if the section flags include SHF_ALLOC.

source

pub fn p_flags(&self) -> u32

Return the segment permission flags that are equivalent to the section flags.

Trait Implementations§

source§

impl<'data> Debug for Section<'data>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'data> Item for Section<'data>

§

type Id = SectionId

The type of identifier for the item.
source§

fn is_deleted(&self) -> bool

Return True if the item is deleted.

Auto Trait Implementations§

§

impl<'data> Freeze for Section<'data>

§

impl<'data> RefUnwindSafe for Section<'data>

§

impl<'data> Send for Section<'data>

§

impl<'data> Sync for Section<'data>

§

impl<'data> Unpin for Section<'data>

§

impl<'data> UnwindSafe for Section<'data>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.