fn link_staticlib(sess: Session, obj_filename: &Path, out_filename: &Path) {
    let mut a = link_rlib(sess, None, obj_filename, out_filename);
    a.add_native_library("morestack");

    let crates = sess.cstore.get_used_crates(cstore::RequireStatic);
    for &(cnum, ref path) in crates.iter() {
        let name = sess.cstore.get_crate_data(cnum).name;
        let p = match *path {
            Some(ref p) => p.clone(), None => {
                sess.err(format!("could not find rlib for: `{}`", name));
                continue
            }
        };
        a.add_rlib(&p, name, sess.lto());
        let native_libs = csearch::get_native_libraries(sess.cstore, cnum);
        for &(kind, ref lib) in native_libs.iter() {
            let name = match kind {
                cstore::NativeStatic => "static library",
                cstore::NativeUnknown => "library",
                cstore::NativeFramework => "framework",
            };
            sess.warn(format!("unlinked native {}: {}", 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, obj_filename: &Path, out_filename: &Path) {
    let mut a = link_rlib(sess, None, obj_filename, out_filename);
    a.add_native_library("morestack");
    let crates = sess.cstore.get_used_crates(cstore::RequireStatic);
    for &(cnum, ref path) in crates.iter() {
        let name = sess.cstore.get_crate_data(cnum).name;
        let p = match *path {
            Some(ref p) => p.clone(), None => {
                sess.err(format!("could not find rlib for: `{}`", name));
                continue
            }
        };
        a.add_rlib(&p, name, sess.lto());
        let native_libs = csearch::get_native_libraries(sess.cstore, cnum);
        for &(kind, ref lib) in native_libs.iter() {
            let name = match kind {
                cstore::NativeStatic => "static library",
                cstore::NativeUnknown => "library",
                cstore::NativeFramework => "framework",
            };
            sess.warn(format!("unlinked native {}: {}", name, *lib));
        }
    }
}
fn link_staticlib ( sess : Session , obj_filename : & Path , out_filename : & Path ) { let mut a = link_rlib ( sess , None , obj_filename , out_filename ) ; a . add_native_library ( " " ) ; let crates = sess . cstore . get_used_crates ( cstore :: RequireStatic ) ; for & ( cnum , ref path ) in crates . iter ( ) { let name = sess . cstore . get_crate_data ( cnum ) . name ; let p = match * path { Some ( ref p ) => p . clone ( ) , None => { sess . err ( format ! ( " " name ) ) ; continue } } ; a . add_rlib ( & p , name , sess . lto ( ) ) ; let native_libs = csearch :: get_native_libraries ( sess . cstore , cnum ) ; for & ( kind , ref lib ) in native_libs . iter ( ) { let name = match kind { cstore :: NativeStatic => " " , cstore :: NativeUnknown => " " , cstore :: NativeFramework => " " , } ; sess . warn ( 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
obj_filename
&Path
out_filename
&Path
sess
Session
obj_filename
&Path
out_filename
&Path