summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCWinCOFFStreamer.cpp
diff options
context:
space:
mode:
authorAdrian McCarthy <amccarth@google.com>2018-01-08 16:33:42 +0000
committerAdrian McCarthy <amccarth@google.com>2018-01-08 16:33:42 +0000
commitcf6e6c82c1ca243c3be191c59409d26f76ec8d38 (patch)
tree5c0a022d0d1b2d1c574af89040a379b6227deb0e /llvm/lib/MC/MCWinCOFFStreamer.cpp
parentf02ad15ff1dd84c73958c002966e3b61f8539f18 (diff)
downloadbcm5719-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 'llvm/lib/MC/MCWinCOFFStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCWinCOFFStreamer.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCWinCOFFStreamer.cpp b/llvm/lib/MC/MCWinCOFFStreamer.cpp
index c2583d95c5e..1f0b64dae73 100644
--- a/llvm/lib/MC/MCWinCOFFStreamer.cpp
+++ b/llvm/lib/MC/MCWinCOFFStreamer.cpp
@@ -193,6 +193,17 @@ void MCWinCOFFStreamer::EmitCOFFSafeSEH(MCSymbol const *Symbol) {
<< COFF::SCT_COMPLEX_TYPE_SHIFT);
}
+void MCWinCOFFStreamer::EmitCOFFSymbolIndex(MCSymbol const *Symbol) {
+ MCSection *Sec = getCurrentSectionOnly();
+ getAssembler().registerSection(*Sec);
+ if (Sec->getAlignment() < 4)
+ Sec->setAlignment(4);
+
+ new MCSymbolIdFragment(Symbol, getCurrentSectionOnly());
+
+ getAssembler().registerSymbol(*Symbol);
+}
+
void MCWinCOFFStreamer::EmitCOFFSectionIndex(const MCSymbol *Symbol) {
visitUsedSymbol(*Symbol);
MCDataFragment *DF = getOrCreateDataFragment();
OpenPOWER on IntegriCloud