Skip to content

Commit

Permalink
[PS4][clang] Limit ThinLTO parallelism when requested
Browse files Browse the repository at this point in the history
Pass the correct option to the linker when "-flto-jobs=" is passed to
the driver.
  • Loading branch information
ormris committed Mar 29, 2023
1 parent 6f2a865 commit bbc204b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions clang/lib/Driver/ToolChains/PS4CPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", "");

Expand Down
3 changes: 3 additions & 0 deletions clang/test/Driver/lto-jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bbc204b

Please sign in to comment.