[patch] Cleaning up amd64 kernel optimization options

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Thu, 22 Dec 2011 16:35:46 +0100
Hi,

I would like to ask some feedback on the attached patch, which cleans up
the kernel optimization options for amd64.  This was touched upon
earlier by Alexander Best in freebsd-toolchain, here:

http://lists.freebsd.org/pipermail/freebsd-toolchain/2011-October/000270.html

What this patch attempts to fix is the following:
- When you compile amd64 kernels for debug, they still get optimized
   with "-O2 -frename-registers", which is almost certain to make
   debugging miserable.  Optimizing at higher levels makes variables and
   code move around, or disappear altogether.  About -frename-registers
   the gcc documentation even says: "Depending on the debug information
   format adopted by the target, however, it can make debugging
   impossible, since variables will no longer stay in a “home register”."
- Clang doesn't support the -frename-registers option, so you get
   harmless but annoying "warning: argument unused during compilation:
   '-frename-registers'" messages during buildkernel.

The patch makes it so that:
- For normal amd64 kernel builds, it uses "-O2 -frename-registers",
   unless Clang is used, then it uses plain "-O2".
- For debug amd64 kernel builds, it uses "-O", just like all the other
   arches.

Received on Thu Dec 22 2011 - 14:35:48 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:22 UTC