Skip to content

Commit f18de76

Browse files
committed
Update DynInit generation for ASan globals.
Address a follow-up TODO for Sanitizer Metadata. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D128672
1 parent dda208c commit f18de76

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

clang/lib/CodeGen/SanitizerMetadata.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,11 @@ void SanitizerMetadata::reportGlobal(llvm::GlobalVariable *GV,
6464
Meta.NoMemtag |= CGM.isInNoSanitizeList(
6565
FsanitizeArgument.Mask & SanitizerKind::MemTag, GV, Loc, Ty);
6666

67-
if (FsanitizeArgument.has(SanitizerKind::Address)) {
68-
// TODO(hctim): Make this conditional when we migrate off llvm.asan.globals.
69-
IsDynInit &= !CGM.isInNoSanitizeList(SanitizerKind::Address |
70-
SanitizerKind::KernelAddress,
71-
GV, Loc, Ty, "init");
72-
Meta.IsDynInit = IsDynInit;
73-
}
67+
Meta.IsDynInit = IsDynInit && !Meta.NoAddress &&
68+
FsanitizeArgument.has(SanitizerKind::Address) &&
69+
!CGM.isInNoSanitizeList(SanitizerKind::Address |
70+
SanitizerKind::KernelAddress,
71+
GV, Loc, Ty, "init");
7472

7573
GV->setSanitizerMetadata(Meta);
7674
}

0 commit comments

Comments
 (0)