aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2014-04-14 17:08:26 -0700
committerAndrew Hsieh <andrewhsieh@google.com>2014-04-22 16:15:01 -0700
commitf1dea06dc38aa8375598dc0db365a82f0596edac (patch)
treedc995a77c1211d804f782bf06d8563ead9911157 /gcc-4.9
parent7c88c078fcb178f8d3c69857b10a1eed19432cb2 (diff)
downloadtoolchain_gcc-f1dea06dc38aa8375598dc0db365a82f0596edac.tar.gz
toolchain_gcc-f1dea06dc38aa8375598dc0db365a82f0596edac.tar.bz2
toolchain_gcc-f1dea06dc38aa8375598dc0db365a82f0596edac.zip
[4.9] Use memalign instead of posix_memalign in GCC x86 mm_malloc.h
See feb0a69677101f361aaf5dbfcdd8b5a7a827900f Change-Id: Icf882ff2441ef88ef5e3c5d4131011d8ef5348cd
Diffstat (limited to 'gcc-4.9')
-rw-r--r--gcc-4.9/gcc/config/i386/pmm_malloc.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/config/i386/pmm_malloc.h b/gcc-4.9/gcc/config/i386/pmm_malloc.h
index 3be2f3545..67b88a857 100644
--- a/gcc-4.9/gcc/config/i386/pmm_malloc.h
+++ b/gcc-4.9/gcc/config/i386/pmm_malloc.h
@@ -26,6 +26,7 @@
#include <stdlib.h>
+#if !defined(__ANDROID__) || defined(HAVE_POSIX_MEMALIGN)
/* We can't depend on <stdlib.h> since the prototype of posix_memalign
may not be visible. */
#ifndef __cplusplus
@@ -33,6 +34,7 @@ extern int posix_memalign (void **, size_t, size_t);
#else
extern "C" int posix_memalign (void **, size_t, size_t) throw ();
#endif
+#endif
static __inline void *
_mm_malloc (size_t size, size_t alignment)
@@ -42,10 +44,14 @@ _mm_malloc (size_t size, size_t alignment)
return malloc (size);
if (alignment == 2 || (sizeof (void *) == 8 && alignment == 4))
alignment = sizeof (void *);
+#if !defined(__ANDROID__) || defined(HAVE_POSIX_MEMALIGN)
if (posix_memalign (&ptr, alignment, size) == 0)
return ptr;
else
return NULL;
+#else
+ return memalign(alignment, size);
+#endif
}
static __inline void