pub struct LinkOptions {Show 19 fields
pub use_ld: Option<String>,
pub search: Vec<PathBuf>,
pub prefixes: Vec<PathBuf>,
pub sysroot: Option<PathBuf>,
pub cache: Option<PathBuf>,
pub usr: Option<PathBuf>,
pub is_static: bool,
pub shared: bool,
pub pie: Option<bool>,
pub no_stdlib: bool,
pub no_startfiles: bool,
pub no_defaultlibs: bool,
pub export_dynamic: bool,
pub strip: bool,
pub no_builtins_lib: bool,
pub pinned: Option<TargetTuple>,
pub profile: bool,
pub fast_math: bool,
pub daz_ftz: Option<bool>,
}Expand description
What the command line said about linking.
Kept apart from Options because none of it reaches the compilation. A flag here changes what
the linker is told and changes nothing about the object files handed to it, which is why -lm
on a -c line is a note rather than an error.
Fields§
§use_ld: Option<String>-fuse-ld=<name>, which names a linker rather than a path to one.
search: Vec<PathBuf>-L<dir>, in order, because the linker takes the first library it finds.
prefixes: Vec<PathBuf>-B<prefix>, which is where to look for the linker before looking on the path.
sysroot: Option<PathBuf>--sysroot=<dir>, which prefixes the directories this looks in.
cache: Option<PathBuf>Where the generated sysroots are, which is crate::cache::dir on a real command line.
None is a caller that was not given one, which outside a test is nothing, and then there
is no cross link line and a foreign target is refused the way it was before there was one.
It is a field rather than a call inside this module because a link line that read the
environment could only be tested on a machine whose environment said the right thing.
usr: Option<PathBuf>Where a distribution’s cross packages put the tree for another architecture, which is
/usr on a real command line.
Debian and Ubuntu install libc6-dev-arm64-cross and its friends as /usr/<multiarch>/include
and /usr/<multiarch>/lib, and gcc’s own files for that target under
/usr/lib/gcc-cross/<multiarch>. distro_cross reads it. A field for the reason
LinkOptions::cache is one, and None in a test is a machine with no such packages.
is_static: bool-static.
-shared.
pie: Option<bool>-pie or -no-pie, and the platform’s default when neither was written.
no_stdlib: bool-nostdlib, which is -nostartfiles and -nodefaultlibs together.
no_startfiles: bool-nostartfiles.
no_defaultlibs: bool-nodefaultlibs.
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.
no_builtins_lib: bool-fno-builtins-lib, which leaves our own runtime off the line so that the machine’s
libgcc answers for everything instead.
pinned: Option<TargetTuple>The whole ten field target when --target= spelled one, which is where a pinned libc
release is.
None is a command line that named no target at all, and then there is nothing pinned and
this machine is the target. A Triple has room for an architecture, an OS and an
environment and nowhere to put a release, so the release arrives here instead of there, and
cross_sysroot reads it for both of the things it decides: whether this is a cross link
and which directory under the cache it is against.
profile: bool-pg, which changes the link as well as the code.
The counts a profiled program keeps have to be started before main runs and written out
after it returns, and what does both is a start file of its own. So a build that compiles
with the flag and links without it produces a program that calls the hook on every function
and never writes a profile.
fast_math: boolWhether -Ofast, -ffast-math or -funsafe-math-optimizations was in force at the end
of the command line, which links crtfastmath.o into anything that is not a shared object.
That file is a constructor which sets flush to zero and denormals are zero before main,
so the mode is the process’s rather than the unit’s, and it is the half of fast math the
compiler cannot give from inside a function.
daz_ftz: Option<bool>-mdaz-ftz or -mno-daz-ftz, which decides the same file outright and for a shared
object as well.
Trait Implementations§
Source§impl Clone for LinkOptions
impl Clone for LinkOptions
Source§impl Debug for LinkOptions
impl Debug for LinkOptions
Source§impl Default for LinkOptions
impl Default for LinkOptions
impl Eq for LinkOptions
Source§impl PartialEq for LinkOptions
impl PartialEq for LinkOptions
impl StructuralPartialEq for LinkOptions
Auto Trait Implementations§
impl Freeze for LinkOptions
impl RefUnwindSafe for LinkOptions
impl Send for LinkOptions
impl Sync for LinkOptions
impl Unpin for LinkOptions
impl UnsafeUnpin for LinkOptions
impl UnwindSafe for LinkOptions
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.