about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2024-10-23 22:11:04 +0200
committerGitHub <noreply@github.com>2024-10-23 22:11:04 +0200
commitf3d4887a4afe5979a7e74ca62d8eb45234e14580 (patch)
treed9fef97e4f3d7de1ff05cf89d791255c543e6bc0
parent6b70ff44bc99daf158bc004e0d2d828c57657897 (diff)
parent6570a6fe92002d352fecbaad0176c678030c6d2e (diff)
downloadrust-f3d4887a4afe5979a7e74ca62d8eb45234e14580.tar.gz
rust-f3d4887a4afe5979a7e74ca62d8eb45234e14580.zip
Rollup merge of #132036 - DianQK:test-131164, r=jieyouxu
Add a test case for #131164

The upstream has already been fixed, but it won't be backported to LLVM 19.

r? jieyouxu or compiler

try-job: x86_64-gnu-stable
-rw-r--r--tests/run-make/rust-lld-link-script-provide/main.rs7
-rw-r--r--tests/run-make/rust-lld-link-script-provide/rmake.rs18
-rw-r--r--tests/run-make/rust-lld-link-script-provide/script.t1
3 files changed, 26 insertions, 0 deletions
diff --git a/tests/run-make/rust-lld-link-script-provide/main.rs b/tests/run-make/rust-lld-link-script-provide/main.rs
new file mode 100644
index 00000000000..5c19e7a4bbf
--- /dev/null
+++ b/tests/run-make/rust-lld-link-script-provide/main.rs
@@ -0,0 +1,7 @@
+#[no_mangle]
+fn foo() {}
+
+#[no_mangle]
+fn bar() {}
+
+fn main() {}
diff --git a/tests/run-make/rust-lld-link-script-provide/rmake.rs b/tests/run-make/rust-lld-link-script-provide/rmake.rs
new file mode 100644
index 00000000000..e78a411bc15
--- /dev/null
+++ b/tests/run-make/rust-lld-link-script-provide/rmake.rs
@@ -0,0 +1,18 @@
+// This test ensures that the “symbol not found” error does not occur
+// when the symbols in the `PROVIDE` of the link script can be eliminated.
+// This is a regression test for #131164.
+
+//@ needs-rust-lld
+//@ only-x86_64-unknown-linux-gnu
+
+use run_make_support::rustc;
+
+fn main() {
+    rustc()
+        .input("main.rs")
+        .arg("-Zlinker-features=+lld")
+        .arg("-Clink-self-contained=+linker")
+        .arg("-Zunstable-options")
+        .link_arg("-Tscript.t")
+        .run();
+}
diff --git a/tests/run-make/rust-lld-link-script-provide/script.t b/tests/run-make/rust-lld-link-script-provide/script.t
new file mode 100644
index 00000000000..4c4c6ddfc36
--- /dev/null
+++ b/tests/run-make/rust-lld-link-script-provide/script.t
@@ -0,0 +1 @@
+PROVIDE(foo = bar);