Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Apr 2015 07:59:49 -0700
From:      Craig Rodrigues <rodrigc@FreeBSD.org>
To:        John-Mark Gurney <jmg@funkthat.com>
Cc:        "freebsd-testing@freebsd.org" <freebsd-testing@freebsd.org>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>
Subject:   Re: Kernel compilation failures with gcc 4.9
Message-ID:  <CAG=rPVfbApp15R7xO-_EuA%2Bj%2Bb278tJP-ERcdjWhsOX36JaYkg@mail.gmail.com>
In-Reply-To: <20150401051051.GT51048@funkthat.com>
References:  <CAG=rPVfA3fVQ__XoBewKh0u0buO9NNt6uB4Yv9EUy2Rn8H%2B2Yw@mail.gmail.com> <507CA323-8304-4FDB-A4B7-24A3683F265E@me.com> <1947119C-82A3-41C7-B9E5-98A99616F551@bsdimp.com> <CAG=rPVfH6hvH9OSf4nM5fk-q0yqVUs8aRfxLEu20F1ikXYd06g@mail.gmail.com> <20150401051051.GT51048@funkthat.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 31, 2015 at 10:10 PM, John-Mark Gurney <jmg@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG=rPVfbApp15R7xO-_EuA%2Bj%2Bb278tJP-ERcdjWhsOX36JaYkg>