move the dragora-mouse tool to archive/dragora-tools/ directory
[dragora.git] / patches / gcc / 0002-posix_memalign.patch
blob874f49b9b05913076deecd159ee64a41a220499b
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
6 ---
7 gcc/config/i386/pmm_malloc.h | 9 +++++----
8 1 file changed, 5 insertions(+), 4 deletions(-)
10 diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
11 index ffbb7f82cf5..b0b890d2403 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>
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");
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;
40 --
41 2.17.1