Closed alexispolti closed 3 years ago
I'm not sure that this is a good idea to add debug symbols with Os and LTO optimization settings.
Well, debug symbols are completely separated from code generation / lto : the generated code is the same with ou without -g
. It's just some additional sections in the ELF file which are added to tell the debugger where to find a specific instruction. What problem do you see?
I see no problems, but also I see no reasons to use -g option without -O0 or -Og optimization settings. I have a negative experience using debug symbols with high optimization levels. I'll think about adding a variable like OPTFLAGS ?= -Os -flto
to the makefile that can be changed from the command line to get debug/release code.
IIRC, on ARM 32bits, gcc with -Os
doesn't generate "undebuggable" code. I did some debug and made some modifications these last few days without any problem.
But your approach (OPTFLAGS ?= -Os -flto
) is perfect, thanx :-)
I will close this PR. And Thank you for the contribution.
Simple MR to allow debugging when porting on a new architecture.
-g
doesn't harm, as debugging infos are not flashed and the generated code is the same.Feel free to include or not! :-)