[compiler-rt] r202124 - [asan] Fix for size_t in Asan's new and delete operators on x64 FreeBSD in 32-bit mode, only for FreeBSD <= 9.2; patch by Viktor Kutuzov

Kostya Serebryany kcc at google.com
Tue Feb 25 00:46:01 PST 2014


Author: kcc
Date: Tue Feb 25 02:45:59 2014
New Revision: 202124

URL: http://llvm.org/viewvc/llvm-project?rev=202124&view=rev
Log:
[asan] Fix for size_t in Asan's new and delete operators on x64 FreeBSD in 32-bit mode, only for FreeBSD <= 9.2; patch by Viktor Kutuzov

Modified:
    compiler-rt/trunk/lib/asan/asan_new_delete.cc

Modified: compiler-rt/trunk/lib/asan/asan_new_delete.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_new_delete.cc?rev=202124&r1=202123&r2=202124&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_new_delete.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_new_delete.cc Tue Feb 25 02:45:59 2014
@@ -49,6 +49,15 @@ struct nothrow_t {};
 // To make sure that C++ allocation/deallocation operators are overridden on
 // OS X we need to intercept them using their mangled names.
 #if !SANITIZER_MAC
+// FreeBSD prior v9.2 have wrong definition of 'size_t'.
+// http://svnweb.freebsd.org/base?view=revision&revision=232261
+#if SANITIZER_FREEBSD && SANITIZER_WORDSIZE == 32
+#include <sys/param.h>
+#if __FreeBSD_version <= 902001  // v9.2
+#define size_t unsigned
+#endif  // __FreeBSD_version
+#endif  // SANITIZER_FREEBSD && SANITIZER_WORDSIZE == 32
+
 INTERCEPTOR_ATTRIBUTE
 void *operator new(size_t size) { OPERATOR_NEW_BODY(FROM_NEW); }
 INTERCEPTOR_ATTRIBUTE





More information about the llvm-commits mailing list