[PATCH] D128672: Update DynInit generation for ASan globals.

Mitch Phillips via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 27 10:43:34 PDT 2022


hctim created this revision.
hctim added a reviewer: vitalybuka.
Herald added a project: All.
hctim requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Address a follow-up TODO for Sanitizer Metadata.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128672

Files:
  clang/lib/CodeGen/SanitizerMetadata.cpp


Index: clang/lib/CodeGen/SanitizerMetadata.cpp
===================================================================
--- clang/lib/CodeGen/SanitizerMetadata.cpp
+++ clang/lib/CodeGen/SanitizerMetadata.cpp
@@ -64,13 +64,11 @@
   Meta.NoMemtag |= CGM.isInNoSanitizeList(
       FsanitizeArgument.Mask & SanitizerKind::MemTag, GV, Loc, Ty);
 
-  if (FsanitizeArgument.has(SanitizerKind::Address)) {
-    // TODO(hctim): Make this conditional when we migrate off llvm.asan.globals.
-    IsDynInit &= !CGM.isInNoSanitizeList(SanitizerKind::Address |
-                                             SanitizerKind::KernelAddress,
-                                         GV, Loc, Ty, "init");
-    Meta.IsDynInit = IsDynInit;
-  }
+  Meta.IsDynInit = FsanitizeArgument.has(SanitizerKind::Address) && IsDynInit &&
+                   !Meta.NoAddress &&
+                   !CGM.isInNoSanitizeList(SanitizerKind::Address |
+                                               SanitizerKind::KernelAddress,
+                                           GV, Loc, Ty, "init");
 
   GV->setSanitizerMetadata(Meta);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128672.440309.patch
Type: text/x-patch
Size: 1095 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220627/11871bcf/attachment.bin>


More information about the cfe-commits mailing list