about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2016-08-14 21:56:48 -0500
committerJorge Aparicio <japaricious@gmail.com>2016-08-15 18:24:14 -0500
commite9964056964706fa3746c7e1135c34a45f2f467f (patch)
treeb8a28765524d265852c539ae6e7b0789994e2ade
parent35eba85c3d63579bbe0929dc880caf2be906b767 (diff)
test that a no_builtins crate is passed to the linker
-rw-r--r--src/test/run-make/no-builtins-lto/Makefile9
-rw-r--r--src/test/run-make/no-builtins-lto/main.rs13
-rw-r--r--src/test/run-make/no-builtins-lto/no_builtins.rs12
3 files changed, 34 insertions, 0 deletions
diff --git a/src/test/run-make/no-builtins-lto/Makefile b/src/test/run-make/no-builtins-lto/Makefile
new file mode 100644
index 00000000000..3f70de5f76c
--- /dev/null
+++ b/src/test/run-make/no-builtins-lto/Makefile
@@ -0,0 +1,9 @@
+-include ../tools.mk
+
+all:
+	# Compile a `#![no_builtins]` rlib crate
+	$(RUSTC) no_builtins.rs
+	# Build an executable that depends on that crate using LTO. The no_builtins crate doesn't
+	# participate in LTO, so its rlib must be explicitly linked into the final binary. Verify this by
+	# grepping the linker arguments.
+	$(RUSTC) main.rs -C lto -Z print-link-args | grep 'libno_builtins.rlib'
diff --git a/src/test/run-make/no-builtins-lto/main.rs b/src/test/run-make/no-builtins-lto/main.rs
new file mode 100644
index 00000000000..e960c726a98
--- /dev/null
+++ b/src/test/run-make/no-builtins-lto/main.rs
@@ -0,0 +1,13 @@
+// Copyright 2016 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 no_builtins;
+
+fn main() {}
diff --git a/src/test/run-make/no-builtins-lto/no_builtins.rs b/src/test/run-make/no-builtins-lto/no_builtins.rs
new file mode 100644
index 00000000000..be95e7c5521
--- /dev/null
+++ b/src/test/run-make/no-builtins-lto/no_builtins.rs
@@ -0,0 +1,12 @@
+// Copyright 2016 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 = "lib"]
+#![no_builtins]