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

Khem Raj raj.khem at gmail.com
Tue Jun 23 17:30:13 UTC 2009


On Thu, Jun 18, 2009 at 11:09 AM, Cliff Brake<cliff.brake at gmail.com> wrote:
> 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"

-feliminate-unused-debug-types should only affect stabs which I guess we
do not use. We could use -feliminate-dwarf2-dups if we are using dwarf2
 -frename-registers was a workaround to get past a ARM GCC ICE in 4.2 IIRC
we should get rid of it.

-fexpensive-optimizations and -fomit-frame-pointer are passed by
default at O2 so we should get rid of them too.

Should we also use something SIZE_OPTIMIZATION combination ?

> 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
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel at lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>




More information about the Openembedded-devel mailing list