summaryrefslogtreecommitdiffstats
path: root/tests/run-make/link-dedup
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
commit1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch)
tree3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /tests/run-make/link-dedup
parentReleasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz
rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-make/link-dedup')
-rw-r--r--tests/run-make/link-dedup/Makefile12
-rw-r--r--tests/run-make/link-dedup/depa.rs10
-rw-r--r--tests/run-make/link-dedup/depb.rs8
-rw-r--r--tests/run-make/link-dedup/depc.rs4
-rw-r--r--tests/run-make/link-dedup/empty.rs5
5 files changed, 39 insertions, 0 deletions
diff --git a/tests/run-make/link-dedup/Makefile b/tests/run-make/link-dedup/Makefile
new file mode 100644
index 000000000..eff18ab48
--- /dev/null
+++ b/tests/run-make/link-dedup/Makefile
@@ -0,0 +1,12 @@
+# ignore-msvc
+
+include ../tools.mk
+
+all:
+ $(RUSTC) depa.rs
+ $(RUSTC) depb.rs
+ $(RUSTC) depc.rs
+ $(RUSTC) empty.rs --cfg bar 2>&1 | $(CGREP) '"-ltesta" "-ltestb" "-ltesta"'
+ $(RUSTC) empty.rs 2>&1 | $(CGREP) '"-ltesta"'
+ $(RUSTC) empty.rs 2>&1 | $(CGREP) -v '"-ltestb"'
+ $(RUSTC) empty.rs 2>&1 | $(CGREP) -v '"-ltesta" "-ltesta" "-ltesta"'
diff --git a/tests/run-make/link-dedup/depa.rs b/tests/run-make/link-dedup/depa.rs
new file mode 100644
index 000000000..19178c5bd
--- /dev/null
+++ b/tests/run-make/link-dedup/depa.rs
@@ -0,0 +1,10 @@
+#![crate_type = "rlib"]
+
+#[link(name = "testa")]
+extern "C" {}
+
+#[link(name = "testa")]
+extern "C" {}
+
+#[link(name = "testa")]
+extern "C" {}
diff --git a/tests/run-make/link-dedup/depb.rs b/tests/run-make/link-dedup/depb.rs
new file mode 100644
index 000000000..b1be21fe0
--- /dev/null
+++ b/tests/run-make/link-dedup/depb.rs
@@ -0,0 +1,8 @@
+#![feature(link_cfg)]
+#![crate_type = "rlib"]
+
+#[link(name = "testb", cfg(foo))]
+extern "C" {}
+
+#[link(name = "testb", cfg(bar))]
+extern "C" {}
diff --git a/tests/run-make/link-dedup/depc.rs b/tests/run-make/link-dedup/depc.rs
new file mode 100644
index 000000000..8dcb3dee5
--- /dev/null
+++ b/tests/run-make/link-dedup/depc.rs
@@ -0,0 +1,4 @@
+#![crate_type = "rlib"]
+
+#[link(name = "testa")]
+extern "C" {}
diff --git a/tests/run-make/link-dedup/empty.rs b/tests/run-make/link-dedup/empty.rs
new file mode 100644
index 000000000..e00ae18f4
--- /dev/null
+++ b/tests/run-make/link-dedup/empty.rs
@@ -0,0 +1,5 @@
+extern crate depa;
+extern crate depb;
+extern crate depc;
+
+fn main() {}