[oe] [rfc] change default for BUILD_OPTIMIZATION, remove spurious assignments

Cliff Brake cliff.brake at gmail.com
Thu Jun 18 18:09:51 UTC 2009


On Fri, Jun 12, 2009 at 4:24 PM, Richard Purdie<rpurdie at rpsys.net> wrote:
> On Fri, 2009-06-12 at 20:55 +0100, Phil Blundell wrote:
>> I'd like to propose changing the bitbake.conf default for
>> BUILD_OPTIMIZATION from "-O2" to "-O2 -g".  There seems no harm in
>> building debuggable binaries for host-side utilities and it makes life
>> somewhat easier when things go wrong.
>>
>> Also, while investigating why assignments to this variable from
>> local.conf didn't do what I was expecting, I discovered that a whole lot
>> of files inside conf/, notably all of the sane-toolchain-*.inc files,
>> contain their own assignments to BUILD_OPTIMIZATION for no good reason
>> that I can see.  I would also propose to delete the assignments from
>> those files.  (There are a few other assignments in files that are
>> either DISTRO or MACHINE specific but I intend to leave those alone.)
>
> Acked-by: Richard Purdie <rpurdie at linux.intel.com>
>
> Poky actually uses -ggdb now which makes the -dbg packages useful (if
> huge).

Poky currently uses:
##################################################################
# Optimization flags.
##################################################################

FULL_OPTIMIZATION = "-fexpensive-optimizations -fomit-frame-pointer
-frename-registers -O2 -ggdb -feliminate-unused-debug-types"
DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer -g"
SELECTED_OPTIMIZATION = "${@bb.data.getVar(['FULL_OPTIMIZATION',
'DEBUG_OPTIMIZATION'][bb.data.getVar('DEBUG_BUILD', d, 1) == '1'], d,
1)}"
BUILD_OPTIMIZATION = "-O2"

OE uses:
##################################################################
# Optimization flags.
##################################################################

FULL_OPTIMIZATION = "-fexpensive-optimizations -fomit-frame-pointer
-frename-registers -O2"
DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer -g"
SELECTED_OPTIMIZATION = "${@bb.data.getVar(['FULL_OPTIMIZATION',
'DEBUG_OPTIMIZATION'][bb.data.getVar('DEBUG_BUILD', d, 1) == '1'], d,
1)}"
BUILD_OPTIMIZATION = "-O2 -g"

I agree, debug symbols are nice in *dbg packages.  Are there any other
thoughts pro/con for changing OE to match Poky FULL_OPTIMIZATION
settings?

As to -ggdb3, the following information may be helpful.

-ggdblevel

           Request debugging information and also use level to specify
how much information.  The default level is 2.

           Level 0 produces no debug information at all.  Thus, -g0 negates -g.

           Level 1 produces minimal information, enough for making
backtraces in parts of the program that you don’t plan to debug.
           This includes descriptions of functions and external
variables, but no information about local variables and no line
numbers.

           Level 3 includes extra information, such as all the macro
definitions present in the program.  Some debuggers support macro
           expansion when you use -g3.

So maybe a good way to do this is:
FULL_OPTIMIZATION = "-fexpensive-optimizations -fomit-frame-pointer
-frename-registers -O2 -ggdb -feliminate-unused-debug-types"
DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer -ggdb3"
BUILD_OPTIMIZATION = "-O2 -ggdb"

That way with *dbg packages installed, you could at least get a back
trace with a normal build.  If you needed line numbers, you could set
DEBUG_BUILD and rebuild packages of interest.

Any thoughts on -g vs -ggdb for BUILD_OPTIMIZATION?

Thanks,
Cliff




More information about the Openembedded-devel mailing list