summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-08-22 13:32:37 +0000
committerAlexey Samsonov <samsonov@google.com>2012-08-22 13:32:37 +0000
commit4d520640ba437baff70fd518e445c8be929dbbe1 (patch)
tree6027e54b3e0ec352cb612a7d0b5812f427076e5e
parenta85b6b8154f57043af388d7626502fbcc93150ed (diff)
downloadbcm5719-llvm-4d520640ba437baff70fd518e445c8be929dbbe1.tar.gz
bcm5719-llvm-4d520640ba437baff70fd518e445c8be929dbbe1.zip
[ASan] use write instead of puts in malloc hooks test for ASan, as puts calls malloc on Mac
llvm-svn: 162359
-rw-r--r--compiler-rt/lib/asan/lit_tests/malloc_hook.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler-rt/lib/asan/lit_tests/malloc_hook.cc b/compiler-rt/lib/asan/lit_tests/malloc_hook.cc
index 885fc6693fd..6435d105ee2 100644
--- a/compiler-rt/lib/asan/lit_tests/malloc_hook.cc
+++ b/compiler-rt/lib/asan/lit_tests/malloc_hook.cc
@@ -1,13 +1,17 @@
// RUN: %clangxx_asan -O2 %s -o %t
// RUN: %t 2>&1 | FileCheck %s
-#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
extern "C" {
// Note: avoid calling functions that allocate memory in malloc/free
// to avoid infinite recursion.
-void __asan_malloc_hook(void *ptr, size_t sz) { puts("MallocHook"); }
-void __asan_free_hook(void *ptr) { puts("FreeHook"); }
+void __asan_malloc_hook(void *ptr, size_t sz) {
+ write(1, "MallocHook\n", sizeof("MallocHook\n"));
+}
+void __asan_free_hook(void *ptr) {
+ write(1, "FreeHook\n", sizeof("FreeHook\n"));
+}
} // extern "C"
int main() {
OpenPOWER on IntegriCloud