fn link_natively(sess: Session, dylib: bool, obj_filename: &Path,
                 out_filename: &Path) {
    let tmpdir = TempDir::new("rustc").expect("needs a temp dir");
    // The invocations of cc share some flags across platforms
    let cc_prog = get_cc_prog(sess);
    let mut cc_args = sess.targ_cfg.target_strs.cc_args.clone();
    cc_args.push_all_move(link_args(sess, dylib, tmpdir.path(),
                                    obj_filename, out_filename));
    if (sess.opts.debugging_opts & session::PRINT_LINK_ARGS) != 0 {
        println!("{} link args: '{}'", cc_prog, cc_args.connect("' '"));
    }

    // May have not found libraries in the right formats.
    sess.abort_if_errors();

    // Invoke the system linker
    debug!("{} {}", cc_prog, cc_args.connect(" "));
    let opt_prog = {
        let _guard = io::ignore_io_error();
        time(sess.time_passes(), "running linker", (), |()|
             run::process_output(cc_prog, cc_args))
    };

    match opt_prog {
        Some(prog) => {
            if !prog.status.success() {
                sess.err(format!("linking with `{}` failed: {}", cc_prog, prog.status));
                sess.note(format!("{} arguments: '{}'", cc_prog, cc_args.connect("' '")));
                sess.note(str::from_utf8_owned(prog.error + prog.output));
                sess.abort_if_errors();
            }
        },
        None => {
            sess.err(format!("could not exec the linker `{}`", cc_prog));
            sess.abort_if_errors();
        }
    }


    // On OSX, debuggers need this utility to get run to do some munging of
    // the symbols
    if sess.targ_cfg.os == abi::OsMacos && sess.opts.debuginfo {
        // FIXME (#9639): This needs to handle non-utf8 paths
        run::process_status("dsymutil",
                            [out_filename.as_str().unwrap().to_owned()]);
    }
}
// Create a dynamic library or executable
//
// This will invoke the system linker/cc to create the resulting file. This
// links to all upstream files as well.
Create a dynamic library or executable
This will invoke the system linker/cc to create the resulting file. This
links to all upstream files as well.
Create a dynamic library or executable This will invoke the system linker / cc to create the resulting file . This links to all upstream files as well .
fn link_natively(sess: Session, dylib: bool, obj_filename: &Path,
                 out_filename: &Path) {
    let tmpdir = TempDir::new("rustc").expect("needs a temp dir");
    // The invocations of cc share some flags across platforms
    let cc_prog = get_cc_prog(sess);
    let mut cc_args = sess.targ_cfg.target_strs.cc_args.clone();
    cc_args.push_all_move(link_args(sess, dylib, tmpdir.path(),
                                    obj_filename, out_filename));
    if (sess.opts.debugging_opts & session::PRINT_LINK_ARGS) != 0 {
        println!("{} link args: '{}'", cc_prog, cc_args.connect("' '"));
    }
    // May have not found libraries in the right formats.
    sess.abort_if_errors();
    // Invoke the system linker
    debug!("{} {}", cc_prog, cc_args.connect(" "));
    let opt_prog = {
        let _guard = io::ignore_io_error();
        time(sess.time_passes(), "running linker", (), |()|
             run::process_output(cc_prog, cc_args))
    };
    match opt_prog {
        Some(prog) => {
            if !prog.status.success() {
                sess.err(format!("linking with `{}` failed: {}", cc_prog, prog.status));
                sess.note(format!("{} arguments: '{}'", cc_prog, cc_args.connect("' '")));
                sess.note(str::from_utf8_owned(prog.error + prog.output));
                sess.abort_if_errors();
            }
        },
        None => {
            sess.err(format!("could not exec the linker `{}`", cc_prog));
            sess.abort_if_errors();
        }
    }
    // On OSX, debuggers need this utility to get run to do some munging of
    // the symbols
    if sess.targ_cfg.os == abi::OsMacos && sess.opts.debuginfo {
        // FIXME (#9639): This needs to handle non-utf8 paths
        run::process_status("dsymutil",
                            [out_filename.as_str().unwrap().to_owned()]);
    }
}
fn link_natively ( sess : Session , dylib : bool , obj_filename : & Path , out_filename : & Path ) { let tmpdir = TempDir :: new ( " " ) . expect ( " " ) ; // The invocations of cc share some flags across platforms let cc_prog = get_cc_prog ( sess ) ; let mut cc_args = sess . targ_cfg . target_strs . cc_args . clone ( ) ; cc_args . push_all_move ( link_args ( sess , dylib , tmpdir . path ( ) , obj_filename , out_filename ) ) ; if ( sess . opts . debugging_opts & session :: PRINT_LINK_ARGS ) != 0 { println ! ( " " cc_prog cc_args connect ( " " ) ) ; } // May have not found libraries in the right formats. sess . abort_if_errors ( ) ; // Invoke the system linker debug ! ( " " cc_prog cc_args connect ( " " ) ) ; let opt_prog = { let _guard = io :: ignore_io_error ( ) ; time ( sess . time_passes ( ) , " " , ( ) , | ( ) | run :: process_output ( cc_prog , cc_args ) ) } ; match opt_prog { Some ( prog ) => { if ! prog . status . success ( ) { sess . err ( format ! ( " " cc_prog prog status ) ) ; sess . note ( format ! ( " " cc_prog cc_args connect ( " " ) ) ) ; sess . note ( str :: from_utf8_owned ( prog . error + prog . output ) ) ; sess . abort_if_errors ( ) ; } } , None => { sess . err ( format ! ( " " cc_prog ) ) ; sess . abort_if_errors ( ) ; } } // On OSX, debuggers need this utility to get run to do some munging of // the symbols if sess . targ_cfg . os == abi :: OsMacos && sess . opts . debuginfo { // FIXME (#9639): This needs to handle non-utf8 paths run :: process_status ( " " , [ out_filename . as_str ( ) . unwrap ( ) . to_owned ( ) ] ) ; } }
Create a dynamic library or executable
This will invoke the system linker/cc to create the resulting file.
Create a dynamic library or executable This will invoke the system linker / cc to create the resulting file .
sess
Session
dylib
bool
obj_filename
&Path
out_filename
&Path
sess
Session
dylib
bool
obj_filename
&Path
out_filename
&Path