[compiler-rt] r201564 - [asan] Fix one test on OSX.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Tue Feb 18 03:32:24 PST 2014


Author: eugenis
Date: Tue Feb 18 05:32:24 2014
New Revision: 201564

URL: http://llvm.org/viewvc/llvm-project?rev=201564&view=rev
Log:
[asan] Fix one test on OSX.

Modified:
    compiler-rt/trunk/test/asan/TestCases/large_allocator_unpoisons_on_free.cc

Modified: compiler-rt/trunk/test/asan/TestCases/large_allocator_unpoisons_on_free.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/large_allocator_unpoisons_on_free.cc?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/large_allocator_unpoisons_on_free.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/large_allocator_unpoisons_on_free.cc Tue Feb 18 05:32:24 2014
@@ -5,13 +5,26 @@
 // RUN: ASAN_OPTIONS=quarantine_size=1 %t
 
 #include <assert.h>
-#include <malloc.h>
 #include <string.h>
 #include <sys/mman.h>
+#include <stdlib.h>
+
+#ifdef __ANDROID__
+#include <malloc.h>
+void *my_memalign(size_t boundary, size_t size) {
+  return memalign(boundary, size);
+}
+#else
+void *my_memalign(size_t boundary, size_t size) {
+  void *p;
+  posix_memalign(&p, boundary, size);
+  return p;
+}
+#endif
 
 int main() {
   const int kPageSize = 4096;
-  void *p = memalign(kPageSize, 1024 * 1024);
+  void *p = my_memalign(kPageSize, 1024 * 1024);
   free(p);
 
   char *q = (char *)mmap(p, kPageSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_FIXED, 0, 0);





More information about the llvm-commits mailing list