From 53ff84bf1123f2c211f641f73e22290a13eee669 Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Tue, 12 Jan 2016 16:50:18 +0000 Subject: [PATCH] [libFuzzer] add a macro LLVM_FUZZER_DEFINES_SANITIZER_WEAK_HOOOKS git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257482 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Fuzzer/FuzzerTraceState.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Fuzzer/FuzzerTraceState.cpp b/lib/Fuzzer/FuzzerTraceState.cpp index 00f1ebd0619..b2006fa3aa4 100644 --- a/lib/Fuzzer/FuzzerTraceState.cpp +++ b/lib/Fuzzer/FuzzerTraceState.cpp @@ -542,6 +542,12 @@ void dfsan_weak_hook_strcmp(void *caller_pc, const char *s1, const char *s2, reinterpret_cast(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 *caller_pc, const char *s1, reinterpret_cast(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) {