Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit a33e79a

Browse files
committed
bootstrap: introduce rust-lld cfg for rustc
1 parent ba45208 commit a33e79a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,10 @@ pub fn rustc_cargo_env(
10341034
cargo.rustflag("--cfg=parallel_compiler");
10351035
cargo.rustdocflag("--cfg=parallel_compiler");
10361036
}
1037+
if builder.config.lld_enabled {
1038+
cargo.rustflag("--cfg=rust_lld");
1039+
cargo.rustdocflag("--cfg=rust_lld");
1040+
}
10371041
if builder.config.rust_verify_llvm_ir {
10381042
cargo.env("RUSTC_VERIFY_LLVM_IR", "1");
10391043
}

src/bootstrap/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &str, Option<&[&'static str]>)] = &[
117117
// Needed to avoid the need to copy windows.lib into the sysroot.
118118
(Some(Mode::Rustc), "windows_raw_dylib", None),
119119
(Some(Mode::ToolRustc), "windows_raw_dylib", None),
120+
// If rustc wants to use rust-lld as the default linker in a target spec.
121+
(Some(Mode::Rustc), "rust_lld", None),
122+
(Some(Mode::ToolRustc), "rust_lld", None),
123+
(Some(Mode::Codegen), "rust_lld", None),
120124
];
121125

122126
/// A structure representing a Rust compiler.

0 commit comments

Comments
 (0)