about summary refs log tree commit diff
path: root/src/test/ui/thinlto/weak-works.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/thinlto/weak-works.rs')
-rw-r--r--src/test/ui/thinlto/weak-works.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/ui/thinlto/weak-works.rs b/src/test/ui/thinlto/weak-works.rs
new file mode 100644
index 00000000000..163a3870248
--- /dev/null
+++ b/src/test/ui/thinlto/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();
+}