rustc_codegen_ssa::back::link

Function link_staticlib

Source
fn link_staticlib(
    sess: &Session,
    archive_builder_builder: &dyn ArchiveBuilderBuilder,
    codegen_results: &CodegenResults,
    out_filename: &Path,
    tempdir: &MaybeTempDir,
)
Expand description

Create a static archive.

This is essentially the same thing as an rlib, but it also involves adding all of the upstream crates’ objects into the archive. This will slurp in all of the native libraries of upstream dependencies as well.

Additionally, there’s no way for us to link dynamic libraries, so we warn about all dynamic library dependencies that they’re not linked in.

There’s no need to include metadata in a static archive, so ensure to not link in the metadata object file (and also don’t prepare the archive with a metadata file).