summaryrefslogtreecommitdiffstats
path: root/tests/run-make/native-link-modifier-verbatim-rustc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/run-make/native-link-modifier-verbatim-rustc
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-make/native-link-modifier-verbatim-rustc')
-rw-r--r--tests/run-make/native-link-modifier-verbatim-rustc/Makefile12
-rw-r--r--tests/run-make/native-link-modifier-verbatim-rustc/rust_dep.rs9
-rw-r--r--tests/run-make/native-link-modifier-verbatim-rustc/upstream_native_dep.rs4
3 files changed, 25 insertions, 0 deletions
diff --git a/tests/run-make/native-link-modifier-verbatim-rustc/Makefile b/tests/run-make/native-link-modifier-verbatim-rustc/Makefile
new file mode 100644
index 000000000..6f01f3780
--- /dev/null
+++ b/tests/run-make/native-link-modifier-verbatim-rustc/Makefile
@@ -0,0 +1,12 @@
+include ../../run-make-fulldeps/tools.mk
+
+all:
+ # Verbatim allows specify precise name.
+ $(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/upstream_some_strange_name.ext
+ $(RUSTC) rust_dep.rs -l static:+verbatim=upstream_some_strange_name.ext --crate-type rlib
+
+ # With verbatim any other name cannot be used (upstream).
+ $(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/libupstream_native_dep.a
+ $(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/upstream_native_dep.a
+ $(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/upstream_native_dep.lib
+ $(RUSTC) rust_dep.rs -l static:+verbatim=upstream_native_dep --crate-type rlib 2>&1 | $(CGREP) "upstream_native_dep"
diff --git a/tests/run-make/native-link-modifier-verbatim-rustc/rust_dep.rs b/tests/run-make/native-link-modifier-verbatim-rustc/rust_dep.rs
new file mode 100644
index 000000000..e9517218e
--- /dev/null
+++ b/tests/run-make/native-link-modifier-verbatim-rustc/rust_dep.rs
@@ -0,0 +1,9 @@
+extern "C" {
+ fn upstream_native_f() -> i32;
+}
+
+pub fn rust_dep() {
+ unsafe {
+ assert!(upstream_native_f() == 0);
+ }
+}
diff --git a/tests/run-make/native-link-modifier-verbatim-rustc/upstream_native_dep.rs b/tests/run-make/native-link-modifier-verbatim-rustc/upstream_native_dep.rs
new file mode 100644
index 000000000..839686233
--- /dev/null
+++ b/tests/run-make/native-link-modifier-verbatim-rustc/upstream_native_dep.rs
@@ -0,0 +1,4 @@
+#[no_mangle]
+pub fn upstream_native_f() -> i32 {
+ return 0;
+}