fn link_staticlib(sess: &Session, objects: &[PathBuf], out_filename: &Path,
                  tempdir: &Path) {
    let mut ab = link_rlib(sess, None, objects, out_filename, tempdir);
    if sess.target.target.options.is_like_osx && !ab.using_llvm() {
        ab.build();
    }
    if !sess.target.target.options.no_compiler_rt {
        ab.add_native_library("compiler-rt").unwrap();
    }

    let mut all_native_libs = vec![];

    each_linked_rlib(sess, &mut |cnum, path| {
        let name = sess.cstore.get_crate_data(cnum).name();
        ab.add_rlib(path, &name, sess.lto()).unwrap();

        let native_libs = csearch::get_native_libraries(&sess.cstore, cnum);
        all_native_libs.extend(native_libs);
    });

    ab.update_symbols();
    ab.build();

    if !all_native_libs.is_empty() {
        sess.note("link against the following native artifacts when linking against \
                  this static library");
        sess.note("the order and any duplication can be significant on some platforms, \
                  and so may need to be preserved");
    }

    for &(kind, ref lib) in &all_native_libs {
        let name = match kind {
            cstore::NativeStatic => "static library",
            cstore::NativeUnknown => "library",
            cstore::NativeFramework => "framework",
        };
        sess.note(&format!("{}: {}", name, *lib));
    }
}
// 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).
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).
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 ) .
fn link_staticlib(sess: &Session, objects: &[PathBuf], out_filename: &Path,
                  tempdir: &Path) {
    let mut ab = link_rlib(sess, None, objects, out_filename, tempdir);
    if sess.target.target.options.is_like_osx && !ab.using_llvm() {
        ab.build();
    }
    if !sess.target.target.options.no_compiler_rt {
        ab.add_native_library("compiler-rt").unwrap();
    }
    let mut all_native_libs = vec![];
    each_linked_rlib(sess, &mut |cnum, path| {
        let name = sess.cstore.get_crate_data(cnum).name();
        ab.add_rlib(path, &name, sess.lto()).unwrap();
        let native_libs = csearch::get_native_libraries(&sess.cstore, cnum);
        all_native_libs.extend(native_libs);
    });
    ab.update_symbols();
    ab.build();
    if !all_native_libs.is_empty() {
        sess.note("link against the following native artifacts when linking against \
                  this static library");
        sess.note("the order and any duplication can be significant on some platforms, \
                  and so may need to be preserved");
    }
    for &(kind, ref lib) in &all_native_libs {
        let name = match kind {
            cstore::NativeStatic => "static library",
            cstore::NativeUnknown => "library",
            cstore::NativeFramework => "framework",
        };
        sess.note(&format!("{}: {}", name, *lib));
    }
}
fn link_staticlib ( sess : & Session , objects : & [ PathBuf ] , out_filename : & Path , tempdir : & Path ) { let mut ab = link_rlib ( sess , None , objects , out_filename , tempdir ) ; if sess . target . target . options . is_like_osx && ! ab . using_llvm ( ) { ab . build ( ) ; } if ! sess . target . target . options . no_compiler_rt { ab . add_native_library ( " " ) . unwrap ( ) ; } let mut all_native_libs = vec ! [ ] ; each_linked_rlib ( sess , & mut | cnum , path | { let name = sess . cstore . get_crate_data ( cnum ) . name ( ) ; ab . add_rlib ( path , & name , sess . lto ( ) ) . unwrap ( ) ; let native_libs = csearch :: get_native_libraries ( & sess . cstore , cnum ) ; all_native_libs . extend ( native_libs ) ; } ) ; ab . update_symbols ( ) ; ab . build ( ) ; if ! all_native_libs . is_empty ( ) { sess . note ( " \
 " ) ; sess . note ( " \
 " ) ; } for & ( kind , ref lib ) in & all_native_libs { let name = match kind { cstore :: NativeStatic => " " , cstore :: NativeUnknown => " " , cstore :: NativeFramework => " " , } ; sess . note ( & format ! ( " " name lib ) ) ; } }
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.
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 .
sess
&Session
objects
&[PathBuf]
out_filename
&Path
tempdir
&Path
sess
&Session
objects
&[PathBuf]
out_filename
&Path
tempdir
&Path