Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -4551,10 +4551,11 @@ // Select the appropriate action. RewriteKind rewriteKind = RK_None; + bool DefaultUnified = Triple.isPS4(); bool UnifiedLTO = Args.hasFlag(options::OPT_funified_lto, options::OPT_fno_unified_lto, - false); + DefaultUnified); if (UnifiedLTO) CmdArgs.push_back("-funified-lto"); @@ -7043,7 +7044,8 @@ bool DefaultsSplitLTOUnit = (WholeProgramVTables || SanitizeArgs.needsLTO()) && - (LTOMode == LTOK_Full || TC.canSplitThinLTOUnit()); + (LTOMode == LTOK_Full || TC.canSplitThinLTOUnit()) || + UnifiedLTO; bool SplitLTOUnit = Args.hasFlag(options::OPT_fsplit_lto_unit, options::OPT_fno_split_lto_unit, DefaultsSplitLTOUnit); Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -1754,6 +1754,13 @@ Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << S; } + if (Opts.UnifiedLTO) { + if (T.getOS() == llvm::Triple::PS4) + Opts.EnableSplitLTOUnit = false; + else + Opts.EnableSplitLTOUnit = true; + } + if (Arg *A = Args.getLastArg(OPT_fthinlto_index_EQ)) { if (IK.getLanguage() != Language::LLVM_IR) Diags.Report(diag::err_drv_argument_only_allowed_with)