From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 90F2C138C9D for ; Thu, 30 Apr 2015 09:38:58 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 31EBBE0837; Thu, 30 Apr 2015 09:38:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0C42AE07A7 for ; Thu, 30 Apr 2015 09:38:50 +0000 (UTC) Received: from localhost (sloan0.ut.mephi.ru [85.143.112.33]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: bircoph) by smtp.gentoo.org (Postfix) with ESMTPSA id 31C49340D3C; Thu, 30 Apr 2015 09:38:48 +0000 (UTC) Date: Thu, 30 Apr 2015 12:38:19 +0300 From: Andrew Savchenko To: gentoo-user@lists.gentoo.org Cc: Ralf Subject: Re: [gentoo-user] CFLAGs for kernel compilation Message-Id: <20150430123819.b72d8b39bd60a912b7c7fde5@gentoo.org> In-Reply-To: <5540C101.70906@ramses-pyramidenbau.de> References: <5540C101.70906@ramses-pyramidenbau.de> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.25; i686-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA512"; boundary="Signature=_Thu__30_Apr_2015_12_38_19_+0300_rx2_fQURicynub_4" X-Archives-Salt: 8282e471-67e7-4736-a15f-08aa22607c87 X-Archives-Hash: 925b1fa9e761f50c24f6af63a1e93fc2 --Signature=_Thu__30_Apr_2015_12_38_19_+0300_rx2_fQURicynub_4 Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, 29 Apr 2015 13:31:13 +0200 Ralf wrote: > Hi, >=20 > just a short question: I don't like genkernel, I always compile my > kernel manually using menuconfig. > So the CFLAGs of my make.conf won't get applied. >=20 > What is the best way to (persistently) set the CFLAGs for the kernel > compilation? >=20 > - I don't like invoking 'CFLAGS=3D"-O2 -march=3Dfoo"make' > - I don't want to set CFLAGS as a persistent environment variable. > - I don't want to modify the kernel Makefile >=20 > Does it actually make sense to set an optimization level and -march? Short answer: don't even try to use general CFLAGS for a kernel, you'll badly damage its performance. Long answer: context switching between integer and floating point is very expensive, that's why kernel is integer only, any non-integer calculations are implemented using fixed point (integer numbers from CPU's POW). That's why kernel makes sure that no floating point instructions sneaks in using CFLAGS, you may see a lot of -mno-${intrucion_set} flags when running make -V. Futhermore kernel needs several memory alignment flags which should not be removed as well. The proper way to fine-tune CFLAGS for a local CPU support will be to use kernel-gcc-patches[1], as was pointed in other reply already. This code will ensure that proper CPU support is enabled while keeping all floating point instructions disabled. Just apply a patch and select native arch in CPU arch menu. [1] https://github.com/graysky2/kernel_gcc_patch Best regards, Andrew Savchenko --Signature=_Thu__30_Apr_2015_12_38_19_+0300_rx2_fQURicynub_4 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCgAGBQJVQfgiAAoJEPZTWjO6HuSNi0wP/R2JzAAhQfn78drAeMicSStq 9m1ME4cmKLclAecOmEVBBjLXlEmQQ8Q9LI5i+CI+w/pgWgo8l6+2+K3xGImr7ke4 PLBjS9acZdSJ8nJFUZsOS52ZjaXtm9itdjlB0GGrmOGcMhsRJm5mLPh3+Rg7tm66 HLm0JkSSzHstBMRm+vC2AZEp4GfeGOF3zCxP7UnI1qDhI0/a8QRXdr00duPMp3j9 lbnvZz6kflBqdjzNFpJKQwpv/X2hFcoxYkslBOzyGj3zHXQr8xl/5Lw/4n0f44R5 mx0fD7xNvYWlOJSCNRM42cNrNLYG+hDYJaSvj+l+Ir2T4ox5FiO67B05MOPG4+Xv WaZg4/nlnLze5/PBZKQHPLDnzKZ1JrVNXJB568BufFsXhuPcf3QPWQIMUyl/Vxwv fryUdOP0q2xpRAOw1k9s186uB34CzzmyZixxCkp+9mPIJkg1w2zseVdu41OUEE9Y htZ22box8xdcYov0ojLhQVybFpaCv9Pz2K2h3SJST9GrCnirxTzpGQnE/wNl15OS LPUk6Lqsg1itGJP+HUUkdY0wZlnaPpbubwoXvtiYOiCtIkdhrKLuJAMh2PU1nxfV syrjI7yur9XRCzQSQTlwRegEw2zEDr5pPD/dIz5KyJun2bBT4QsmOvVxQJLcj3wC ZefUXZu7BkoAXRPoFs71 =UA3W -----END PGP SIGNATURE----- --Signature=_Thu__30_Apr_2015_12_38_19_+0300_rx2_fQURicynub_4--