rust-lld: fallback to the default default sysroot where rustc is currently located
This commit is contained in:
parent
6867d6492b
commit
fab28f2a4d
2 changed files with 26 additions and 9 deletions
|
@ -3116,13 +3116,21 @@ fn add_lld_args(
|
|||
|
||||
let self_contained_linker = self_contained_cli || self_contained_target;
|
||||
if self_contained_linker && !sess.opts.cg.link_self_contained.is_linker_disabled() {
|
||||
let mut linker_path_exists = false;
|
||||
for path in sess.get_tools_search_paths(false) {
|
||||
let linker_path = path.join("gcc-ld");
|
||||
linker_path_exists |= linker_path.exists();
|
||||
cmd.arg({
|
||||
let mut arg = OsString::from("-B");
|
||||
arg.push(path.join("gcc-ld"));
|
||||
arg.push(linker_path);
|
||||
arg
|
||||
});
|
||||
}
|
||||
if !linker_path_exists {
|
||||
// As an additional sanity check, we do nothing if the sysroot doesn't contain the
|
||||
// linker path at all.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Implement the "linker flavor" part of this feature by asking `cc` to use some kind of
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue