change default for BUILD_OPTIMIZATION, remove spurious assignments
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.)
p.
Richard Purdie
Acked-byQuoted 5 lines · Phil Blundell
I'd like to propose changing the bitbake.conf default for
BUILD_OPTIMIZATIONfrom "-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.
Quoted 7 lines
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_OPTIMIZATIONfor 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.)
Poky actually uses -ggdb now which makes the -dbg packages useful (if huge).
Cheers,
Richard
Hello.
Quoted 14 lines · Richard Purdie
Quoted 5 lines · Phil Blundell
I'd like to propose changing the bitbake.conf default for
BUILD_OPTIMIZATIONfrom "-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.Quoted 7 lines
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_OPTIMIZATIONfor 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.)
Quoted 4 lines
Acked-by Richard Purdie <[email protected]>Poky actually uses -ggdb now which makes the -dbg packages useful (if huge).
Perhaps go directly for -ggdb3? (There is always magic to learn if you hack some time with zecke. :))
regards
Stefan Schmidt
Quoted 14 lines · Richard Purdie
Quoted 5 lines · Phil Blundell
I'd like to propose changing the bitbake.conf default for
BUILD_OPTIMIZATIONfrom "-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.Quoted 7 lines
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_OPTIMIZATIONfor 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.)
Quoted 4 lines
Acked-by Richard Purdie <[email protected]>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
Quoted 3 lines · Cliff Brake
I agree, debug symbols are nice in *dbg packages. Are there any other thoughts pro/con for changing OE to match Poky
FULL_OPTIMIZATIONsettings?
The Poky setting does look better. I can't see any harm in changing OE to match that.
Quoted 1 line
Any thoughts on -g vs -ggdb for
BUILD_OPTIMIZATION?
Looking at what gcc actually does with those options, it doesn't seem like there's much difference for the common targets that we support. So I don't really have a view on it either way.
p.
Quoted 65 lines · Cliff Brake
Quoted 14 lines · Richard Purdie
Quoted 5 lines · Phil Blundell
I'd like to propose changing the bitbake.conf default for
BUILD_OPTIMIZATIONfrom "-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.Quoted 7 lines
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_OPTIMIZATIONfor 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.)Quoted 4 lines
Acked-by Richard Purdie <[email protected]>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_OPTIMIZATIONsettings?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.
Quoted 7 lines
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 ?
Quoted 17 lines
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_BUILDand rebuild packages of interest.Any thoughts on -g vs -ggdb for
BUILD_OPTIMIZATION?Thanks,
Cliff_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Quoted 2 lines · Khem Raj
-frename-registers was a workaround to get past a ARM GCC ICE in 4.2 IIRC
we should get rid of it.
No, -frename-registers is an optimisation in its own right. I think we probably want to keep that. You might be thinking of the -fno-rename-registers that we do use for some packages to avoid an ice on arm with gcc 3.4.
Quoted 2 lines
-fexpensive-optimizations and -fomit-frame-pointer are passed by default at O2 so we should get rid of them too.
Is that true on all targets? I didn't think that -O2 implied -fomit-frame-pointer on arm.
p.
Quoted 9 lines · Phil Blundell
Quoted 2 lines · Khem Raj
-frename-registers was a workaround to get past a ARM GCC ICE in 4.2 IIRC
we should get rid of it.No, -frename-registers is an optimisation in its own right. I think we probably want to keep that. You might be thinking of the -fno-rename-registers that we do use for some packages to avoid an ice on arm with gcc 3.4.
Quoted 5 lines
Quoted 2 lines
-fexpensive-optimizations and -fomit-frame-pointer are passed by default at O2 so we should get rid of them too.
Is that true on all targets? I didn't think that -O2 implied -fomit-frame-pointer on arm.
The 4.2.4 manual says:
"-O' also turns on -fomit-frame-pointer' on machines where doing so does not interfere with debugging." Which means that yes, iirc ARM won't have that turned on.
Signature · 1 line
Tom Rini
Quoted 5 lines · Phil Blundell
Quoted 2 lines · Khem Raj
-frename-registers was a workaround to get past a ARM GCC ICE in 4.2 IIRC we should get rid of it.
No, -frename-registers is an optimisation in its own right.
yes I was mentioning about why we have it enabled.
I think we
Quoted 1 line
probably want to keep that.
side effect is that It hampers debugging
You might be thinking of the
Quoted 2 lines
-fno-rename-registers that we do use for some packages to avoid an ice on arm with gcc 3.4.
yeah thats right. Rusted me
Quoted 5 lines
Quoted 3 lines
-fexpensive-optimizations and -fomit-frame-pointer are passed by default at O2 so we should get rid of them too.
Is that true on all targets?
yes
I didn't think that -O2 implied
Quoted 11 lines
-fomit-frame-pointer on arm.
p.
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Quoted 9 lines · On Tuesday 23 June 2009 19:46:54 Phil Blundell wrote:
Quoted 2 lines · Khem Raj
-frename-registers was a workaround to get past a ARM GCC ICE in 4.2
IIRC we should get rid of it.No, -frename-registers is an optimisation in its own right. I think we probably want to keep that. You might be thinking of the -fno-rename-registers that we do use for some packages to avoid an ice on arm with gcc 3.4.
Quoted 5 lines
Quoted 2 lines
-fexpensive-optimizations and -fomit-frame-pointer are passed by default at O2 so we should get rid of them too.
Is that true on all targets? I didn't think that -O2 implied -fomit-frame-pointer on arm.
From my testing on recent gcc... it is turned on by default.
z.