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
impl Directives
Sourcepub const fn of(format: ObjectFormat) -> Directives
pub const fn of(format: ObjectFormat) -> Directives
The directives that go with that object format.
Sourcepub const fn symbol(self) -> &'static str
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.
Sourcepub const fn local(self) -> &'static str
pub const fn local(self) -> &'static str
What goes in front of a label that belongs to one function and leaves no symbol behind.
Sourcepub fn open(self, out: &mut String, name: &str)
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.
Sourcepub fn section(self, out: &mut String, place: &Place)
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.
Sourcepub fn variable(self, out: &mut String, var: &Variable) -> bool
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.
Sourcepub fn close(self, out: &mut String, name: &str)
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.
Trait Implementations§
Source§impl Clone for Directives
impl Clone for Directives
Source§fn clone(&self) -> Directives
fn clone(&self) -> Directives
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Directives
Source§impl Debug for Directives
impl Debug for Directives
impl Eq for Directives
Source§impl PartialEq for Directives
impl PartialEq for Directives
impl StructuralPartialEq for Directives
Auto Trait Implementations§
impl Freeze for Directives
impl RefUnwindSafe for Directives
impl Send for Directives
impl Sync for Directives
impl Unpin for Directives
impl UnsafeUnpin for Directives
impl UnwindSafe for Directives
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.