summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2017-01-18 23:55:27 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2017-01-18 23:55:27 +0000
commit1e1475ace580ef52a80b56376780259cfb4edd51 (patch)
treec268d7bd86ae1a61b543580db5465f703eabced4 /clang/lib/Driver/Tools.cpp
parent0a2174533e1743446a59625ca318c424bfaf0bf2 (diff)
downloadbcm5719-llvm-1e1475ace580ef52a80b56376780259cfb4edd51.tar.gz
bcm5719-llvm-1e1475ace580ef52a80b56376780259cfb4edd51.zip
Move vtable type metadata emission behind a cc1-level flag.
In ThinLTO mode, type metadata will require the module to be written as a multi-module bitcode file, which is currently incompatible with the Darwin linker. It is also useful to be able to enable or disable multi-module bitcode for testing purposes. This introduces a cc1-level flag, -f{,no-}lto-unit, which is used by the driver to enable multi-module bitcode on all but Darwin+ThinLTO, and can also be used to enable/disable the feature manually. Differential Revision: https://reviews.llvm.org/D28877 llvm-svn: 292448
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 78672b2544f..e7c6f22c95d 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -4238,8 +4238,16 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (JA.getType() == types::TY_LLVM_BC)
CmdArgs.push_back("-emit-llvm-uselists");
- if (D.isUsingLTO())
+ 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() ||
+ D.getLTOMode() == LTOK_Full)
+ CmdArgs.push_back("-flto-unit");
+ }
}
if (const Arg *A = Args.getLastArg(options::OPT_fthinlto_index_EQ)) {
OpenPOWER on IntegriCloud