auto merge of #12688 : alexcrichton/rust/fix-some-link-args, r=brson
Linker argument order with respect to libraries is important enough that we shouldn't be attempting to filter out libraries getting passed through to the linker. When linking with a native library that has multiple dependant native libraries, it's useful to have control over the link argument order.
This commit is contained in:
commit
f1955e028c
@ -154,15 +154,10 @@ impl CStore {
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn add_used_library(&self, lib: ~str, kind: NativeLibaryKind)
|
||||
-> bool {
|
||||
pub fn add_used_library(&self, lib: ~str, kind: NativeLibaryKind) {
|
||||
assert!(!lib.is_empty());
|
||||
let mut used_libraries = self.used_libraries.borrow_mut();
|
||||
if used_libraries.get().iter().any(|&(ref x, _)| x == &lib) {
|
||||
return false;
|
||||
}
|
||||
used_libraries.get().push((lib, kind));
|
||||
true
|
||||
}
|
||||
|
||||
pub fn get_used_libraries<'a>(&'a self)
|
||||
|
6
src/test/run-make/no-duplicate-libs/Makefile
Normal file
6
src/test/run-make/no-duplicate-libs/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
-include ../tools.mk
|
||||
|
||||
all: $(call STATICLIB,foo) $(call STATICLIB,bar)
|
||||
$(RUSTC) main.rs
|
||||
$(call RUN,main)
|
||||
|
3
src/test/run-make/no-duplicate-libs/bar.c
Normal file
3
src/test/run-make/no-duplicate-libs/bar.c
Normal file
@ -0,0 +1,3 @@
|
||||
extern void foo();
|
||||
|
||||
void bar() { foo(); }
|
1
src/test/run-make/no-duplicate-libs/foo.c
Normal file
1
src/test/run-make/no-duplicate-libs/foo.c
Normal file
@ -0,0 +1 @@
|
||||
void foo() {}
|
20
src/test/run-make/no-duplicate-libs/main.rs
Normal file
20
src/test/run-make/no-duplicate-libs/main.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#[link(name = "foo")]
|
||||
#[link(name = "bar")]
|
||||
#[link(name = "foo")]
|
||||
extern {
|
||||
fn bar();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unsafe { bar() }
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user