Skip to main content

Directives

Enum Directives 

Source
pub enum Directives {
    Elf,
    MachO,
    Coff,
}
Expand description

The directives one object format wraps a function in.

Variants§

§

Elf

ELF, which is Linux and the freestanding targets.

§

MachO

Mach-O, which is Apple’s.

§

Coff

COFF, which is Windows.

Implementations§

Source§

impl Directives

Source

pub const fn of(format: ObjectFormat) -> Directives

The directives that go with that object format.

Source

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

What goes in front of a C name to make the name the linker sees.

Mach-O keeps the underscore that every Unix linker once had, so main in C is _main in the object, and a listing that leaves it off refers to a symbol nothing defines.

Source

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

What goes in front of a label that belongs to one function and leaves no symbol behind.

Source

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

The directive that opens the section code goes in.

Source

pub fn open(self, out: &mut String, name: &str)

What is said about a function before its first instruction.

Every function is global, because a machine function does not carry the linkage the C did and nothing below the driver could ask. That is wrong for a static function and is the reason -S output is a thing to read rather than a thing to link, until the object writer gives the machine IR somewhere to keep it.

Source

pub fn section(self, out: &mut String, place: &Place)

The directive that opens the section a variable goes in.

The three formats disagree about the names and about how much has to be said. ELF and COFF have a directive per section that every assembler knows, and both want the flags spelled out for a section the program named, since nothing else says whether it may be written to. Mach-O has one directive and a segment in front of every section name.

Source

pub fn variable(self, out: &mut String, var: &Variable) -> bool

What is said about a variable before its image, and whether an image follows.

Two kinds of variable are one directive rather than a section, a label and bytes. A tentative definition is a request to the linker for that much zeroed space on every format, and on Mach-O so is a variable whose image is all zeros, because the section that would hold it is one nothing may write bytes into.

Source

pub fn close(self, out: &mut String, name: &str)

What is said about a function after its last instruction.

The size, on the format that has one. It is written as the distance from the label to here rather than as a number, because the assembler is the one that knows how long an instruction turned out to be and this file is what it is about to find out from.

Source

pub fn end(self, out: &mut String)

What is said once, after every function.

Trait Implementations§

Source§

impl Clone for Directives

Source§

fn clone(&self) -> Directives

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 Copy for Directives

Source§

impl Debug for Directives

Source§

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

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

impl Eq for Directives

Source§

impl PartialEq for Directives

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Directives

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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, !>

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.