Skip to content

Commit 027b28b

Browse files
committed
ensure correct linker gets chosen
1 parent 4b7b39c commit 027b28b

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

crates/intrinsic-test/src/main.rs

+16-9
Original file line numberDiff line numberDiff line change
@@ -395,24 +395,31 @@ path = "{intrinsic}/main.rs""#,
395395
/* If there has been a linker explicitly set from the command line then
396396
* we want to set it via setting it in the RUSTFLAGS*/
397397
let mut rust_flags = "-Cdebuginfo=0".to_string();
398-
if let Some(linker) = linker {
399-
rust_flags.push_str(" -Clinker=");
400-
rust_flags.push_str(linker);
401-
rust_flags.push_str(" -Clink-args=-static");
402-
}
403398

404399
let cargo_command = format!(
405400
"cargo {toolchain} build --target {target} --release",
406401
toolchain = toolchain,
407402
target = target
408403
);
409404

410-
let output = Command::new("sh")
405+
let mut command = Command::new("sh");
406+
407+
command
411408
.current_dir("rust_programs")
412409
.arg("-c")
413-
.arg(cargo_command)
414-
.env("RUSTFLAGS", rust_flags)
415-
.output();
410+
.arg(cargo_command);
411+
412+
if let Some(linker) = linker {
413+
rust_flags.push_str(" -C linker=");
414+
rust_flags.push_str(linker);
415+
rust_flags.push_str(" -C link-args=-static");
416+
417+
command.env("CPPFLAGS", "-fuse-ld=lld");
418+
}
419+
420+
command.env("RUSTFLAGS", rust_flags);
421+
let output = command.output();
422+
416423
if let Ok(output) = output {
417424
if output.status.success() {
418425
true

0 commit comments

Comments
 (0)