On Tue, Mar 31, 2015 at 10:10 PM, John-Mark Gurney <j...@funkthat.com> wrote:
>
>
> This is an issue w/ gcc 4.9's headers... It is including stdlib.h,
> via mm_malloc.h which is conflicting w/ sys/malloc.h's version of free..
>
> kan wrapped the include of mm_malloc.h in an #if __STDC_HOSTED__ which is
> why gcc 4.2 doesn't have the issue per my request a couple years ago:
> https://svnweb.freebsd.org/changeset/base/r242182
>
> A similar fix needs to be applied here...


Interesting, so r242182 does this inside the gcc header file itself:

--- head/contrib/gcc/config/i386/xmmintrin.h 2011/03/14 13:31:34 219639
+++ head/contrib/gcc/config/i386/xmmintrin.h 2012/10/27 17:39:36 242182
@@ -39,7 +39,9 @@
 #include <mmintrin.h>

 /* Get _mm_malloc () and _mm_free ().  */
+#if __STDC_HOSTED__
 #include <mm_malloc.h>
+#endif


We would need to apply the same patch to the gcc header
file in gcc 4.9.  I'm not sure if that will be allowed, since the
direction we are going in is to support gcc as an external toolchain,
unless we can push that change upstream to gcc.
I'll let the toolchain@ team decide that one.

The alternative is to patch the aesni header files.  This patch is
a bit gross, but I was able to compile an entire GENERIC kernel (including
aesni) with gcc 4.9:

Index: aesni/aesencdec.h
===================================================================
--- aesni/aesencdec.h    (revision 280912)
+++ aesni/aesencdec.h    (working copy)
@@ -27,6 +27,11 @@
  *
  */

+#ifdef _KERNEL
+/* Suppress inclusion of gcc's mm_malloc.h header */
+#define _MM_MALLOC_H_INCLUDED 1
+#endif
+
 #include <wmmintrin.h>

 static inline void
Index: aesni/aesni_ghash.c
===================================================================
--- aesni/aesni_ghash.c    (revision 280912)
+++ aesni/aesni_ghash.c    (working copy)
@@ -71,6 +71,11 @@
 #include <stdint.h>
 #endif

+#ifdef _KERNEL
+/* Suppress inclusion of gcc's mm_malloc.h header */
+#define _MM_MALLOC_H_INCLUDED 1
+#endif
+
 #include <wmmintrin.h>
 #include <emmintrin.h>
 #include <smmintrin.h>
Index: aesni/aesni_wrap.c
===================================================================
--- aesni/aesni_wrap.c    (revision 280912)
+++ aesni/aesni_wrap.c    (working copy)
@@ -45,6 +45,11 @@
 #include <opencrypto/gmac.h>

 #include "aesencdec.h"
+#ifdef _KERNEL
+/* Suppress inclusion of gcc's mm_malloc.h header */
+#define _MM_MALLOC_H_INCLUDED 1
+#endif
+
 #include <smmintrin.h>

 MALLOC_DECLARE(M_AESNI);


What's the best way to move forward on this?

--
Craig
_______________________________________________
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"

Reply via email to