Update DynInit generation for ASan globals.

Address a follow-up TODO for Sanitizer Metadata.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D128672
This commit is contained in:
Mitch Phillips 2022-07-11 11:44:55 -07:00
parent dda208c51e
commit f18de7619e
1 changed files with 5 additions and 7 deletions

View File

@ -64,13 +64,11 @@ void SanitizerMetadata::reportGlobal(llvm::GlobalVariable *GV,
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 = IsDynInit && !Meta.NoAddress &&
FsanitizeArgument.has(SanitizerKind::Address) &&
!CGM.isInNoSanitizeList(SanitizerKind::Address |
SanitizerKind::KernelAddress,
GV, Loc, Ty, "init");
GV->setSanitizerMetadata(Meta);
}