[llvm-commits] [compiler-rt] r158450 - in /compiler-rt/trunk/lib: asan/asan_interceptors.cc asan/asan_interceptors.h sanitizer_common/sanitizer_libc.cc sanitizer_common/sanitizer_libc.h tsan/rtl/tsan_defs.h tsan/rtl/tsan_interceptors.cc
Alexey Samsonov
samsonov at google.com
Thu Jun 14 07:04:54 PDT 2012
Author: samsonov
Date: Thu Jun 14 09:04:54 2012
New Revision: 158450
URL: http://llvm.org/viewvc/llvm-project?rev=158450&view=rev
Log:
[Sanitizer] Move internal_memcmp to common sanitizer libc
Modified:
compiler-rt/trunk/lib/asan/asan_interceptors.cc
compiler-rt/trunk/lib/asan/asan_interceptors.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h
compiler-rt/trunk/lib/tsan/rtl/tsan_defs.h
compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
Modified: compiler-rt/trunk/lib/asan/asan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.cc?rev=158450&r1=158449&r2=158450&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Thu Jun 14 09:04:54 2012
@@ -242,15 +242,6 @@
}
}
-int internal_memcmp(const void* s1, const void* s2, uptr n) {
- const char* t1 = (char*)s1;
- const char* t2 = (char*)s2;
- for (uptr i = 0; i < n; ++i, ++t1, ++t2)
- if (*t1 != *t2)
- return *t1 < *t2 ? -1 : 1;
- return 0;
-}
-
char *internal_strstr(const char *haystack, const char *needle) {
// This is O(N^2), but we are not using it in hot places.
uptr len1 = internal_strlen(haystack);
Modified: compiler-rt/trunk/lib/asan/asan_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.h?rev=158450&r1=158449&r2=158450&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.h (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.h Thu Jun 14 09:04:54 2012
@@ -34,7 +34,6 @@
s64 internal_atoll(const char *nptr);
uptr internal_strnlen(const char *s, uptr maxlen);
char* internal_strchr(const char *s, int c);
-int internal_memcmp(const void* s1, const void* s2, uptr n);
char *internal_strstr(const char *haystack, const char *needle);
char *internal_strncat(char *dst, const char *src, uptr n);
// Works only for base=10 and doesn't set errno.
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc?rev=158450&r1=158449&r2=158450&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc Thu Jun 14 09:04:54 2012
@@ -26,6 +26,15 @@
return 0;
}
+int internal_memcmp(const void* s1, const void* s2, uptr n) {
+ const char* t1 = (char*)s1;
+ const char* t2 = (char*)s2;
+ for (uptr i = 0; i < n; ++i, ++t1, ++t2)
+ if (*t1 != *t2)
+ return *t1 < *t2 ? -1 : 1;
+ return 0;
+}
+
void *internal_memcpy(void *dest, const void *src, uptr n) {
char *d = (char*)dest;
char *s = (char*)src;
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h?rev=158450&r1=158449&r2=158450&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h Thu Jun 14 09:04:54 2012
@@ -25,6 +25,7 @@
// String functions
void *internal_memchr(const void *s, int c, uptr n);
+int internal_memcmp(const void* s1, const void* s2, uptr n);
void *internal_memcpy(void *dest, const void *src, uptr n);
// Should not be used in performance-critical places.
void *internal_memset(void *s, int c, uptr n);
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_defs.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_defs.h?rev=158450&r1=158449&r2=158450&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_defs.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_defs.h Thu Jun 14 09:04:54 2012
@@ -136,7 +136,6 @@
void real_memset(void *ptr, int c, uptr size);
void real_memcpy(void *dst, const void *src, uptr size);
-int internal_memcmp(const void *s1, const void *s2, uptr size);
int internal_strncmp(const char *s1, const char *s2, uptr size);
void internal_strcpy(char *s1, const char *s2);
const char *internal_strstr(const char *where, const char *what);
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=158450&r1=158449&r2=158450&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Thu Jun 14 09:04:54 2012
@@ -1529,10 +1529,6 @@
REAL(memcpy)(dst, src, size);
}
-int internal_memcmp(const void *s1, const void *s2, uptr size) {
- return REAL(memcmp)(s1, s2, size);
-}
-
int internal_strncmp(const char *s1, const char *s2, uptr size) {
return REAL(strncmp)(s1, s2, size);
}
More information about the llvm-commits
mailing list