Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
976 B
Rust
Raw Normal View History

2024-06-06 11:55:24 -04:00
// Passing linker arguments to the compiler used to be lost or reordered in a messy way
// as they were passed further to the linker. This was fixed in #70665, and this test
// checks that linker arguments remain intact and in the order they were originally passed in.
// See https://github.com/rust-lang/rust/pull/70665
2024-08-04 14:59:50 +00:00
use run_make_support::{is_msvc, rustc};
2024-06-06 11:55:24 -04:00
fn main() {
2024-08-04 14:59:50 +00:00
let linker = if is_msvc() { "msvc" } else { "ld" };
2024-06-06 15:20:42 -04:00
rustc()
.input("empty.rs")
2024-08-04 14:59:50 +00:00
.linker_flavor(linker)
2024-06-06 15:20:42 -04:00
.link_arg("a")
.link_args("b c")
.link_args("d e")
2024-06-06 15:20:42 -04:00
.link_arg("f")
.run_fail()
.assert_stderr_contains(r#""a" "b" "c" "d" "e" "f""#);
2024-06-06 15:20:42 -04:00
rustc()
.input("empty.rs")
2024-08-04 14:59:50 +00:00
.linker_flavor(linker)
.arg("-Zpre-link-arg=a")
.arg("-Zpre-link-args=b c")
.arg("-Zpre-link-args=d e")
.arg("-Zpre-link-arg=f")
2024-06-06 15:20:42 -04:00
.run_fail()
.assert_stderr_contains(r#""a" "b" "c" "d" "e" "f""#);
2024-06-06 11:55:24 -04:00
}