From f1dea06dc38aa8375598dc0db365a82f0596edac Mon Sep 17 00:00:00 2001 From: Andrew Hsieh Date: Mon, 14 Apr 2014 17:08:26 -0700 Subject: [4.9] Use memalign instead of posix_memalign in GCC x86 mm_malloc.h See feb0a69677101f361aaf5dbfcdd8b5a7a827900f Change-Id: Icf882ff2441ef88ef5e3c5d4131011d8ef5348cd --- gcc-4.9/gcc/config/i386/pmm_malloc.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gcc-4.9') 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 +#if !defined(__ANDROID__) || defined(HAVE_POSIX_MEMALIGN) /* We can't depend on 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 -- cgit v1.2.3