Skip to main content

Invocation

Struct Invocation 

Source
pub struct Invocation<'a> {
    pub inputs: &'a [Item],
    pub output: Option<&'a Path>,
    pub mode: LinkMode,
    pub search: &'a [PathBuf],
    pub no_startfiles: bool,
    pub no_defaultlibs: bool,
    pub no_builtins_lib: bool,
    pub builtins: Option<&'a Path>,
    pub export_dynamic: bool,
    pub strip: bool,
    pub gui: bool,
    pub unicode: bool,
}
Expand description

What the driver knows that the line needs, beyond the target and the sysroot.

A struct because most of it is empty in the common case, and because a function with nine positional parameters of which seven are usually a default is a function somebody calls wrong.

Fields§

§inputs: &'a [Item]

The objects and libraries, in the order they were written.

§output: Option<&'a Path>

-o. Empty means the linker’s own default, which is what a caller testing a line wants.

§mode: LinkMode

How the program is linked, which decides the start file and four of the flags.

§search: &'a [PathBuf]

-L, in the order given. The user’s own, and they come before ours, because somebody who passed -L meant it to win.

§no_startfiles: bool

-nostartfiles, which leaves crt1.o, crti.o and crtn.o off.

§no_defaultlibs: bool

-nodefaultlibs, which leaves the libc and our runtime off.

§no_builtins_lib: bool

-fno-builtins-lib, which leaves our own runtime off and keeps the libc.

It means something narrower here than it does on a native link. There it leaves ours off so that the machine’s libgcc answers for the wide arithmetic instead, and there is no libgcc in a generated sysroot, so here it leaves those names undefined. Which is what somebody passing it with a -l of their own is asking for, and the link says so by name if they are not.

§builtins: Option<&'a Path>

Our own runtime archive for this target, if it is on the machine.

A path from the caller rather than a name this crate joins onto the sysroot, because it is the compiler’s own output for the target and not the platform’s, and a fetched sysroot will never hold it. The driver is what looks for it, in the -B prefixes and then beside the compiler, and None is what it says when there is none: the line goes without it and whatever wanted a wide divide is undefined. See crate::link::BUILTINS.

§export_dynamic: bool

-rdynamic, which puts every symbol in the dynamic table so a program can look itself up.

§strip: bool

-s, which drops the symbol table.

§gui: bool

-mwindows, which makes a Windows program a GUI one: the windows subsystem, so no console is opened for it, and GDI and the common dialogs on the line the way gcc puts them there. Nothing on any other target.

§unicode: bool

-municode, which starts a Windows program at wmain or wWinMain through crt2u.o instead of crt2.o. Nothing for a DLL or on any other target.

Trait Implementations§

Source§

impl<'a> Clone for Invocation<'a>

Source§

fn clone(&self) -> Self

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<'a> Debug for Invocation<'a>

Source§

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

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

impl<'a> Default for Invocation<'a>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Invocation<'a>

§

impl<'a> RefUnwindSafe for Invocation<'a>

§

impl<'a> Send for Invocation<'a>

§

impl<'a> Sync for Invocation<'a>

§

impl<'a> Unpin for Invocation<'a>

§

impl<'a> UnsafeUnpin for Invocation<'a>

§

impl<'a> UnwindSafe for Invocation<'a>

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

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.