summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/fuzzer/FuzzerIOWindows.cpp2
-rw-r--r--compiler-rt/lib/fuzzer/FuzzerTracePC.cpp16
-rw-r--r--compiler-rt/test/fuzzer/deprecated-instrumentation.test2
3 files changed, 12 insertions, 8 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerIOWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerIOWindows.cpp
index 0595cc291ce..79dacd9765a 100644
--- a/compiler-rt/lib/fuzzer/FuzzerIOWindows.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerIOWindows.cpp
@@ -334,7 +334,7 @@ bool IsInterestingCoverageFile(const std::string &FileName) {
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
diff --git a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
index 34a07b87a6d..d2edb00445d 100644
--- a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
@@ -403,9 +403,13 @@ uintptr_t TracePC::GetMaxStackOffset() const {
}
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 @@ extern "C" {
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 @@ void __sanitizer_cov_trace_pc_guard(uint32_t *Guard) {
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
diff --git a/compiler-rt/test/fuzzer/deprecated-instrumentation.test b/compiler-rt/test/fuzzer/deprecated-instrumentation.test
index 7192aba556a..d65abcd772b 100644
--- a/compiler-rt/test/fuzzer/deprecated-instrumentation.test
+++ b/compiler-rt/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
OpenPOWER on IntegriCloud