[LTO] Driver support for -lto_library flag

This commit adds support for the -lto_library flag, allowing users to specify a custom LTO library on Darwin. This also fixes an issue where the default LTO library is used even if Driver is run from inside an alternate toolchain.
This commit is contained in:
Jeremy Legendre
2021-07-05 18:01:40 -04:00
parent 910d9184ef
commit 35735e7d0c
5 changed files with 49 additions and 3 deletions

View File

@@ -1448,6 +1448,12 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args,
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
A->getAsString(Args), A->getValue());
}
if (const Arg *A = Args.getLastArg(options::OPT_lto_library)) {
OI.LibLTOPath = A->getValue();
} else {
OI.LibLTOPath = "";
}
auto CompilerOutputType = OI.LTOVariant != OutputInfo::LTOKind::None
? file_types::TY_LLVM_BC