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
This commit is contained in:
León Orell Valerian Liehr 2024-10-23 22:11:04 +02:00 committed by GitHub
commit f3d4887a4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,7 @@
#[no_mangle]
fn foo() {}
#[no_mangle]
fn bar() {}
fn main() {}

View File

@ -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();
}

View File

@ -0,0 +1 @@
PROVIDE(foo = bar);