From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1GUtQN-00054H-SX for garchives@archives.gentoo.org; Tue, 03 Oct 2006 23:11:44 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.8/8.13.6) with SMTP id k93NAfVY029414; Tue, 3 Oct 2006 23:10:41 GMT Received: from mail.bouton.name (ns.bouton.name [70.85.16.101]) by robin.gentoo.org (8.13.8/8.13.6) with ESMTP id k93N8kmL021685 for ; Tue, 3 Oct 2006 23:08:46 GMT Received: from [82.227.97.166] (adsl.bouton.name [82.227.97.166]) by mail.bouton.name (Postfix) with ESMTP id D049BBA63 for ; Wed, 4 Oct 2006 01:08:44 +0200 (CEST) Message-ID: <4522ED7B.8040205@bouton.name> Date: Wed, 04 Oct 2006 01:08:43 +0200 From: Lionel Bouton User-Agent: Thunderbird 1.5.0.5 (X11/20060907) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] [RFC] CFLAGS paragraph for the GWN, 3rd version Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Archives-Salt: 71bd227d-eedc-4bb2-84c0-f0ffc252fc74 X-Archives-Hash: 8ec51c9d29f84e10cb74cffd4bb6104f Here's the third version of the draft, wiki-free and with less sugar too. More warnings. Thanks again for the input. --- Draft BEGIN ---
CFLAGS

Being able to tune the CFLAGS is part of one of the core principles of Gentoo: let the user be in control. Being in control brings both benefits and problems. CFLAGS tuning is not an exception.

We would like to remind you that using anything beyond -O2 -fomit-frame-pointer -march/-mcpu/-mtune in CFLAGS or CXXFLAGS (and -mieee, -mabi etc. on selected archs that tell you to do this), and using anything at all in LDFLAGS or ASFLAGS, is usually not worth it for most users. There's usually very little benefit, high risks and much time spent on frustating tuning that could be enjoyed doing far more interesting things.

The recent upgrade to gcc-4.1.1 for x86 and amd64 users changed the CFLAGS landscape. Users that spent some time tuning their CFLAGS with gcc-3.4.6 might find out that an upgrade to gcc-4.1.1 leaves them with an unstable system.

Example of this are :

  • nss_ldap stopped working with -ffast-math (reported to break many packages changing with the actual gcc version)
  • -fvisibility-inlines-hidden still breaks some code
  • if you used gcc-4.0, -ftree-loop-linear now breaks in gcc-4.1 (at least with mesa)
  • again for gcc-4.0 users, -ftree-vectorize is known to be broken in gcc-4.1 (at least for x86 and ppc, amd64 users seem to be safe)
  • -fforce-addr and -fweb break regularly on x86 with video libraries or graphic processing apps which use hand-optimised ASM

There are known-to-be-broken flags for all GCC versions that you want to check for too:

  • -fvisibility=hidden
  • -frename-registers
  • -ftracer
  • -D_FILE_OFFSET_BITS=64
  • -msse -mmmx -m3dnow
  • -W
  • -mfpmath=sse,387
  • -malign-double

Users with unsupported CFLAGS might want to return to safe CFLAGS (see warning above) if recent updates caused them stability problems. On the other hand, more adventurous users might want to experiment with CFLAGS that didn't work properly with gcc-3.4.6... As always, the user is in control (and the gun pointed to their feet is in his/her hand).

Final notes:

  • The gcc man page contains warnings for some unsafe optimization options. You should read it carefully when you experiment with CFLAGS or upgrade GCC on a CFLAGS-customized Gentoo.
  • Some options that are unsafe in the system-wide CFLAGS might be added automatically in some ebuilds if the developper deems them safe (by redefining CFLAGS or using append-flags of the flag-o-matic eclass). For example -ffast-math is added by the xmame/xmess ebuilds on most architectures even if you don't put it in your CFLAGS.
  • You might get an idea of the stability issues of a specific optimization option by running: find /usr/portage -name '*.ebuild'| xargs grep -- '-'. It takes quite some time, but might be enlightening: look for the 'filter-flags'.
--- Draft END --- Lionel -- gentoo-dev@gentoo.org mailing list -- gentoo-dev@gentoo.org mailing list