about summary refs log tree commit diff
path: root/src/test/run-make/issue-28595
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/run-make/issue-28595
parent1c788d0a9a623221da12437b01a35ea899a03d9b (diff)
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/run-make/issue-28595')
-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.rs16
-rw-r--r--src/test/run-make/issue-28595/b.c16
-rw-r--r--src/test/run-make/issue-28595/b.rs21
5 files changed, 70 insertions, 0 deletions
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-28595/a.rs b/src/test/run-make/issue-28595/a.rs
new file mode 100644
index 00000000000..7377a9f3416
--- /dev/null
+++ b/src/test/run-make/issue-28595/a.rs
@@ -0,0 +1,16 @@
+// 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.
+
+#![crate_type = "rlib"]
+
+#[link(name = "a", kind = "static")]
+extern {
+    pub fn a();
+}
diff --git a/src/test/run-make/issue-28595/b.c b/src/test/run-make/issue-28595/b.c
new file mode 100644
index 00000000000..de81fbcaa60
--- /dev/null
+++ b/src/test/run-make/issue-28595/b.c
@@ -0,0 +1,16 @@
+// 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 void a(void);
+
+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(); }
+}