about summary refs log tree commit diff
path: root/tests/ui/linkage-attr/raw-dylib/elf/multiple-libraries.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/linkage-attr/raw-dylib/elf/multiple-libraries.rs')
-rw-r--r--tests/ui/linkage-attr/raw-dylib/elf/multiple-libraries.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/ui/linkage-attr/raw-dylib/elf/multiple-libraries.rs b/tests/ui/linkage-attr/raw-dylib/elf/multiple-libraries.rs
new file mode 100644
index 00000000000..f4715ff2d3d
--- /dev/null
+++ b/tests/ui/linkage-attr/raw-dylib/elf/multiple-libraries.rs
@@ -0,0 +1,37 @@
+//@ only-elf
+//@ needs-dynamic-linking
+// FIXME(raw_dylib_elf): Debug the failures on other targets.
+//@ only-gnu
+//@ only-x86_64
+
+//@ revisions: with without
+
+//@ [without] build-fail
+//@ [without] regex-error-pattern:error: linking with `.*` failed
+//@ [without] dont-check-compiler-stderr
+
+//@ [with] build-pass
+
+//! Ensures that linking fails when there's an undefined symbol,
+//! and that it does succeed with raw-dylib.
+
+#![feature(raw_dylib_elf)]
+#![allow(incomplete_features)]
+
+#[cfg_attr(with, link(name = "rawdylibbutforcats", kind = "raw-dylib"))]
+#[cfg_attr(without, link(name = "rawdylibbutforcats"))]
+unsafe extern "C" {
+  safe fn meooooooooooooooow();
+}
+
+
+#[cfg_attr(with, link(name = "rawdylibbutfordogs", kind = "raw-dylib"))]
+#[cfg_attr(without, link(name = "rawdylibbutfordogs"))]
+unsafe extern "C" {
+  safe fn woooooooooooooooooof();
+}
+
+fn main() {
+  meooooooooooooooow();
+  woooooooooooooooooof();
+}