From owner-freebsd-toolchain@FreeBSD.ORG Wed Apr 1 14:59:52 2015 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0B4BAA4D; Wed, 1 Apr 2015 14:59:52 +0000 (UTC) Received: from mail-lb0-x22f.google.com (mail-lb0-x22f.google.com [IPv6:2a00:1450:4010:c04::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E77C9B2; Wed, 1 Apr 2015 14:59:51 +0000 (UTC) Received: by lboc7 with SMTP id c7so38287921lbo.1; Wed, 01 Apr 2015 07:59:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Xr+A1bcbG7zDBNjQxD4dL3IYDpvo7HrQoMbcH7vSCnU=; b=EsA6N5eOn8fCrrJGpIcLKFjJzFIiqjZzpq1pjSNa2kuITN2Vs06YtqrP/qIzF/rx38 gNgF4TwrsMd2iDM+/omLD7sn3o8Yzv3/uz4QRPZs4K8VDOJjxd0Qr1PQ8VT2/1+NerSa kODzxed+mevhuxvxLwUGmvhGmuOJASD2XGqBnqdCuNhAIHjdJNLl2HptiFbnjefXNttb lVZJPIlJbmBbkpO6szXAY5PyIV35AninopJJIdjI3dcezgofPXM/S7Ywn2ZDd8kO2abz NV75DsXPhup4AraKzItS6CNeQ/tpjvmfs1bZGeoxE2Y8/IhX1y7sgBfioxrruQj6caYo Zi4g== MIME-Version: 1.0 X-Received: by 10.152.163.2 with SMTP id ye2mr9605608lab.89.1427900389510; Wed, 01 Apr 2015 07:59:49 -0700 (PDT) Sender: crodr001@gmail.com Received: by 10.112.108.168 with HTTP; Wed, 1 Apr 2015 07:59:49 -0700 (PDT) In-Reply-To: <20150401051051.GT51048@funkthat.com> References: <507CA323-8304-4FDB-A4B7-24A3683F265E@me.com> <1947119C-82A3-41C7-B9E5-98A99616F551@bsdimp.com> <20150401051051.GT51048@funkthat.com> Date: Wed, 1 Apr 2015 07:59:49 -0700 X-Google-Sender-Auth: X2aIgN5nkjp652e1v-c1u4RwYdE Message-ID: Subject: Re: Kernel compilation failures with gcc 4.9 From: Craig Rodrigues To: John-Mark Gurney Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "freebsd-testing@freebsd.org" , FreeBSD Toolchain X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Apr 2015 14:59:52 -0000 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