Re: Kernel compilation failures with gcc 4.9

2015-04-01 Thread John-Mark Gurney
Craig Rodrigues wrote this message on Wed, Apr 01, 2015 at 07:59 -0700:
> On Tue, Mar 31, 2015 at 10:10 PM, John-Mark Gurney  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 
> 
>  /* Get _mm_malloc () and _mm_free ().  */
> +#if __STDC_HOSTED__
>  #include 
> +#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:

Yes, I did think of that...  If we do this... We need to make sure
to include a comment about this hack being for GCC, and/or we should
probably make it dependant on GCC...  Don't want to make things worse
for compilers that do it properly...

> +#define _MM_MALLOC_H_INCLUDED 1

-- 
  John-Mark Gurney  Voice: +1 415 225 5579

 "All that I will do, has been done, All that I have, has not."
___
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"


Re: Kernel compilation failures with gcc 4.9

2015-04-01 Thread Craig Rodrigues
On Tue, Mar 31, 2015 at 10:10 PM, John-Mark Gurney  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 

 /* Get _mm_malloc () and _mm_free ().  */
+#if __STDC_HOSTED__
 #include 
+#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 

 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 
 #endif

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

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

 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"


Re: Kernel compilation failures with gcc 4.9

2015-03-31 Thread John-Mark Gurney
Craig Rodrigues wrote this message on Tue, Mar 31, 2015 at 19:28 -0700:
> On Tue, Mar 31, 2015 at 4:55 PM, Warner Losh  wrote:
> 
> > > It shouldn't be using the stdlib when it's built with -ffreestanding or
> > -nostdlib.  Can you make sure?
> >
> > The AES stuff breaks the rules, and this is a consequence of it :( That
> > stuff should be fixed.
> 
> Do you have time to help fix compilation with gcc 4.9 of AESNI in the
> kernel?
> It currently does not compile with gcc 4.9.
> 
> See my original bug report here:
> https://lists.freebsd.org/pipermail/freebsd-toolchain/2015-March/001577.html
> 
> We are trying to fix the kernel build enough with gcc 4.9 so that
> we can at least set up a Jenkins continuous build (with -Werror turned off
> initially).

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...

-- 
  John-Mark Gurney  Voice: +1 415 225 5579

 "All that I will do, has been done, All that I have, has not."
___
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"


Re: Kernel compilation failures with gcc 4.9

2015-03-31 Thread Craig Rodrigues
On Tue, Mar 31, 2015 at 4:55 PM, Warner Losh  wrote:

>
> >
> > It shouldn't be using the stdlib when it's built with -ffreestanding or
> -nostdlib.  Can you make sure?
>
> The AES stuff breaks the rules, and this is a consequence of it :( That
> stuff should be fixed.
>
>
John-Mark,

Do you have time to help fix compilation with gcc 4.9 of AESNI in the
kernel?
It currently does not compile with gcc 4.9.

See my original bug report here:
https://lists.freebsd.org/pipermail/freebsd-toolchain/2015-March/001577.html

We are trying to fix the kernel build enough with gcc 4.9 so that
we can at least set up a Jenkins continuous build (with -Werror turned off
initially).

Thanks.
--
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"


Re: Kernel compilation failures with gcc 4.9

2015-03-31 Thread Warner Losh

> On Mar 31, 2015, at 4:53 PM, Rui Paulo  wrote:
> 
> On Mar 31, 2015, at 14:04, Craig Rodrigues  wrote:
>> 
>> Hi,
>> 
>> I put this in make.conf:
>> 
>> NO_WERROR=yes
>> WERROR=
>> WITHOUT_BOOT=yes
>> WITHOUT_RESCUE=yes
>> 
>> and used this script to build:
>> https://github.com/freebsd/freebsd-ci/blob/master/scripts/build/cross-build.sh
>> 
>> I managed to build a lot of stuff, but then got build failures
>> in the aesni part of the kernel build.
>> 
>> See the full build log here:
>> https://jenkins.freebsd.org/job/FreeBSD_HEAD_external_toolchain_gcc/30/console
>> 
>> I think this is the error:
>> 
>> In file included from
>> /usr/local/lib/gcc/x86_64-portbld-freebsd10.0/4.9.1/include/mm_malloc.h:27:0,
>>from
>> /usr/local/lib/gcc/x86_64-portbld-freebsd10.0/4.9.1/include/xmmintrin.h:34,
>>from
>> /usr/local/lib/gcc/x86_64-portbld-freebsd10.0/4.9.1/include/emmintrin.h:31,
>>from
>> /usr/local/lib/gcc/x86_64-portbld-freebsd10.0/4.9.1/include/wmmintrin.h:31,
>>from
>> /builds/FreeBSD_HEAD_external_toolchain_gcc/sys/modules/aesni/../../crypto/aesni/aesni_ghash.c:74:
>> /builds/FreeBSD_HEAD_external_toolchain_gcc/obj/builds/FreeBSD_HEAD_external_toolchain_gcc/tmp/usr/include/stdlib.h:93:7:
>> error: conflicting types for 'free' void  free(void *);
>> 
>>  ^
>> In file included from
>> /builds/FreeBSD_HEAD_external_toolchain_gcc/sys/crypto/aesni/aesni.h:33:0,
>>from
>> /builds/FreeBSD_HEAD_external_toolchain_gcc/sys/modules/aesni/../../crypto/aesni/aesni_ghash.c:69:
>> /builds/FreeBSD_HEAD_external_toolchain_gcc/sys/sys/malloc.h:177:6: note:
>> previous declaration of 'free' was here
>> void free(void *addr, struct malloc_type *type);
> 
> It shouldn't be using the stdlib when it's built with -ffreestanding or 
> -nostdlib.  Can you make sure?

The AES stuff breaks the rules, and this is a consequence of it :( That stuff 
should be fixed.

Warner


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Kernel compilation failures with gcc 4.9

2015-03-31 Thread Rui Paulo
On Mar 31, 2015, at 14:04, Craig Rodrigues  wrote:
> 
> Hi,
> 
> I put this in make.conf:
> 
> NO_WERROR=yes
> WERROR=
> WITHOUT_BOOT=yes
> WITHOUT_RESCUE=yes
> 
> and used this script to build:
> https://github.com/freebsd/freebsd-ci/blob/master/scripts/build/cross-build.sh
> 
> I managed to build a lot of stuff, but then got build failures
> in the aesni part of the kernel build.
> 
> See the full build log here:
> https://jenkins.freebsd.org/job/FreeBSD_HEAD_external_toolchain_gcc/30/console
> 
> I think this is the error:
> 
> In file included from
> /usr/local/lib/gcc/x86_64-portbld-freebsd10.0/4.9.1/include/mm_malloc.h:27:0,
> from
> /usr/local/lib/gcc/x86_64-portbld-freebsd10.0/4.9.1/include/xmmintrin.h:34,
> from
> /usr/local/lib/gcc/x86_64-portbld-freebsd10.0/4.9.1/include/emmintrin.h:31,
> from
> /usr/local/lib/gcc/x86_64-portbld-freebsd10.0/4.9.1/include/wmmintrin.h:31,
> from
> /builds/FreeBSD_HEAD_external_toolchain_gcc/sys/modules/aesni/../../crypto/aesni/aesni_ghash.c:74:
> /builds/FreeBSD_HEAD_external_toolchain_gcc/obj/builds/FreeBSD_HEAD_external_toolchain_gcc/tmp/usr/include/stdlib.h:93:7:
> error: conflicting types for 'free' void  free(void *);
> 
>   ^
> In file included from
> /builds/FreeBSD_HEAD_external_toolchain_gcc/sys/crypto/aesni/aesni.h:33:0,
> from
> /builds/FreeBSD_HEAD_external_toolchain_gcc/sys/modules/aesni/../../crypto/aesni/aesni_ghash.c:69:
> /builds/FreeBSD_HEAD_external_toolchain_gcc/sys/sys/malloc.h:177:6: note:
> previous declaration of 'free' was here
> void free(void *addr, struct malloc_type *type);

It shouldn't be using the stdlib when it's built with -ffreestanding or 
-nostdlib.  Can you make sure?

--
Rui Paulo



___
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"