[llvm] r257482 - [libFuzzer] add a macro LLVM_FUZZER_DEFINES_SANITIZER_WEAK_HOOOKS

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 12 08:50:19 PST 2016


Author: kcc
Date: Tue Jan 12 10:50:18 2016
New Revision: 257482

URL: http://llvm.org/viewvc/llvm-project?rev=257482&view=rev
Log:
[libFuzzer] add a macro LLVM_FUZZER_DEFINES_SANITIZER_WEAK_HOOOKS

Modified:
    llvm/trunk/lib/Fuzzer/FuzzerTraceState.cpp

Modified: llvm/trunk/lib/Fuzzer/FuzzerTraceState.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerTraceState.cpp?rev=257482&r1=257481&r2=257482&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerTraceState.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerTraceState.cpp Tue Jan 12 10:50:18 2016
@@ -542,6 +542,12 @@ void dfsan_weak_hook_strcmp(void *caller
                           reinterpret_cast<const uint8_t *>(s2), L1, L2);
 }
 
+// We may need to avoid defining weak hooks to stay compatible with older clang.
+#ifndef LLVM_FUZZER_DEFINES_SANITIZER_WEAK_HOOOKS
+# define LLVM_FUZZER_DEFINES_SANITIZER_WEAK_HOOOKS 1
+#endif
+
+#if LLVM_FUZZER_DEFINES_SANITIZER_WEAK_HOOOKS
 void __sanitizer_weak_hook_memcmp(void *caller_pc, const void *s1,
                                   const void *s2, size_t n, int result) {
   if (!TS) return;
@@ -576,6 +582,8 @@ void __sanitizer_weak_hook_strcmp(void *
                           reinterpret_cast<const uint8_t *>(s2));
 }
 
+#endif  // LLVM_FUZZER_DEFINES_SANITIZER_WEAK_HOOOKS
+
 __attribute__((visibility("default")))
 void __sanitizer_cov_trace_cmp(uint64_t SizeAndType, uint64_t Arg1,
                                uint64_t Arg2) {




More information about the llvm-commits mailing list