Skip to content

Commit 5a000c9

Browse files
committed
---
yaml --- r: 3743 b: refs/heads/master c: 94f0e9d h: refs/heads/master i: 3741: 18b1e90 3739: 77ea741 3735: b07c287 3727: 6aba671 3711: 326c19d v: v3
1 parent fa2dbc7 commit 5a000c9

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 0864a22aceab14092cef9b8a99dedcfb16fe1548
2+
refs/heads/master: 94f0e9d956ed3169848ee334df23ffa724001d80

trunk/src/comp/driver/rustc.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,10 @@ fn main(vec[str] args) {
436436
metadata::creader::list_file_metadata(ifile, std::io::stdout());
437437
ret;
438438
}
439+
440+
auto stop_after_codegen = sopts.output_type != link::output_type_exe ||
441+
(sopts.static && sopts.library);
442+
439443
alt (output_file) {
440444
case (none) {
441445
let vec[str] parts = str::split(ifile, '.' as u8);
@@ -460,7 +464,7 @@ fn main(vec[str] args) {
460464

461465
saved_out_filename = ofile;
462466
auto temp_filename;
463-
if (sopts.output_type == link::output_type_exe && !sopts.static) {
467+
if (!stop_after_codegen) {
464468
temp_filename = ofile + ".o";
465469
} else {
466470
temp_filename = ofile;
@@ -473,7 +477,7 @@ fn main(vec[str] args) {
473477
// gcc to link the object file with some libs
474478
//
475479
// TODO: Factor this out of main.
476-
if (sopts.output_type != link::output_type_exe || sopts.static) {
480+
if (stop_after_codegen) {
477481
ret;
478482
}
479483

@@ -521,6 +525,10 @@ fn main(vec[str] args) {
521525

522526
auto cstore = sess.get_cstore();
523527
for (str cratepath in cstore::get_used_crate_files(cstore)) {
528+
if (str::ends_with(cratepath, ".rlib")) {
529+
gcc_args += [cratepath];
530+
cont;
531+
}
524532
auto dir = fs::dirname(cratepath);
525533
if (dir != "") {
526534
gcc_args += ["-L" + dir];

trunk/src/comp/metadata/creader.rs

+3
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ fn metadata_matches(&vec[u8] crate_data,
124124

125125
fn default_native_lib_naming(session::session sess) ->
126126
rec(str prefix, str suffix) {
127+
if (sess.get_opts().static) {
128+
ret rec(prefix="lib", suffix=".rlib");
129+
}
127130
alt (sess.get_targ_cfg().os) {
128131
case (session::os_win32) { ret rec(prefix="", suffix=".dll"); }
129132
case (session::os_macos) { ret rec(prefix="lib", suffix=".dylib"); }

trunk/src/comp/middle/trans.rs

+3
Original file line numberDiff line numberDiff line change
@@ -9263,6 +9263,9 @@ fn create_module_map(&@crate_ctxt ccx) -> ValueRef {
92639263
auto maptype = T_array(elttype, ccx.module_data.size() + 1u);
92649264
auto map =
92659265
llvm::LLVMAddGlobal(ccx.llmod, maptype, str::buf("_rust_mod_map"));
9266+
llvm::LLVMSetLinkage(map,
9267+
lib::llvm::LLVMInternalLinkage as
9268+
llvm::Linkage);
92669269
let ValueRef[] elts = ~[];
92679270
for each (@tup(str, ValueRef) item in ccx.module_data.items()) {
92689271
auto elt = C_struct(~[p2i(C_cstr(ccx, item._0)), p2i(item._1)]);

0 commit comments

Comments
 (0)