[PATCH] Fix for size_t in Asan's new and delete operators on x64 FreeBSD in 32-bit mode

Viktor Kutuzov vkutuzov at accesssoftek.com
Mon Feb 24 23:42:15 PST 2014


  Rewritten with macro replacement.

Hi kcc, samsonov,

http://llvm-reviews.chandlerc.com/D2856

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D2856?vs=7299&id=7341#toc

Files:
  lib/asan/asan_new_delete.cc

Index: lib/asan/asan_new_delete.cc
===================================================================
--- lib/asan/asan_new_delete.cc
+++ lib/asan/asan_new_delete.cc
@@ -49,6 +49,15 @@
 // 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2856.4.patch
Type: text/x-patch
Size: 813 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140224/59392c24/attachment.bin>


More information about the llvm-commits mailing list