diff --git a/main/gcc/APKBUILD b/main/gcc/APKBUILD
index a835c002195f9480226bcc552862839d59add322..24d5a8a69bb484efbe27be7902fdc3f3364454cf 100644
--- a/main/gcc/APKBUILD
+++ b/main/gcc/APKBUILD
@@ -9,7 +9,7 @@ _cross=""
 	&& _cross="-$CTARGET"
 
 pkgname="$pkgname$_cross"
-pkgrel=7
+pkgrel=8
 pkgdesc="The GNU Compiler Collection"
 url="http://gcc.gnu.org"
 arch="all"
@@ -182,6 +182,7 @@ source="ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-$pkgver.tar.bz2
 	pr57748.patch
 	fix-gcj-musl.patch
 	fix-gcj-iconv-musl.patch
+	musl-posix_memalign-c++.patch
 
 	gcc-4.8-build-args.patch
 	fix-cxxflags-passing.patch
@@ -700,6 +701,7 @@ ab83248e10b2bf4b3d9240de0fefb52b  pt_gnu_eh_frame.patch
 fb28fd941c110627b7b9ca523d66b8d6  pr57748.patch
 14fc0a0b925ef911ce78cd030fe58902  fix-gcj-musl.patch
 e17bbb0fe802974e20645b4182b4c410  fix-gcj-iconv-musl.patch
+c48f935583a4ef03aec0ef01b6190dae  musl-posix_memalign-c++.patch
 0a2041bbf83648e6c4f6d3484f7249ca  gcc-4.8-build-args.patch
 4aea37d334ab00bb6bba37cd8c481367  fix-cxxflags-passing.patch
 87684048ecaaf0e046983bc2782292dd  fix-cxxflags-for-target.patch
@@ -750,6 +752,7 @@ d68d6680b3ab996b4b8dde2ddc351cecb46b560dc743d112e682c596696b67bb  pr49423.patch
 999fdf60b3a51435e7485a57e12c1110a2af3965e14528f77d5dd0917115011d  pr57748.patch
 22c78cc4a2658ff574e7ded1e5bc765a4f81f730d12e72d5883fe0bf73e71220  fix-gcj-musl.patch
 51782c972ab828eb4ccb3ca3570341d025b2ae9a8e8fd8188cefb29c5f87401b  fix-gcj-iconv-musl.patch
+c77cadbf6a767b71b65275bffcf478fed9882a04069520e68cddd6394cb8e965  musl-posix_memalign-c++.patch
 bd7a6f514fcc457f29e5fda157203f3bcd013aeba5d53b3459196eef3ce752ab  gcc-4.8-build-args.patch
 a395ba4cf047c48cac56985726fddf0948f4425c9f1a0c9ddba1812b2b3d8300  fix-cxxflags-passing.patch
 a5678380e887dbf600c59273d382e81c10f89d28e422238a617d0a43ad5c5a69  fix-cxxflags-for-target.patch
@@ -800,6 +803,7 @@ b01ec5b2718e74048102d4a8e0a851f63524c9b9a70631ec93467b2e6080e8db2c500040572f64dc
 018a9f2b7b490066a02671be38e1a4f18caeff98210027e68a1d4bd3d78ff810aa45a5cca163f4c46ee0d120715541a95a6e2487e17f4bb923459dec8edf8f8f  pr57748.patch
 f89ddeb21bc8f97e6a850a6b70b4501a8f3e49a4bc8cc82897488decda5d98ad01cb7f6c8b392d452e9579924a523bc75da6e0648c1c976d42e40af48b10343b  fix-gcj-musl.patch
 54d67cc008b735e47771314171930c5d8b8f5f5dc97fcf4214824c105c808f3e75d22d5a4fdf5068ed0457fa0d46c60cfb442e276259a4a5e9b8722a027d18e6  fix-gcj-iconv-musl.patch
+def4a62029e5a05e3df1b5b96f9c6c1e7a2f9b2f6a88a4752956e78a9908082c47769e4e342359fce7f61c15d66236847339d589e0ae1ef142cb294ee6b3108d  musl-posix_memalign-c++.patch
 abe9aaf9aa956058d0386a4396a511d176a46bb3906b90e952383646cdc158cbeb0a5dc616a1ccb1ca7d49fd0b5e351532aa15a3b13362abbf1ca4266f54a687  gcc-4.8-build-args.patch
 35d6d59f0b7b968f282f56767c9e0823a7bdc5aa0d450aca50fbd802649a7ca608b47671244a3faa208a9b0d6832cabb5a22724157dc817b2c0ad63d09f93282  fix-cxxflags-passing.patch
 c731f4aaaa65c8950e1b2bd9331410f92d378fd8c7e718532dccaa27ee11984d51d74216c3611e89a802325b81d7f184116839dce2dab50cae9b643c20a82fe7  fix-cxxflags-for-target.patch
diff --git a/main/gcc/musl-posix_memalign-c++.patch b/main/gcc/musl-posix_memalign-c++.patch
new file mode 100644
index 0000000000000000000000000000000000000000..15375651eb99711cdfdaee9858c70e2d28666231
--- /dev/null
+++ b/main/gcc/musl-posix_memalign-c++.patch
@@ -0,0 +1,27 @@
+Fix conflicting prototype of posix_memalign for c++
+http://www.openwall.com/lists/musl/2013/11/10/1
+
+--- ./gcc/config/i386/pmm_malloc.h.orig
++++ ./gcc/config/i386/pmm_malloc.h
+@@ -28,11 +28,7 @@
+ 
+ /* We can't depend on <stdlib.h> since the prototype of posix_memalign
+    may not be visible.  */
+-#ifndef __cplusplus
+-extern int posix_memalign (void **, size_t, size_t);
+-#else
+-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+-#endif
++extern int __gcc_posix_memalign (void **, size_t, size_t) asm("posix_memalign");
+ 
+ static __inline void *
+ _mm_malloc (size_t size, size_t alignment)
+@@ -42,7 +38,7 @@
+     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;