summaryrefslogtreecommitdiffstats
path: root/tests/run-make/extern-flag-pathless
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/extern-flag-pathless
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/extern-flag-pathless')
-rw-r--r--tests/run-make/extern-flag-pathless/Makefile19
-rw-r--r--tests/run-make/extern-flag-pathless/bar-dynamic.rs3
-rw-r--r--tests/run-make/extern-flag-pathless/bar-static.rs3
-rw-r--r--tests/run-make/extern-flag-pathless/foo.rs3
4 files changed, 28 insertions, 0 deletions
diff --git a/tests/run-make/extern-flag-pathless/Makefile b/tests/run-make/extern-flag-pathless/Makefile
new file mode 100644
index 000000000..701bfcd28
--- /dev/null
+++ b/tests/run-make/extern-flag-pathless/Makefile
@@ -0,0 +1,19 @@
+# ignore-cross-compile
+include ../tools.mk
+
+# Test mixing pathless --extern with paths.
+
+all:
+ $(RUSTC) bar-static.rs --crate-name=bar --crate-type=rlib
+ $(RUSTC) bar-dynamic.rs --crate-name=bar --crate-type=dylib -C prefer-dynamic
+ # rlib preferred over dylib
+ $(RUSTC) foo.rs --extern bar
+ $(call RUN,foo) | $(CGREP) 'static'
+ $(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib --extern bar
+ $(call RUN,foo) | $(CGREP) 'static'
+ # explicit --extern overrides pathless
+ $(RUSTC) foo.rs --extern bar=$(call DYLIB,bar) --extern bar
+ $(call RUN,foo) | $(CGREP) 'dynamic'
+ # prefer-dynamic does what it says
+ $(RUSTC) foo.rs --extern bar -C prefer-dynamic
+ $(call RUN,foo) | $(CGREP) 'dynamic'
diff --git a/tests/run-make/extern-flag-pathless/bar-dynamic.rs b/tests/run-make/extern-flag-pathless/bar-dynamic.rs
new file mode 100644
index 000000000..e2d68d517
--- /dev/null
+++ b/tests/run-make/extern-flag-pathless/bar-dynamic.rs
@@ -0,0 +1,3 @@
+pub fn f() {
+ println!("dynamic");
+}
diff --git a/tests/run-make/extern-flag-pathless/bar-static.rs b/tests/run-make/extern-flag-pathless/bar-static.rs
new file mode 100644
index 000000000..240d8bde4
--- /dev/null
+++ b/tests/run-make/extern-flag-pathless/bar-static.rs
@@ -0,0 +1,3 @@
+pub fn f() {
+ println!("static");
+}
diff --git a/tests/run-make/extern-flag-pathless/foo.rs b/tests/run-make/extern-flag-pathless/foo.rs
new file mode 100644
index 000000000..1ea64da7d
--- /dev/null
+++ b/tests/run-make/extern-flag-pathless/foo.rs
@@ -0,0 +1,3 @@
+fn main() {
+ bar::f();
+}