Skip to content

Commit ab5446c

Browse files
committed
Actually use self-contained lld in bootstrap when use-lld = "self-contained" is used
Before, we just used the global `lld` anyway.
1 parent eeeff9a commit ab5446c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/bootstrap/src/utils/helpers.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,20 @@ pub fn linker_flags(
475475
) -> Vec<String> {
476476
let mut args = vec![];
477477
if !builder.is_lld_direct_linker(target) && builder.config.lld_mode.is_used() {
478-
args.push(String::from("-Clink-arg=-fuse-ld=lld"));
478+
match builder.config.lld_mode {
479+
LldMode::External => {
480+
args.push("-Clinker-flavor=gnu-lld-cc".to_string());
481+
// FIXME(kobzol): remove this flag once MCP510 gets stabilized
482+
args.push("-Zunstable-options".to_string());
483+
}
484+
LldMode::SelfContained => {
485+
args.push("-Clinker-flavor=gnu-lld-cc".to_string());
486+
args.push("-Clink-self-contained=+linker".to_string());
487+
// FIXME(kobzol): remove this flag once MCP510 gets stabilized
488+
args.push("-Zunstable-options".to_string());
489+
}
490+
LldMode::Unused => unreachable!(),
491+
};
479492

480493
if matches!(lld_threads, LldThreads::No) {
481494
args.push(format!(

0 commit comments

Comments
 (0)