Skip to content

Commit 9e8f696

Browse files
committed
---
yaml --- r: 179361 b: refs/heads/tmp c: 8661b3d h: refs/heads/master i: 179359: 7954329 v: v3
1 parent d434b66 commit 9e8f696

File tree

6 files changed

+73
-10
lines changed

6 files changed

+73
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 44a287e6eb22ec3c2a687fc156813577464017f7
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
37-
refs/heads/tmp: 4583272bf5054e84c4c59ba3b9334a52cfcf5208
37+
refs/heads/tmp: 8661b3dc0fbb9e21b94266ba62e23cebb8f0603f

branches/tmp/src/librustc/metadata/loader.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,8 @@ impl<'a> Context<'a> {
370370
// must be loaded via -L plus some filtering.
371371
if self.hash.is_none() {
372372
self.should_match_name = false;
373-
match self.find_commandline_library() {
374-
Some(l) => return Some(l),
375-
None => {}
373+
if let Some(s) = self.sess.opts.externs.get(self.crate_name) {
374+
return self.find_commandline_library(s);
376375
}
377376
self.should_match_name = true;
378377
}
@@ -619,12 +618,7 @@ impl<'a> Context<'a> {
619618
(t.options.dll_prefix.clone(), t.options.dll_suffix.clone())
620619
}
621620

622-
fn find_commandline_library(&mut self) -> Option<Library> {
623-
let locs = match self.sess.opts.externs.get(self.crate_name) {
624-
Some(s) => s,
625-
None => return None,
626-
};
627-
621+
fn find_commandline_library(&mut self, locs: &[String]) -> Option<Library> {
628622
// First, filter out all libraries that look suspicious. We only accept
629623
// files which actually exist that have the correct naming scheme for
630624
// rlibs/dylibs.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-include ../tools.mk
2+
3+
HOST := $(shell $(RUSTC) -vV | grep 'host:' | sed 's/host: //')
4+
ifeq ($(findstring i686,$(HOST)),i686)
5+
TARGET := $(subst i686,x86_64,$(HOST))
6+
else
7+
TARGET := $(subst x86_64,i686,$(HOST))
8+
endif
9+
10+
all:
11+
$(RUSTC) foo.rs -C extra-filename=-host
12+
$(RUSTC) bar.rs -C extra-filename=-targ --target $(TARGET)
13+
$(RUSTC) baz.rs --extern a=$(TMPDIR)/liba-targ.rlib --target $(TARGET)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(no_std)]
12+
#![no_std]
13+
#![crate_type = "lib"]
14+
#![crate_name = "a"]
15+
16+
#[macro_export]
17+
macro_rules! bar {
18+
() => ()
19+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(no_std)]
12+
#![no_std]
13+
#![crate_type = "lib"]
14+
15+
#[macro_use]
16+
extern crate a;
17+
18+
bar!();
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(no_std)]
12+
#![no_std]
13+
#![crate_type = "lib"]
14+
#![crate_name = "a"]
15+
16+
#[macro_export]
17+
macro_rules! foo {
18+
() => ()
19+
}

0 commit comments

Comments
 (0)