Revert "Run Coverage pass before other *San passes under new pass manager"

This reverts commit 7d5bb94d78.

Reverting since this leads to a linker error we're seeing on Fuchsia.
The underlying issue seems to be that inlining is run after sanitizers
and causes different comdat groups instrumented by Sancov to reference
non-key symbols defined in other comdat groups.

Will re-land this patch after a fix for that is landed.
This commit is contained in:
Leonard Chan 2020-05-14 15:19:27 -07:00
parent 05eedf1f5b
commit e9802aa422
1 changed files with 9 additions and 20 deletions
clang/lib/CodeGen

View File

@ -1001,15 +1001,6 @@ static void addSanitizersAtO0(ModulePassManager &MPM,
const Triple &TargetTriple,
const LangOptions &LangOpts,
const CodeGenOptions &CodeGenOpts) {
if (CodeGenOpts.SanitizeCoverageType ||
CodeGenOpts.SanitizeCoverageIndirectCalls ||
CodeGenOpts.SanitizeCoverageTraceCmp) {
auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
MPM.addPass(ModuleSanitizerCoveragePass(
SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
CodeGenOpts.SanitizeCoverageBlacklistFiles));
}
auto ASanPass = [&](SanitizerMask Mask, bool CompileKernel) {
MPM.addPass(RequireAnalysisPass<ASanGlobalsMetadataAnalysis, Module>());
bool Recover = CodeGenOpts.SanitizeRecover.has(Mask);
@ -1250,17 +1241,6 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager(
EntryExitInstrumenterPass(/*PostInlining=*/false)));
});
if (CodeGenOpts.SanitizeCoverageType ||
CodeGenOpts.SanitizeCoverageIndirectCalls ||
CodeGenOpts.SanitizeCoverageTraceCmp) {
PB.registerPipelineStartEPCallback([&](ModulePassManager &MPM) {
auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
MPM.addPass(ModuleSanitizerCoveragePass(
SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
CodeGenOpts.SanitizeCoverageBlacklistFiles));
});
}
// Register callbacks to schedule sanitizer passes at the appropriate part of
// the pipeline.
// FIXME: either handle asan/the remaining sanitizers or error out
@ -1345,6 +1325,15 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager(
}
}
if (CodeGenOpts.SanitizeCoverageType ||
CodeGenOpts.SanitizeCoverageIndirectCalls ||
CodeGenOpts.SanitizeCoverageTraceCmp) {
auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
MPM.addPass(ModuleSanitizerCoveragePass(
SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
CodeGenOpts.SanitizeCoverageBlacklistFiles));
}
if (LangOpts.Sanitize.has(SanitizerKind::HWAddress)) {
bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::HWAddress);
MPM.addPass(HWAddressSanitizerPass(