From 089625f71f45e5db2a2e2d383f511021d925ddea Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Sun, 7 Jun 2015 21:21:21 +0200 Subject: [PATCH] gcc: fix conflicting prototype of posix_memalign for C++ Ref: http://www.openwall.com/lists/musl/2013/11/10/1. This patch is required for building cups-filters, libvisio, libcdr and probably many more with musl. --- .../gcc/patches/musl-posix_memalign-c++.patch | 30 +++++++++++++++++++ srcpkgs/gcc/template | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/gcc/patches/musl-posix_memalign-c++.patch diff --git a/srcpkgs/gcc/patches/musl-posix_memalign-c++.patch b/srcpkgs/gcc/patches/musl-posix_memalign-c++.patch new file mode 100644 index 0000000000..f285f73e8b --- /dev/null +++ b/srcpkgs/gcc/patches/musl-posix_memalign-c++.patch @@ -0,0 +1,30 @@ +diff --git gcc/config/i386/pmm_malloc.h gcc/config/i386/pmm_malloc.h +index 901001b..321fcd3 100644 +--- gcc/config/i386/pmm_malloc.h ++++ gcc/config/i386/pmm_malloc.h +@@ -27,12 +27,13 @@ + #include + + /* We can't depend on since the prototype of posix_memalign +- may not be visible. */ ++ may not be visible and we can't pollute the namespace either. */ + #ifndef __cplusplus +-extern int posix_memalign (void **, size_t, size_t); ++extern int __gcc_posix_memalign (void **, size_t, size_t) + #else +-extern "C" int posix_memalign (void **, size_t, size_t) throw (); ++extern "C" int __gcc_posix_memalign (void **, size_t, size_t) throw () + #endif ++__asm__("posix_memalign"); + + static __inline void * + _mm_malloc (size_t size, size_t alignment) +@@ -42,7 +43,7 @@ _mm_malloc (size_t size, size_t alignment) + return malloc (size); + if (alignment == 2 || (sizeof (void *) == 8 && alignment == 4)) + alignment = sizeof (void *); +- if (posix_memalign (&ptr, alignment, size) == 0) ++ if (__gcc_posix_memalign (&ptr, alignment, size) == 0) + return ptr; + else + return NULL; diff --git a/srcpkgs/gcc/template b/srcpkgs/gcc/template index 2f7b59ec21..67d6c1d46a 100644 --- a/srcpkgs/gcc/template +++ b/srcpkgs/gcc/template @@ -2,7 +2,7 @@ pkgname=gcc _majorver=4.9 version=${_majorver}.2 -revision=7 +revision=8 short_desc="The GNU C Compiler" maintainer="Juan RP " homepage="http://gcc.gnu.org"