[PS4][clang] Limit ThinLTO parallelism when requested

Pass the correct option to the linker when "-flto-jobs=" is passed to
the driver.
This commit is contained in:
Matthew Voss 2023-03-29 09:36:46 -07:00
parent 6f2a865d2f
commit bbc204b944
2 changed files with 9 additions and 0 deletions

View File

@ -187,6 +187,12 @@ void tools::PScpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
AddCodeGenFlag(Twine("-crash-diagnostics-dir=") + A->getValue());
}
if (IsPS5 && UseLTO) {
StringRef Parallelism = getLTOParallelism(Args, D);
if (!Parallelism.empty())
CmdArgs.push_back(Args.MakeArgString("-plugin-opt=jobs=" + Parallelism));
}
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs))
TC.addSanitizerArgs(Args, CmdArgs, "-l", "");

View File

@ -3,6 +3,9 @@
// RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin -flto-jobs=5 2> %t
// RUN: FileCheck -check-prefix=CHECK-LINK-THIN-JOBS-ACTION < %t %s
//
// RUN: %clang -target x86_64-sie-ps5 -### %s -flto=thin -flto-jobs=5 2> %t
// RUN: FileCheck -check-prefix=CHECK-LINK-THIN-JOBS-ACTION < %t %s
//
// CHECK-LINK-THIN-JOBS-ACTION: "-plugin-opt=jobs=5"
// RUN: %clang -target x86_64-apple-darwin13.3.0 -### %s -flto=thin -flto-jobs=5 2> %t