0002-posix_memalign.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From 65eb86f3e110998d30489df009d44b4bc1043adc Mon Sep 17 00:00:00 2001
  2. From: Szabolcs Nagy <nsz@port70.net>
  3. Date: Fri, 26 Jan 2018 20:32:50 +0000
  4. Subject: [PATCH 02/12] posix_memalign
  5. ---
  6. gcc/config/i386/pmm_malloc.h | 9 +++++----
  7. 1 file changed, 5 insertions(+), 4 deletions(-)
  8. diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
  9. index ffbb7f82cf5..b0b890d2403 100644
  10. --- a/gcc/config/i386/pmm_malloc.h
  11. +++ b/gcc/config/i386/pmm_malloc.h
  12. @@ -27,12 +27,13 @@
  13. #include <stdlib.h>
  14. /* We can't depend on <stdlib.h> since the prototype of posix_memalign
  15. - may not be visible. */
  16. + may not be visible and we can't pollute the namespace either. */
  17. #ifndef __cplusplus
  18. -extern int posix_memalign (void **, size_t, size_t);
  19. +extern int _mm_posix_memalign (void **, size_t, size_t)
  20. #else
  21. -extern "C" int posix_memalign (void **, size_t, size_t) throw ();
  22. +extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw ()
  23. #endif
  24. +__asm__("posix_memalign");
  25. static __inline void *
  26. _mm_malloc (size_t __size, size_t __alignment)
  27. @@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment)
  28. return malloc (__size);
  29. if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
  30. __alignment = sizeof (void *);
  31. - if (posix_memalign (&__ptr, __alignment, __size) == 0)
  32. + if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0)
  33. return __ptr;
  34. else
  35. return NULL;
  36. --
  37. 2.17.1