[PATCH] D40531: Emit function IDs table for Control Flow Guard

Adrian McCarthy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 15:34:14 PST 2017


amccarth marked 5 inline comments as done.
amccarth added a comment.

In https://reviews.llvm.org/D40531#939683, @rnk wrote:

> Take a look at llvm/lib/MC/MCParser/COFFAsmParser.cpp and add the .symidx directive following the example of ParseDirectiveSecIdx. You can test it in test/MC/COFF/symidx.s with llvm-readobj.


I've added the directive, but I'm not clear on what to do in the test.



================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:384-385
+    Handlers.push_back(HandlerInfo(new WinCFGuard(this), CFGuardName,
+                                   CFGuardDescription, DWARFGroupName,
+                                   DWARFGroupDescription));
+
----------------
rnk wrote:
> DWARFGroupName?
Yeah, I don't really know what those parameters do, so I copied what EH (including WinSEH) was doing just a few lines above.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/WinCFGuard.cpp:35
+  const Module *M = Asm->MMI->getModule();
+  if (mdconst::extract_or_null<ConstantInt>(M->getModuleFlag("cfguard"))) {
+    std::vector<const Function *> Functions;
----------------
rnk wrote:
> I think we can remove this check. If this was added to the AsmPrinterHandler list, then we've already done this check.
Done, but now I'm wondering if there was value in adding the cfguard flag to the module at all...


https://reviews.llvm.org/D40531





More information about the llvm-commits mailing list