Skip to main content

Libc

Enum Libc 

Source
pub enum Libc {
    None,
    Archive,
    Stub,
    Import,
}
Expand description

What a produced sysroot holds for a target’s C library.

Four cases, from spec/cross-compile/08-sysroots.md section 8.2’s table, and the line differs between them in what goes on it rather than in how it is spelled. The table has seven rows and two of those are legal walls rather than technical ones, so what is left is these four.

Variants§

§

None

Nothing, which is the freestanding row: the nine compiler headers and no link inputs at all. Our runtime is still there, because an architecture without a division instruction needs it whether there is a libc or not.

§

Archive

A real static archive, which today means musl built from source. The only row where the code behind the names is present, so the only row a static link can use.

§

Stub

A generated stub shared object: the names the platform’s libc exports and none of the code. glibc is the row this was written for, and bionic, the BSDs and illumos take the same shape for the same reason, which is that their libc is a shared object on the target machine and a list of names is enough to link against one.

§

Import

A set of import libraries, which is what the same idea is called in COFF.

Windows is the row this is, and it is a separate case from Libc::Stub rather than a spelling of it, for two reasons that both show up on the line. The container is different: a Windows program links against an archive of tiny objects per DLL rather than against one shared object, which is spec/cross-compile/09-libc-stubs.md section 9.4 and what rucc_stub::coff writes. And the C library is not one file: the msvcrt import library, mingw-w64’s own libmingwex.a and libmoldname.a, and the Win32 libraries a CRT calls into are all on the line, where a glibc line has one libc.so on it.

A static link against this is not refused, which is the other difference. On Windows the C library is a DLL on every machine and always has been, so -static there is a statement about our libraries and mingw-w64’s rather than about the CRT, and a program linked that way runs. That is why the refusal in crate::argv::argv is about Libc::Stub by name.

Trait Implementations§

Source§

impl Clone for Libc

Source§

fn clone(&self) -> Libc

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 Libc

Source§

impl Debug for Libc

Source§

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

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

impl Eq for Libc

Source§

impl PartialEq for Libc

Source§

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

Auto Trait Implementations§

§

impl Freeze for Libc

§

impl RefUnwindSafe for Libc

§

impl Send for Libc

§

impl Sync for Libc

§

impl Unpin for Libc

§

impl UnsafeUnpin for Libc

§

impl UnwindSafe for Libc

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.