Skip to content

Commit 7694689

Browse files
committed
Fix bug in library output filename construction: /tmp/foo.rc was being linked as lib/tmp/foo-<hash>-<vers>.so not /tmp/foo-<hash>-<vers>.so
1 parent 1753607 commit 7694689

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/comp/back/link.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,9 +588,16 @@ fn link_binary(sess: session::session,
588588
let long_libname =
589589
std::os::dylib_filename(#fmt("%s-%s-%s",
590590
lm.name, lm.extras_hash, lm.vers));
591+
log "link_meta.name: " + lm.name;
592+
log "long_libname: " + long_libname;
593+
log "out_filename: " + out_filename;
594+
log "dirname(out_filename): " + fs::dirname(out_filename);
595+
591596
fs::connect(fs::dirname(out_filename), long_libname)
592597
} else { out_filename };
593598

599+
log "output: " + output;
600+
594601
// The default library location, we need this to find the runtime.
595602
// The location of crates will be determined as needed.
596603
let stage: str = "-L" + sess.filesearch().get_target_lib_path();

src/comp/driver/rustc.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,10 @@ fn build_output_filenames(ifile: str, ofile: option::t<str>,
561561
obj_filename = base_filename + "." + suffix;
562562

563563
if sess.building_library() {
564-
saved_out_filename = std::os::dylib_filename(base_filename);
564+
let dirname = fs::dirname(base_filename);
565+
let basename = fs::basename(base_filename);
566+
let dylibname = std::os::dylib_filename(basename);
567+
saved_out_filename = fs::connect(dirname, dylibname);
565568
} else {
566569
saved_out_filename = base_filename;
567570
}

0 commit comments

Comments
 (0)