]> granicus.if.org Git - clang/commitdiff
[ThinLTOCodeGenerator] Add support for index-based WPD
authorEugene Leviant <eleviant@accesssoftek.com>
Fri, 18 Oct 2019 11:58:21 +0000 (11:58 +0000)
committerEugene Leviant <eleviant@accesssoftek.com>
Fri, 18 Oct 2019 11:58:21 +0000 (11:58 +0000)
This is clang part of the patch. It adds -flto-unit flag for thin LTO
builds on Mac and PS4

Differential revision: https://reviews.llvm.org/D68950

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@375224 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/Clang.cpp
test/Driver/lto-unit.c

index bfccf7a1dbb66c358328010f7594bd8aff7472d1..55d631733add24db9c8482775920a03f5d2d1461 100644 (file)
@@ -3631,13 +3631,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
 
     if (D.isUsingLTO() && !isDeviceOffloadAction) {
       Args.AddLastArg(CmdArgs, options::OPT_flto, options::OPT_flto_EQ);
-
-      // 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 (!(RawTriple.isOSDarwin() || RawTriple.isPS4()) ||
-          D.getLTOMode() == LTOK_Full)
-        CmdArgs.push_back("-flto-unit");
+      CmdArgs.push_back("-flto-unit");
     }
   }
 
index 1f1a2861670e4ce9e8b0ac092008c7c47ba9272f..0fdd493888d9eb0d5d2c1fe816c1f74cf69a515d 100644 (file)
@@ -1,9 +1,8 @@
 // RUN: %clang -target x86_64-unknown-linux -### %s -flto=full 2>&1 | FileCheck --check-prefix=UNIT %s
 // 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-apple-darwin13.3.0 -### %s -flto=thin 2>&1 | FileCheck --check-prefix=UNIT %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
+// RUN: %clang -target x86_64-scei-ps4 -### %s -flto=thin 2>&1 | FileCheck --check-prefix=UNIT %s
 
 // UNIT: "-flto-unit"
-// NOUNIT-NOT: "-flto-unit"