pub enum SectionType {
    Text,
    Rodata,
    Data,
    Bss,
    TlsData,
    TlsBss,
    Cls,
    GccExceptTable,
    EhFrame,
}
Expand description

The possible types of sections that can be loaded from a crate object file.

Variants§

§

Text

A text section contains executable code, i.e., functions.

§

Rodata

An rodata section contains read-only data, i.e., constants.

§

Data

A data section contains data that is both readable and writable, i.e., static variables.

§

Bss

A bss section is just like a data section, but is automatically initialized to all zeroes at load time.

§

TlsData

A .tdata section is a read-only section that holds the initial data “image” for a thread-local storage (TLS) area.

§

TlsBss

A .tbss section is a read-only section that holds all-zero data for a thread-local storage (TLS) area. This is is effectively an empty placeholder: the all-zero data section doesn’t actually exist in memory.

§

Cls

A .cls section is a read-only section that holds the initial data “image” for a CPU-local (CLS) area.

§

GccExceptTable

A .gcc_except_table section contains landing pads for exception handling, comprising the LSDA (Language Specific Data Area), which is effectively used to determine when we should stop the stack unwinding process (e.g., “catching” an exception).

Blog post from author of gold linker: https://www.airs.com/blog/archives/464

Mailing list discussion here: https://gcc.gnu.org/ml/gcc-help/2010-09/msg00116.html

Here is a sample repository parsing this section: https://github.com/nest-leonlee/gcc_except_table

§

EhFrame

The .eh_frame section contains information about stack unwinding and destructor functions that should be called when traversing up the stack for cleanup.

Blog post from author of gold linker: https://www.airs.com/blog/archives/460 Some documentation here: https://gcc.gnu.org/wiki/Dwarf2EHNewbiesHowto

Implementations§

source§

impl SectionType

source

pub const fn name(&self) -> &'static str

Returns the const &str name of this SectionType.

source

pub fn is_data_or_bss(&self) -> bool

Returns true if Data or Bss, otherwise false.

source

pub fn is_tls(&self) -> bool

Returns true if TlsData or TlsBss, otherwise false.

Trait Implementations§

source§

impl Clone for SectionType

source§

fn clone(&self) -> SectionType

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SectionType

source§

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

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

impl<'de> Deserialize<'de> for SectionType

source§

fn deserialize<__D>( __deserializer: __D ) -> Result<SectionType, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq<SectionType> for SectionType

source§

fn eq(&self, other: &SectionType) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for SectionType

source§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Copy for SectionType

source§

impl StructuralPartialEq for SectionType

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,