about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Denton <chris@chrisdenton.dev>2025-04-28 23:29:19 +0000
committerGitHub <noreply@github.com>2025-04-28 23:29:19 +0000
commit469f03da6c778f5d99e7dcee3ad3c302a4f0f8f2 (patch)
tree1751fecc5056e46653ebc938a989091029c30e21
parentec2dad74a8ddc8117356faa48c4fea12dac1dd5c (diff)
parent3c42dc24ae23d2501aaae81273762d0698d83ff7 (diff)
downloadrust-469f03da6c778f5d99e7dcee3ad3c302a4f0f8f2.tar.gz
rust-469f03da6c778f5d99e7dcee3ad3c302a4f0f8f2.zip
Rollup merge of #140396 - ChrisDenton:gnu-threads, r=jieyouxu
Workaround for windows-gnu rust-lld test failure

The test run-make/amdgpu-kd has an issue on windows-gnu where rust-lld will sometimes fail with error 0xc0000374 (`STATUS_HEAP_CORRUPTION`).

This works around the issue by passing `--threads=1` to the linker as suggested [here](https://github.com/rust-lang/rust/issues/115985#issuecomment-1754112623). Note I don't know if this will help and it happens only sometimes in our CI so it's hard to test.
-rw-r--r--tests/run-make/amdgpu-kd/rmake.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/run-make/amdgpu-kd/rmake.rs b/tests/run-make/amdgpu-kd/rmake.rs
index a787fa1da93..cba9030641d 100644
--- a/tests/run-make/amdgpu-kd/rmake.rs
+++ b/tests/run-make/amdgpu-kd/rmake.rs
@@ -6,13 +6,19 @@
 //@ needs-llvm-components: amdgpu
 //@ needs-rust-lld
 
+use run_make_support::targets::is_windows_gnu;
 use run_make_support::{llvm_readobj, rustc};
 
 fn main() {
+    // FIXME(#115985): rust-lld on gnu targets may spuriously fail with
+    // STATUS_HEAP_CORRUPTION (0xc0000374).
+    // To try to mitigate this we pass --threads=1 to the linker.
+    let extra_args: &[&str] = if is_windows_gnu() { &["-C", "link-arg=--threads=1"] } else { &[] };
     rustc()
         .crate_name("foo")
         .target("amdgcn-amd-amdhsa")
         .arg("-Ctarget-cpu=gfx900")
+        .args(&extra_args)
         .crate_type("cdylib")
         .input("foo.rs")
         .run();