Index: lib/fuzzer/FuzzerIOWindows.cpp =================================================================== --- lib/fuzzer/FuzzerIOWindows.cpp +++ lib/fuzzer/FuzzerIOWindows.cpp @@ -334,7 +334,7 @@ void RawPrint(const char *Str) { // Not tested, may or may not work. Fix if needed. - Printf("%s", Str); + write(2, Str, strlen(Str)); } } // namespace fuzzer Index: lib/fuzzer/FuzzerTracePC.cpp =================================================================== --- lib/fuzzer/FuzzerTracePC.cpp +++ lib/fuzzer/FuzzerTracePC.cpp @@ -403,9 +403,13 @@ } void WarnAboutDeprecatedInstrumentation(const char *flag) { - Printf("libFuzzer does not support %s any more.\n" - "Please either migrate to a compiler that supports -fsanitize=fuzzer\n" - "or use an older version of libFuzzer\n", flag); + // Use RawPrint because Printf cannot be used on Windows before OutputFile is + // initialized. + RawPrint(flag); + RawPrint( + " is no longer supported by libFuzzer.\n" + "Please either migrate to a compiler that supports -fsanitize=fuzzer\n" + "or use an older version of libFuzzer\n"); exit(1); } @@ -415,7 +419,8 @@ ATTRIBUTE_INTERFACE ATTRIBUTE_NO_SANITIZE_ALL void __sanitizer_cov_trace_pc_guard(uint32_t *Guard) { - fuzzer::WarnAboutDeprecatedInstrumentation("-fsanitize-coverage=trace-pc"); + fuzzer::WarnAboutDeprecatedInstrumentation( + "-fsanitize-coverage=trace-pc-guard"); } // Best-effort support for -fsanitize-coverage=trace-pc, which is available @@ -423,8 +428,7 @@ ATTRIBUTE_INTERFACE ATTRIBUTE_NO_SANITIZE_ALL void __sanitizer_cov_trace_pc() { - fuzzer::WarnAboutDeprecatedInstrumentation( - "-fsanitize-coverage=trace-pc-guard"); + fuzzer::WarnAboutDeprecatedInstrumentation("-fsanitize-coverage=trace-pc"); } ATTRIBUTE_INTERFACE Index: test/fuzzer/deprecated-instrumentation.test =================================================================== --- test/fuzzer/deprecated-instrumentation.test +++ test/fuzzer/deprecated-instrumentation.test @@ -1,4 +1,4 @@ -CHECK: libFuzzer does not support -fsanitize-coverage=trace-pc +CHECK: -fsanitize-coverage=trace-pc is no longer supported by libFuzzer RUN: %cpp_compiler %S/SimpleTest.cpp -c -o %t-SimpleTest.o -fsanitize-coverage=trace-pc RUN: %cpp_compiler %t-SimpleTest.o -o %t-SimpleTest RUN: not %run %t-SimpleTest 2>&1 | FileCheck %s