Skip to main content

LinkLine

Struct LinkLine 

Source
pub struct LinkLine {
    pub start: Vec<PathBuf>,
    pub libraries: Vec<PathBuf>,
    pub end: Vec<PathBuf>,
    pub flags: Vec<String>,
}
Expand description

The inputs to a link, in the three groups a linker needs them in.

Paths rather than strings, and no linker flavour spelling, because spec/cross-compile/11-linking.md owns which linker is invoked and how its arguments are spelled. What is here is what has to be linked and in what order, which is a target fact.

Fields§

§start: Vec<PathBuf>

The start files, before the user’s objects.

§libraries: Vec<PathBuf>

The libraries, after the user’s objects.

§end: Vec<PathBuf>

The end files, after the libraries.

§flags: Vec<String>

The flags the mode needs, which is the static switch and, for a dynamic link, the loader.

Implementations§

Source§

impl LinkLine

Source

pub fn musl(sysroot: &Sysroot, mode: LinkMode) -> Self

The line for a musl link against this sysroot.

crt1.o runs before main and calls it. crti.o and crtn.o are the prologue and the epilogue of the .init and .fini sections, which is why one is at the front and the other is at the very back. libc.a carries musl’s whole C library, and librucc_builtins.a carries the operations the architecture does not have an instruction for, which spec/cross-compile/10-runtime.md says has to be ours rather than the platform’s.

The builtins go after libc.a because musl calls some of them, and an archive that is searched before the thing that needs it contributes nothing.

Source

pub fn with_objects(&self, objects: &[PathBuf]) -> Vec<PathBuf>

Every input, in the order they reach the linker, with the caller’s objects in the middle.

The one function that knows the whole order, so that a caller cannot assemble the three groups in the wrong sequence.

Trait Implementations§

Source§

impl Clone for LinkLine

Source§

fn clone(&self) -> LinkLine

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 LinkLine

Source§

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

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

impl Eq for LinkLine

Source§

impl PartialEq for LinkLine

Source§

fn eq(&self, other: &LinkLine) -> 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 LinkLine

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

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.