kconfig,toolchain: add an option for compiler save-temps

Add a Kconfig option to set the compiler save-temps flag and set the GCC
implementation. This is very useful for troubleshooting macro expansion
issues, having an option allows a user to set it like any other config
option.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
Fabio Baltieri 2023-03-29 10:11:46 +01:00 committed by Anas Nashif
commit 3f8f7130e7
5 changed files with 20 additions and 0 deletions

View file

@ -180,6 +180,9 @@ check_set_compiler_property(PROPERTY freestanding -ffreestanding)
# Flag to enable debugging
set_compiler_property(PROPERTY debug -g)
# Flags to save temporary object files
set_compiler_property(PROPERTY save_temps -save-temps=obj)
# GCC 11 by default emits DWARF version 5 which cannot be parsed by
# pyelftools. Can be removed once pyelftools supports v5.
check_set_compiler_property(APPEND PROPERTY debug -gdwarf-4)