From ab5446c9923090d5ebe33aeea559d9c9fa05a1ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Wed, 1 Jan 2025 18:49:07 +0100 Subject: [PATCH] Actually use self-contained lld in bootstrap when `use-lld = "self-contained"` is used Before, we just used the global `lld` anyway. --- src/bootstrap/src/utils/helpers.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs index 923cc2dfc28..5ef8ea52084 100644 --- a/src/bootstrap/src/utils/helpers.rs +++ b/src/bootstrap/src/utils/helpers.rs @@ -475,7 +475,20 @@ pub fn linker_flags( ) -> Vec { let mut args = vec![]; if !builder.is_lld_direct_linker(target) && builder.config.lld_mode.is_used() { - args.push(String::from("-Clink-arg=-fuse-ld=lld")); + match builder.config.lld_mode { + LldMode::External => { + args.push("-Clinker-flavor=gnu-lld-cc".to_string()); + // FIXME(kobzol): remove this flag once MCP510 gets stabilized + args.push("-Zunstable-options".to_string()); + } + LldMode::SelfContained => { + args.push("-Clinker-flavor=gnu-lld-cc".to_string()); + args.push("-Clink-self-contained=+linker".to_string()); + // FIXME(kobzol): remove this flag once MCP510 gets stabilized + args.push("-Zunstable-options".to_string()); + } + LldMode::Unused => unreachable!(), + }; if matches!(lld_threads, LldThreads::No) { args.push(format!(