galeb

Једноставна статичка дистрибуција заснована на musl-у
git clone https://git.sr.ht/~strahinja/galeb
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

0001-posix_memalign.patch (1423B)


      1 From 74c7b0df9971b6bc75d7d172c2819ffd21d51050 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] posix_memalign
      5 
      6 ---
      7  gcc/config/i386/pmm_malloc.h | 9 +++++----
      8  1 file changed, 5 insertions(+), 4 deletions(-)
      9 
     10 diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
     11 index 3b2e4f47915..20f790904a2 100644
     12 --- a/gcc/config/i386/pmm_malloc.h
     13 +++ b/gcc/config/i386/pmm_malloc.h
     14 @@ -27,12 +27,13 @@
     15  #include <stdlib.h>
     16  
     17  /* We can't depend on <stdlib.h> since the prototype of posix_memalign
     18 -   may not be visible.  */
     19 +   may not be visible and we can't pollute the namespace either.  */
     20  #ifndef __cplusplus
     21 -extern int posix_memalign (void **, size_t, size_t);
     22 +extern int _mm_posix_memalign (void **, size_t, size_t)
     23  #else
     24 -extern "C" int posix_memalign (void **, size_t, size_t) throw ();
     25 +extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw ()
     26  #endif
     27 +__asm__("posix_memalign");
     28  
     29  static __inline void *
     30  _mm_malloc (size_t __size, size_t __alignment)
     31 @@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment)
     32      return malloc (__size);
     33    if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
     34      __alignment = sizeof (void *);
     35 -  if (posix_memalign (&__ptr, __alignment, __size) == 0)
     36 +  if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0)
     37      return __ptr;
     38    else
     39      return NULL;