[PATCH] D132725: [llvm][CodeGen] Skip WinCFGuard on non-Windows targets

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 04:52:26 PDT 2022


aaron.ballman added reviewers: rjmccall, efriedma.
aaron.ballman added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:588-589
   // Emit tables for any value of cfguard flag (i.e. cfguard=1 or cfguard=2).
-  if (mdconst::extract_or_null<ConstantInt>(M.getModuleFlag("cfguard")))
+  if (Target.isOSWindows() &&
+      mdconst::extract_or_null<ConstantInt>(M.getModuleFlag("cfguard")))
     Handlers.emplace_back(std::make_unique<WinCFGuard>(this), CFGuardName,
----------------
CodeGen is not my area of strength, so this might be a silly question, but wouldn't it be better to prevent `cfguard` from being added to the module flags in the first place?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132725/new/

https://reviews.llvm.org/D132725



More information about the llvm-commits mailing list