about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-09-23 09:23:31 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-09-30 20:17:54 -0700
commit9502df5798f2d7de41fe59927fddd894f7769a73 (patch)
tree155c4ab845709e221e15ec70d4fa84abd6f9db59 /src/test
parent1c788d0a9a623221da12437b01a35ea899a03d9b (diff)
downloadrust-9502df5798f2d7de41fe59927fddd894f7769a73.tar.gz
rust-9502df5798f2d7de41fe59927fddd894f7769a73.zip
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
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-make/issue-12446/Makefile6
-rw-r--r--src/test/run-make/issue-12446/foo.c2
-rw-r--r--src/test/run-make/issue-28595/Makefile6
-rw-r--r--src/test/run-make/issue-28595/a.c11
-rw-r--r--src/test/run-make/issue-28595/a.rs (renamed from src/test/run-make/issue-12446/foo.rs)9
-rw-r--r--src/test/run-make/issue-28595/b.c (renamed from src/test/run-make/issue-12446/bar.rs)12
-rw-r--r--src/test/run-make/issue-28595/b.rs21
7 files changed, 46 insertions, 21 deletions
diff --git a/src/test/run-make/issue-12446/Makefile b/src/test/run-make/issue-12446/Makefile
deleted file mode 100644
index c412b0479fb..00000000000
--- a/src/test/run-make/issue-12446/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
--include ../tools.mk
-
-all: $(call NATIVE_STATICLIB,foo)
-	$(RUSTC) foo.rs
-	$(RUSTC) bar.rs
-	$(call RUN,bar)
diff --git a/src/test/run-make/issue-12446/foo.c b/src/test/run-make/issue-12446/foo.c
deleted file mode 100644
index 186a0046e80..00000000000
--- a/src/test/run-make/issue-12446/foo.c
+++ /dev/null
@@ -1,2 +0,0 @@
-// ignore-license
-void some_c_symbol() {}
diff --git a/src/test/run-make/issue-28595/Makefile b/src/test/run-make/issue-28595/Makefile
new file mode 100644
index 00000000000..61e9d0c6547
--- /dev/null
+++ b/src/test/run-make/issue-28595/Makefile
@@ -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)
diff --git a/src/test/run-make/issue-28595/a.c b/src/test/run-make/issue-28595/a.c
new file mode 100644
index 00000000000..feacd7bc313
--- /dev/null
+++ b/src/test/run-make/issue-28595/a.c
@@ -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) {}
diff --git a/src/test/run-make/issue-12446/foo.rs b/src/test/run-make/issue-28595/a.rs
index 11c61169de9..7377a9f3416 100644
--- a/src/test/run-make/issue-12446/foo.rs
+++ b/src/test/run-make/issue-28595/a.rs
@@ -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();
 }
diff --git a/src/test/run-make/issue-12446/bar.rs b/src/test/run-make/issue-28595/b.c
index cd41058744d..de81fbcaa60 100644
--- a/src/test/run-make/issue-12446/bar.rs
+++ b/src/test/run-make/issue-28595/b.c
@@ -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();
 }
+
diff --git a/src/test/run-make/issue-28595/b.rs b/src/test/run-make/issue-28595/b.rs
new file mode 100644
index 00000000000..37ff346c3f3
--- /dev/null
+++ b/src/test/run-make/issue-28595/b.rs
@@ -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(); }
+}