[patch] Cleaning up amd64 kernel optimization options
Kostik Belousov
kostikbel at gmail.com
Fri Dec 23 17:55:16 UTC 2011
On Fri, Dec 23, 2011 at 06:03:42PM +0100, Dimitry Andric wrote:
> On 2011-12-23 17:00, Alexander Best wrote:
> ...
> >>>Back in the 7.x days, I ran into some code that wasn't easily to debug
> >>>because the compiler optimized things out with -O2 by inlining and
> >>otherwise shifting around code, so setting breakpoints in gdb became
> >>difficult. So from that point on I've gotten into the habit of doing -O
> >>explicitly in make.conf if DEBUG_FLAGS was specified. Just a thought..
> >>
> >>I still leave -O2 in, but what I do is this:
> >>
> >> make DEBUG_FLAGS="-g -fno-inline"
> >
> >would making -O2 -fno-inline the default flags introduce any major
> >slowdown?
>
> Not major, but a minor slowdown is quite possible, especially on arches
> like x86, where call overhead is relatively high, and code caches are
> relatively large.
>
> Anyway, I'd rather get the thread back to my original patch instead of
> messing around with the default flags for release, which have been -O2
> for a long time now. If people want to override those for specific
> reasons, they can always set COPTFLAGS or DEBUG_FLAGS manually, like
> John shows.
>
> The only thing my patch makes sure of, is that amd64 does the same thing
> as all other arches, e.g.: compile with a low optimization settings for
> debug (-O, which is equivalent to -O1), compile with arch-specific high
> optimization settings for release (-O2 plus whatever is required for the
> arch, or lower if optimization breaks things).
Release is built with -g for long time, this is where the symbol files
in /boot/kernel comes from.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20111223/1882e156/attachment.pgp
More information about the freebsd-current
mailing list