about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-01-16 10:12:31 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-02-22 10:29:06 -0800
commit351d0ffaa1027a3173c1a95e006c2efcc3d2ac02 (patch)
tree6a33fe59dae75f18da6d18713bb84fca1d87a42e /src/test
parentf8893ed5d97180dc51d82df1bdbab989c4bde46d (diff)
downloadrust-351d0ffaa1027a3173c1a95e006c2efcc3d2ac02.tar.gz
rust-351d0ffaa1027a3173c1a95e006c2efcc3d2ac02.zip
Force all lang items to be reachable
This prevents linker errors as found in #11591

Closes #11591
Diffstat (limited to 'src/test')
-rw-r--r--src/test/auxiliary/lang-item-public.rs17
-rw-r--r--src/test/run-pass/lang-item-public.rs38
2 files changed, 55 insertions, 0 deletions
diff --git a/src/test/auxiliary/lang-item-public.rs b/src/test/auxiliary/lang-item-public.rs
new file mode 100644
index 00000000000..123160f0c80
--- /dev/null
+++ b/src/test/auxiliary/lang-item-public.rs
@@ -0,0 +1,17 @@
+// 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.
+
+#[no_std];
+
+#[lang="fail_"]
+fn fail(_: *i8, _: *i8, _: uint) -> ! { loop {} }
+
+#[no_mangle]
+pub extern "C" fn rust_stack_exhausted() {}
diff --git a/src/test/run-pass/lang-item-public.rs b/src/test/run-pass/lang-item-public.rs
new file mode 100644
index 00000000000..6256449b122
--- /dev/null
+++ b/src/test/run-pass/lang-item-public.rs
@@ -0,0 +1,38 @@
+// 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.
+
+// aux-build:lang-item-public.rs
+// ignore-fast
+// ignore-android
+
+#[no_std];
+
+extern crate lang_lib = "lang-item-public";
+
+#[cfg(target_os = "linux")]
+#[link(name = "c")]
+extern {}
+
+#[cfg(target_os = "android")]
+#[link(name = "c")]
+extern {}
+
+#[cfg(target_os = "freebsd")]
+#[link(name = "execinfo")]
+extern {}
+
+#[cfg(target_os = "macos")]
+#[link(name = "System")]
+extern {}
+
+#[start]
+fn main(_: int, _: **u8) -> int {
+    1 % 1
+}