[PS4] Disable LTO unit features under ThinLTO, like for Darwin.

llvm-svn: 307964
This commit is contained in:
Paul Robinson 2017-07-13 21:25:47 +00:00
parent eb370adeb6
commit d23f2a8ad5
2 changed files with 7 additions and 4 deletions

View File

@ -2070,10 +2070,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (D.isUsingLTO()) {
Args.AddLastArg(CmdArgs, options::OPT_flto, options::OPT_flto_EQ);
// The Darwin linker currently uses the legacy LTO API, which does not
// support LTO unit features (CFI, whole program vtable opt) under
// ThinLTO.
if (!getToolChain().getTriple().isOSDarwin() ||
// The Darwin and PS4 linkers currently use the legacy LTO API, which
// does not support LTO unit features (CFI, whole program vtable opt)
// under ThinLTO.
if (!(getToolChain().getTriple().isOSDarwin() ||
getToolChain().getTriple().isPS4()) ||
D.getLTOMode() == LTOK_Full)
CmdArgs.push_back("-flto-unit");
}

View File

@ -2,6 +2,8 @@
// RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin 2>&1 | FileCheck --check-prefix=UNIT %s
// RUN: %clang -target x86_64-apple-darwin13.3.0 -### %s -flto=full 2>&1 | FileCheck --check-prefix=UNIT %s
// RUN: %clang -target x86_64-apple-darwin13.3.0 -### %s -flto=thin 2>&1 | FileCheck --check-prefix=NOUNIT %s
// RUN: %clang -target x86_64-scei-ps4 -### %s -flto=full 2>&1 | FileCheck --check-prefix=UNIT %s
// RUN: %clang -target x86_64-scei-ps4 -### %s -flto=thin 2>&1 | FileCheck --check-prefix=NOUNIT %s
// UNIT: "-flto-unit"
// NOUNIT-NOT: "-flto-unit"