rustc: Swap link order of native libs/rust deps
This commit swaps the order of linking local native libraries and upstream native libraries on the linker command line. Detail of bugs this can cause can be found in #28595, and this change also invalidates the test case that was added for #12446 which is now considered a bug because the downstream dependency would need to declare that it depends on the native library somehow. Closes #28595
This commit is contained in:
parent
1c788d0a9a
commit
9502df5798
9 changed files with 72 additions and 49 deletions
|
|
@ -1,6 +0,0 @@
|
|||
-include ../tools.mk
|
||||
|
||||
all: $(call NATIVE_STATICLIB,foo)
|
||||
$(RUSTC) foo.rs
|
||||
$(RUSTC) bar.rs
|
||||
$(call RUN,bar)
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// ignore-license
|
||||
void some_c_symbol() {}
|
||||
6
src/test/run-make/issue-28595/Makefile
Normal file
6
src/test/run-make/issue-28595/Makefile
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
-include ../tools.mk
|
||||
|
||||
all: $(call NATIVE_STATICLIB,a) $(call NATIVE_STATICLIB,b)
|
||||
$(RUSTC) a.rs
|
||||
$(RUSTC) b.rs
|
||||
$(call RUN,b)
|
||||
11
src/test/run-make/issue-28595/a.c
Normal file
11
src/test/run-make/issue-28595/a.c
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2015 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.
|
||||
|
||||
void a(void) {}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
|
|
@ -10,10 +10,7 @@
|
|||
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
#[link(name = "a", kind = "static")]
|
||||
extern {
|
||||
fn some_c_symbol();
|
||||
}
|
||||
|
||||
pub fn foo() {
|
||||
unsafe { some_c_symbol() }
|
||||
pub fn a();
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
|
|
@ -8,11 +8,9 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
extern crate foo;
|
||||
extern void a(void);
|
||||
|
||||
#[link(name = "foo")]
|
||||
extern {}
|
||||
|
||||
fn main() {
|
||||
foo::foo();
|
||||
void b(void) {
|
||||
a();
|
||||
}
|
||||
|
||||
21
src/test/run-make/issue-28595/b.rs
Normal file
21
src/test/run-make/issue-28595/b.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2015 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.
|
||||
|
||||
extern crate a;
|
||||
|
||||
#[link(name = "b", kind = "static")]
|
||||
extern {
|
||||
pub fn b();
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
unsafe { b(); }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue