0002-posix_memalign.diff 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
  2. index 73d9e887b4b..33f998702fa 100644
  3. --- a/gcc/config/i386/pmm_malloc.h
  4. +++ b/gcc/config/i386/pmm_malloc.h
  5. @@ -27,12 +27,13 @@
  6. #include <stdlib.h>
  7. /* We can't depend on <stdlib.h> since the prototype of posix_memalign
  8. - may not be visible. */
  9. + may not be visible and we can't pollute the namespace either. */
  10. #ifndef __cplusplus
  11. -extern int posix_memalign (void **, size_t, size_t);
  12. +extern int _mm_posix_memalign (void **, size_t, size_t)
  13. #else
  14. -extern "C" int posix_memalign (void **, size_t, size_t) throw ();
  15. +extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw ()
  16. #endif
  17. +__asm__("posix_memalign");
  18. static __inline void *
  19. _mm_malloc (size_t __size, size_t __alignment)
  20. @@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment)
  21. return malloc (__size);
  22. if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
  23. __alignment = sizeof (void *);
  24. - if (posix_memalign (&__ptr, __alignment, __size) == 0)
  25. + if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0)
  26. return __ptr;
  27. else
  28. return NULL;