summaryrefslogtreecommitdiffstats
path: root/tests/ui/lto/weak-works.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/lto/weak-works.rs')
-rw-r--r--tests/ui/lto/weak-works.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/lto/weak-works.rs b/tests/ui/lto/weak-works.rs
new file mode 100644
index 000000000..163a38702
--- /dev/null
+++ b/tests/ui/lto/weak-works.rs
@@ -0,0 +1,28 @@
+// run-pass
+
+// compile-flags: -C codegen-units=8 -Z thinlto
+// ignore-windows
+
+#![feature(linkage)]
+
+pub mod foo {
+ #[linkage = "weak"]
+ #[no_mangle]
+ pub extern "C" fn FOO() -> i32 {
+ 0
+ }
+}
+
+mod bar {
+ extern "C" {
+ fn FOO() -> i32;
+ }
+
+ pub fn bar() -> i32 {
+ unsafe { FOO() }
+ }
+}
+
+fn main() {
+ bar::bar();
+}