summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorAdrian McCarthy <amccarth@google.com>2018-01-09 23:49:30 +0000
committerAdrian McCarthy <amccarth@google.com>2018-01-09 23:49:30 +0000
commitdb2736ddd864925ddecf548b052464699445858f (patch)
tree950da220900c3cbb167b1c8e0be2e737c2ea64e1 /clang/lib/CodeGen/CodeGenModule.cpp
parentea7caceedcc8d872bc31c141515ef2e3749ef659 (diff)
downloadbcm5719-llvm-db2736ddd864925ddecf548b052464699445858f.tar.gz
bcm5719-llvm-db2736ddd864925ddecf548b052464699445858f.zip
Reland "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. The original patch didn't have the lit.local.cfg file that restricts the new test to x86, thus the new test was failing on the non-x86 bots. Differential Revision: https://reviews.llvm.org/D40531 The reverts r322008, which was a revert of r322005. This reverts commit a05b89f9aca70597dc79fe97bc49b50b51f525ba. llvm-svn: 322136
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index b08ead80c1c..acf6e4d63cc 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -457,6 +457,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
OpenPOWER on IntegriCloud