Skip to main content

Global

Struct Global 

Source
pub struct Global {
    pub name: Symbol,
    pub size: u64,
    pub align: u32,
    pub linkage: Linkage,
    pub visibility: Visibility,
    pub tls: Option<TlsModel>,
    pub constant: bool,
    pub section: Option<Symbol>,
    pub init: Option<DataList>,
}
Expand description

A global variable.

A size and an alignment and an image, which is what the object writer needs. init is None for a declaration of something defined in another object, which is the only thing that distinguishes the two.

Fields§

§name: Symbol

The name it is reached by.

§size: u64

Its size in bytes, which the image must add up to.

§align: u32

Its required alignment in bytes, always a power of two.

§linkage: Linkage

How the linker sees it.

§visibility: Visibility

How the dynamic linker sees it.

§tls: Option<TlsModel>

The model to reach it by if it is thread-local, and None if it is not.

§constant: bool

Whether writing through a pointer to it is undefined, which is what puts it in .rodata rather than .data.

§section: Option<Symbol>

The section to put it in, from __attribute__((section(...))), or None to let the object writer choose from the other fields.

§init: Option<DataList>

Its initial image, or None if it is only declared here.

Implementations§

Source§

impl Global

Source

pub fn new(name: Symbol, size: u64, align: u32) -> Self

A definition-less global of that size and alignment, external and not thread-local.

Source

pub fn is_declaration(&self) -> bool

Whether this only says the variable exists somewhere.

Trait Implementations§

Source§

impl Clone for Global

Source§

fn clone(&self) -> Global

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Global

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = !

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>,

Source§

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.