[compiler-rt] 49dda4e - [libFuzzer] Break dependency on common_interface_defs.h
Matt Morehouse via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 1 15:35:32 PDT 2020
Author: Matt Morehouse
Date: 2020-09-01T15:35:14-07:00
New Revision: 49dda4e58aeb172f72df2a5f087bdebca7c86fdb
URL: https://github.com/llvm/llvm-project/commit/49dda4e58aeb172f72df2a5f087bdebca7c86fdb
DIFF: https://github.com/llvm/llvm-project/commit/49dda4e58aeb172f72df2a5f087bdebca7c86fdb.diff
LOG: [libFuzzer] Break dependency on common_interface_defs.h
Some libFuzzer users build using the build.sh script, without access to
the <sanitizer/common_interface_defs.h> include.
Update https://github.com/rust-fuzz/libfuzzer/issues/65.
Reviewed By: dokyungs
Differential Revision: https://reviews.llvm.org/D86981
Added:
Modified:
compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp b/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
index a1a64780de34..b87798603fda 100644
--- a/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
@@ -27,7 +27,6 @@
#include <cassert>
#include <cstdint>
#include <dlfcn.h> // for dlsym()
-#include <sanitizer/common_interface_defs.h>
static void *getFuncAddr(const char *name, uintptr_t wrapper_addr) {
void *addr = dlsym(RTLD_NEXT, name);
@@ -119,6 +118,25 @@ static char *internal_strstr(const char *haystack, const char *needle) {
extern "C" {
+// Weak hooks forward-declared to avoid dependency on
+// <sanitizer/common_interface_defs.h>.
+void __sanitizer_weak_hook_memcmp(void *called_pc, const void *s1,
+ const void *s2, size_t n, int result);
+void __sanitizer_weak_hook_strncmp(void *called_pc, const char *s1,
+ const char *s2, size_t n, int result);
+void __sanitizer_weak_hook_strncasecmp(void *called_pc, const char *s1,
+ const char *s2, size_t n, int result);
+void __sanitizer_weak_hook_strcmp(void *called_pc, const char *s1,
+ const char *s2, int result);
+void __sanitizer_weak_hook_strcasecmp(void *called_pc, const char *s1,
+ const char *s2, int result);
+void __sanitizer_weak_hook_strstr(void *called_pc, const char *s1,
+ const char *s2, char *result);
+void __sanitizer_weak_hook_strcasestr(void *called_pc, const char *s1,
+ const char *s2, char *result);
+void __sanitizer_weak_hook_memmem(void *called_pc, const void *s1, size_t len1,
+ const void *s2, size_t len2, void *result);
+
DEFINE_REAL(int, bcmp, const void *, const void *, size_t)
DEFINE_REAL(int, memcmp, const void *, const void *, size_t)
DEFINE_REAL(int, strncmp, const char *, const char *, size_t)
More information about the llvm-commits
mailing list