summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2013-03-26 18:34:24 +0100
committerAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2013-03-26 21:28:01 +0100
commite1b479963d3fcdc08862e7eece06630763bd430f (patch)
treeb57e5362559844a4626d0be49e0bd2c1c838593c
parent53543895db348296542aaedcf5e1ceeb48c35f10 (diff)
downloadcompiler-rt-e1b479963d3fcdc08862e7eece06630763bd430f.tar.gz
compiler-rt-e1b479963d3fcdc08862e7eece06630763bd430f.tar.bz2
compiler-rt-e1b479963d3fcdc08862e7eece06630763bd430f.tar.xz
sanitizer common: do not assume GLIBC and __libc_malloc, __libc_free
Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org>
-rw-r--r--lib/sanitizer_common/sanitizer_allocator.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/sanitizer_common/sanitizer_allocator.cc b/lib/sanitizer_common/sanitizer_allocator.cc
index c5c2ef55..9fcd343a 100644
--- a/lib/sanitizer_common/sanitizer_allocator.cc
+++ b/lib/sanitizer_common/sanitizer_allocator.cc
@@ -13,18 +13,20 @@
//===----------------------------------------------------------------------===//
#include "sanitizer_common.h"
+#include <stdint.h> // To know which c lib we are working on.
+
// FIXME: We should probably use more low-level allocator that would
// mmap some pages and split them into chunks to fulfill requests.
-#if SANITIZER_LINUX && !SANITIZER_ANDROID
+#if SANITIZER_LINUX && defined(__GLIBC__) && !SANITIZER_ANDROID
extern "C" void *__libc_malloc(__sanitizer::uptr size);
extern "C" void __libc_free(void *ptr);
# define LIBC_MALLOC __libc_malloc
# define LIBC_FREE __libc_free
-#else // __linux__ && !ANDROID
+#else // __linux__ && __GLIBC__ && !ANDROID
# include <stdlib.h>
# define LIBC_MALLOC malloc
# define LIBC_FREE free
-#endif // __linux__ && !ANDROID
+#endif // __linux__ && __GLIBC__ && !ANDROID
namespace __sanitizer {