From: Reid Kleckner Date: Fri, 11 Nov 2016 19:18:45 +0000 (+0000) Subject: [sancov] Don't instrument MSVC CRT stdio config helpers X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d758cd3129b394ea5f342ea1075d8b9a3e2fec37;p=llvm [sancov] Don't instrument MSVC CRT stdio config helpers They get called before initialization, which is a problem for winasan. Test coming in compiler-rt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286615 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/lib/Transforms/Instrumentation/SanitizerCoverage.cpp index 93ca8668eaf..73881fa93ac 100644 --- a/lib/Transforms/Instrumentation/SanitizerCoverage.cpp +++ b/lib/Transforms/Instrumentation/SanitizerCoverage.cpp @@ -448,6 +448,11 @@ bool SanitizerCoverageModule::runOnFunction(Function &F) { return false; // Should not instrument sanitizer init functions. if (F.getName().startswith("__sanitizer_")) return false; // Don't instrument __sanitizer_* callbacks. + // Don't instrument MSVC CRT configuration helpers. They may run before normal + // initialization. + if (F.getName() == "__local_stdio_printf_options" || + F.getName() == "__local_stdio_scanf_options") + return false; // Don't instrument functions using SEH for now. Splitting basic blocks like // we do for coverage breaks WinEHPrepare. // FIXME: Remove this when SEH no longer uses landingpad pattern matching.