1
Fork 0

implement opt out -Clink-self-contained=-linker

record both enabled and disabled components so that they can be merged
with the ones that the target spec will define
This commit is contained in:
Rémy Rakic 2023-09-20 20:25:17 +00:00
parent 2ce46f8e8c
commit 5b9aa26401
2 changed files with 34 additions and 15 deletions

View file

@ -2978,8 +2978,9 @@ fn add_lld_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
}
// 1. Implement the "self-contained" part of this feature by adding rustc distribution
// directories to the tool's search path.
if sess.opts.cg.link_self_contained.linker() {
// directories to the tool's search path:
// - if the self-contained linker is enabled on the CLI.
if sess.opts.cg.link_self_contained.is_linker_enabled() {
for path in sess.get_tools_search_paths(false) {
cmd.arg({
let mut arg = OsString::from("-B");
@ -2990,7 +2991,7 @@ fn add_lld_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
}
// 2. Implement the "linker flavor" part of this feature by asking `cc` to use some kind of
// `lld` as the linker.
// `lld` as the linker.
cmd.arg("-fuse-ld=lld");
if !flavor.is_gnu() {