diff options
author | Adrian McCarthy <amccarth@google.com> | 2018-01-08 16:33:42 +0000 |
---|---|---|
committer | Adrian McCarthy <amccarth@google.com> | 2018-01-08 16:33:42 +0000 |
commit | cf6e6c82c1ca243c3be191c59409d26f76ec8d38 (patch) | |
tree | 5c0a022d0d1b2d1c574af89040a379b6227deb0e /clang/lib/CodeGen | |
parent | f02ad15ff1dd84c73958c002966e3b61f8539f18 (diff) | |
download | bcm5719-llvm-cf6e6c82c1ca243c3be191c59409d26f76ec8d38.tar.gz bcm5719-llvm-cf6e6c82c1ca243c3be191c59409d26f76ec8d38.zip |
Emit Function IDs table for Control Flow Guard
Adds option /guard:cf to clang-cl and -cfguard to cc1 to emit function IDs
of functions that have their address taken into a section named .gfids$y for
compatibility with Microsoft's Control Flow Guard feature.
Differential Revision: https://reviews.llvm.org/D40531
llvm-svn: 322005
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index df33fc3e820..0a417548d4d 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -456,6 +456,10 @@ void CodeGenModule::Release() { // Indicate that we want CodeView in the metadata. getModule().addModuleFlag(llvm::Module::Warning, "CodeView", 1); } + if (CodeGenOpts.ControlFlowGuard) { + // We want function ID tables for Control Flow Guard. + getModule().addModuleFlag(llvm::Module::Warning, "cfguard", 1); + } if (CodeGenOpts.OptimizationLevel > 0 && CodeGenOpts.StrictVTablePointers) { // We don't support LTO with 2 with different StrictVTablePointers // FIXME: we could support it by stripping all the information introduced |