Skip to content

Commit 3ab8967

Browse files
committed
---
yaml --- r: 7199 b: refs/heads/master c: efb9df1 h: refs/heads/master i: 7197: e8a33c9 7195: 6bb7507 7191: 258320d 7183: 9fd9479 7167: eddabcf v: v3
1 parent 6182579 commit 3ab8967

38 files changed

+228
-207
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 56fe4c2681f7ef467d8b3405279acbcfc6b0ebcf
2+
refs/heads/master: efb9df1ebd7ebe0232e202d0e065b08d6a593785

trunk/src/comp/back/link.rs

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
import driver::session;
3+
import session::session;
34
import lib::llvm::llvm;
45
import front::attr;
56
import middle::ty;
@@ -30,16 +31,16 @@ tag output_type {
3031
output_type_exe;
3132
}
3233

33-
fn llvm_err(sess: session::session, msg: str) unsafe {
34+
fn llvm_err(sess: session, msg: str) unsafe {
3435
let buf = llvm::LLVMRustGetLastError();
3536
if buf == ptr::null() {
3637
sess.fatal(msg);
3738
} else { sess.fatal(msg + ": " + str::from_cstr(buf)); }
3839
}
3940

40-
fn load_intrinsics_bc(sess: session::session) -> option::t<ModuleRef> {
41+
fn load_intrinsics_bc(sess: session) -> option::t<ModuleRef> {
4142
let path = alt filesearch::search(
42-
sess.filesearch(),
43+
sess.filesearch,
4344
bind filesearch::pick_file("intrinsics.bc", _)) {
4445
option::some(path) { path }
4546
option::none. {
@@ -64,9 +65,9 @@ fn load_intrinsics_bc(sess: session::session) -> option::t<ModuleRef> {
6465
ret option::some(llintrinsicsmod);
6566
}
6667

67-
fn load_intrinsics_ll(sess: session::session) -> ModuleRef {
68+
fn load_intrinsics_ll(sess: session) -> ModuleRef {
6869
let path = alt filesearch::search(
69-
sess.filesearch(),
70+
sess.filesearch,
7071
bind filesearch::pick_file("intrinsics.ll", _)) {
7172
option::some(path) { path }
7273
option::none. { sess.fatal("couldn't find intrinsics.ll") }
@@ -81,7 +82,7 @@ fn load_intrinsics_ll(sess: session::session) -> ModuleRef {
8182
ret llintrinsicsmod;
8283
}
8384

84-
fn link_intrinsics(sess: session::session, llmod: ModuleRef) {
85+
fn link_intrinsics(sess: session, llmod: ModuleRef) {
8586
let llintrinsicsmod = {
8687
alt load_intrinsics_bc(sess) {
8788
option::some(m) { m }
@@ -122,13 +123,13 @@ mod write {
122123
} else { stem = str::substr(output_path, 0u, dot_pos as uint); }
123124
ret stem + "." + extension;
124125
}
125-
fn run_passes(sess: session::session, llmod: ModuleRef, output: str) {
126-
let opts = sess.get_opts();
126+
fn run_passes(sess: session, llmod: ModuleRef, output: str) {
127+
let opts = sess.opts;
127128
if opts.time_llvm_passes { llvm::LLVMRustEnableTimePasses(); }
128129
link_intrinsics(sess, llmod);
129130
let pm = mk_pass_manager();
130131
let td = mk_target_data(
131-
sess.get_targ_cfg().target_strs.data_layout);
132+
sess.targ_cfg.target_strs.data_layout);
132133
llvm::LLVMAddTargetData(td.lltd, pm.llpm);
133134
// TODO: run the linter here also, once there are llvm-c bindings for
134135
// it.
@@ -234,7 +235,7 @@ mod write {
234235

235236
if opts.output_type == output_type_assembly {
236237
let _: () = str::as_buf(
237-
sess.get_targ_cfg().target_strs.target_triple,
238+
sess.targ_cfg.target_strs.target_triple,
238239
{|buf_t|
239240
str::as_buf(output, {|buf_o|
240241
llvm::LLVMRustWriteOutputFile(
@@ -254,7 +255,7 @@ mod write {
254255
opts.output_type == output_type_exe {
255256
let _: () =
256257
str::as_buf(
257-
sess.get_targ_cfg().target_strs.target_triple,
258+
sess.targ_cfg.target_strs.target_triple,
258259
{|buf_t|
259260
str::as_buf(output, {|buf_o|
260261
llvm::LLVMRustWriteOutputFile(
@@ -272,7 +273,7 @@ mod write {
272273

273274
let _: () =
274275
str::as_buf(
275-
sess.get_targ_cfg().target_strs.target_triple,
276+
sess.targ_cfg.target_strs.target_triple,
276277
{|buf_t|
277278
str::as_buf(output, {|buf_o|
278279
llvm::LLVMRustWriteOutputFile(
@@ -362,15 +363,15 @@ mod write {
362363

363364
type link_meta = {name: str, vers: str, extras_hash: str};
364365

365-
fn build_link_meta(sess: session::session, c: ast::crate, output: str,
366+
fn build_link_meta(sess: session, c: ast::crate, output: str,
366367
sha: sha1) -> link_meta {
367368

368369
type provided_metas =
369370
{name: option::t<str>,
370371
vers: option::t<str>,
371372
cmh_items: [@ast::meta_item]};
372373

373-
fn provided_link_metas(sess: session::session, c: ast::crate) ->
374+
fn provided_link_metas(sess: session, c: ast::crate) ->
374375
provided_metas {
375376
let name: option::t<str> = none;
376377
let vers: option::t<str> = none;
@@ -430,13 +431,13 @@ fn build_link_meta(sess: session::session, c: ast::crate, output: str,
430431
ret truncated_sha1_result(sha);
431432
}
432433

433-
fn warn_missing(sess: session::session, name: str, default: str) {
434-
if !sess.building_library() { ret; }
434+
fn warn_missing(sess: session, name: str, default: str) {
435+
if !sess.building_library { ret; }
435436
sess.warn(#fmt["missing crate link meta '%s', using '%s' as default",
436437
name, default]);
437438
}
438439

439-
fn crate_meta_name(sess: session::session, _crate: ast::crate,
440+
fn crate_meta_name(sess: session, _crate: ast::crate,
440441
output: str, metas: provided_metas) -> str {
441442
ret alt metas.name {
442443
some(v) { v }
@@ -454,7 +455,7 @@ fn build_link_meta(sess: session::session, c: ast::crate, output: str,
454455
};
455456
}
456457

457-
fn crate_meta_vers(sess: session::session, _crate: ast::crate,
458+
fn crate_meta_vers(sess: session, _crate: ast::crate,
458459
metas: provided_metas) -> str {
459460
ret alt metas.vers {
460461
some(v) { v }
@@ -469,7 +470,7 @@ fn build_link_meta(sess: session::session, c: ast::crate, output: str,
469470
let provided_metas = provided_link_metas(sess, c);
470471
let name = crate_meta_name(sess, c, output, provided_metas);
471472
let vers = crate_meta_vers(sess, c, provided_metas);
472-
let dep_hashes = cstore::get_dep_hashes(sess.get_cstore());
473+
let dep_hashes = cstore::get_dep_hashes(sess.cstore);
473474
let extras_hash =
474475
crate_meta_extras_hash(sha, c, provided_metas, dep_hashes);
475476

@@ -557,7 +558,7 @@ fn mangle_internal_name_by_seq(ccx: @crate_ctxt, flav: str) -> str {
557558

558559
// If the user wants an exe generated we need to invoke
559560
// gcc to link the object file with some libs
560-
fn link_binary(sess: session::session,
561+
fn link_binary(sess: session,
561562
obj_filename: str,
562563
out_filename: str,
563564
lm: link_meta) {
@@ -586,7 +587,7 @@ fn link_binary(sess: session::session,
586587
};
587588
}
588589

589-
let output = if sess.building_library() {
590+
let output = if sess.building_library {
590591
let long_libname =
591592
std::os::dylib_filename(#fmt("%s-%s-%s",
592593
lm.name, lm.extras_hash, lm.vers));
@@ -602,22 +603,22 @@ fn link_binary(sess: session::session,
602603

603604
// The default library location, we need this to find the runtime.
604605
// The location of crates will be determined as needed.
605-
let stage: str = "-L" + sess.filesearch().get_target_lib_path();
606+
let stage: str = "-L" + sess.filesearch.get_target_lib_path();
606607

607608
let prog: str = "gcc";
608609
// The invocations of gcc share some flags across platforms
609610

610611
let gcc_args =
611-
[stage] + sess.get_targ_cfg().target_strs.gcc_args +
612+
[stage] + sess.targ_cfg.target_strs.gcc_args +
612613
["-o", output, obj_filename];
613614

614615
let lib_cmd;
615-
let os = sess.get_targ_cfg().os;
616+
let os = sess.targ_cfg.os;
616617
if os == session::os_macos {
617618
lib_cmd = "-dynamiclib";
618619
} else { lib_cmd = "-shared"; }
619620

620-
let cstore = sess.get_cstore();
621+
let cstore = sess.cstore;
621622
for cratepath: str in cstore::get_used_crate_files(cstore) {
622623
if str::ends_with(cratepath, ".rlib") {
623624
gcc_args += [cratepath];
@@ -626,7 +627,7 @@ fn link_binary(sess: session::session,
626627
let cratepath = cratepath;
627628
let dir = fs::dirname(cratepath);
628629
if dir != "" { gcc_args += ["-L" + dir]; }
629-
let libarg = unlib(sess.get_targ_cfg(), fs::basename(cratepath));
630+
let libarg = unlib(sess.targ_cfg, fs::basename(cratepath));
630631
gcc_args += ["-l" + libarg];
631632
}
632633

@@ -636,12 +637,12 @@ fn link_binary(sess: session::session,
636637
let used_libs = cstore::get_used_libraries(cstore);
637638
for l: str in used_libs { gcc_args += ["-l" + l]; }
638639

639-
if sess.building_library() {
640+
if sess.building_library {
640641
gcc_args += [lib_cmd];
641642

642643
// On mac we need to tell the linker to let this library
643644
// be rpathed
644-
if sess.get_targ_cfg().os == session::os_macos {
645+
if sess.targ_cfg.os == session::os_macos {
645646
gcc_args += ["-Wl,-install_name,@rpath/"
646647
+ fs::basename(output)];
647648
}
@@ -655,11 +656,11 @@ fn link_binary(sess: session::session,
655656

656657
// On linux librt and libdl are an indirect dependencies via rustrt,
657658
// and binutils 2.22+ won't add them automatically
658-
if sess.get_targ_cfg().os == session::os_linux {
659+
if sess.targ_cfg.os == session::os_linux {
659660
gcc_args += ["-lrt", "-ldl"];
660661
}
661662

662-
if sess.get_targ_cfg().os == session::os_freebsd {
663+
if sess.targ_cfg.os == session::os_freebsd {
663664
gcc_args += ["-lrt", "-L/usr/local/lib", "-lexecinfo",
664665
"-L/usr/local/lib/gcc46",
665666
"-L/usr/local/lib/gcc44", "-lstdc++",
@@ -672,7 +673,7 @@ fn link_binary(sess: session::session,
672673
// linker from the dwarf unwind info. Unfortunately, it does not seem to
673674
// understand how to unwind our __morestack frame, so we have to turn it
674675
// off. This has impacted some other projects like GHC.
675-
if sess.get_targ_cfg().os == session::os_macos {
676+
if sess.targ_cfg.os == session::os_macos {
676677
gcc_args += ["-Wl,-no_compact_unwind"];
677678
}
678679

@@ -692,12 +693,12 @@ fn link_binary(sess: session::session,
692693
}
693694

694695
// Clean up on Darwin
695-
if sess.get_targ_cfg().os == session::os_macos {
696+
if sess.targ_cfg.os == session::os_macos {
696697
run::run_program("dsymutil", [output]);
697698
}
698699

699700
// Remove the temporary object file if we aren't saving temps
700-
if !sess.get_opts().save_temps {
701+
if !sess.opts.save_temps {
701702
run::run_program("rm", [obj_filename]);
702703
}
703704
}

trunk/src/comp/back/rpath.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import util::filesearch;
1212
export get_rpath_flags;
1313

1414
fn get_rpath_flags(sess: session::session, out_filename: str) -> [str] {
15-
let os = sess.get_targ_cfg().os;
15+
let os = sess.targ_cfg.os;
1616

1717
// No rpath on windows
1818
if os == session::os_win32 {
@@ -22,22 +22,22 @@ fn get_rpath_flags(sess: session::session, out_filename: str) -> [str] {
2222
#debug("preparing the RPATH!");
2323

2424
let cwd = os::getcwd();
25-
let sysroot = sess.filesearch().sysroot();
25+
let sysroot = sess.filesearch.sysroot();
2626
let output = out_filename;
27-
let libs = cstore::get_used_crate_files(sess.get_cstore());
27+
let libs = cstore::get_used_crate_files(sess.cstore);
2828
// We don't currently rpath native libraries, but we know
2929
// where rustrt is and we know every rust program needs it
3030
let libs = libs + [get_sysroot_absolute_rt_lib(sess)];
3131

32-
let target_triple = sess.get_opts().target_triple;
32+
let target_triple = sess.opts.target_triple;
3333
let rpaths = get_rpaths(os, cwd, sysroot, output, libs, target_triple);
3434
rpaths_to_flags(rpaths)
3535
}
3636

3737
fn get_sysroot_absolute_rt_lib(sess: session::session) -> fs::path {
38-
let path = [sess.filesearch().sysroot()]
38+
let path = [sess.filesearch.sysroot()]
3939
+ filesearch::relative_target_lib_path(
40-
sess.get_opts().target_triple)
40+
sess.opts.target_triple)
4141
+ [os::dylib_filename("rustrt")];
4242
check vec::is_not_empty(path);
4343
fs::connect_many(path)

0 commit comments

Comments
 (0)