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:
parent
d82175eadd
commit
3f8f7130e7
|
@ -299,6 +299,11 @@ zephyr_compile_options($<TARGET_PROPERTY:compiler,no_common>)
|
||||||
# @Intent: Set compiler specific flag for production of debug information
|
# @Intent: Set compiler specific flag for production of debug information
|
||||||
zephyr_compile_options($<TARGET_PROPERTY:compiler,debug>)
|
zephyr_compile_options($<TARGET_PROPERTY:compiler,debug>)
|
||||||
|
|
||||||
|
if(CONFIG_COMPILER_SAVE_TEMPS)
|
||||||
|
# @Intent: Set compiler specific flag for saving temporary object files
|
||||||
|
zephyr_compile_options($<TARGET_PROPERTY:compiler,save_temps>)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CONFIG_COMPILER_COLOR_DIAGNOSTICS)
|
if(CONFIG_COMPILER_COLOR_DIAGNOSTICS)
|
||||||
# @Intent: Set compiler specific flag for diagnostic messages
|
# @Intent: Set compiler specific flag for diagnostic messages
|
||||||
zephyr_compile_options($<TARGET_PROPERTY:compiler,diagnostic>)
|
zephyr_compile_options($<TARGET_PROPERTY:compiler,diagnostic>)
|
||||||
|
|
|
@ -363,6 +363,12 @@ config COMPILER_WARNINGS_AS_ERRORS
|
||||||
help
|
help
|
||||||
Turn on "warning as error" toolchain flags
|
Turn on "warning as error" toolchain flags
|
||||||
|
|
||||||
|
config COMPILER_SAVE_TEMPS
|
||||||
|
bool "Save temporary object files"
|
||||||
|
help
|
||||||
|
Instruct the compiler to save the temporary intermediate files
|
||||||
|
permanently. These can be useful for troubleshooting build issues.
|
||||||
|
|
||||||
config COMPILER_COLOR_DIAGNOSTICS
|
config COMPILER_COLOR_DIAGNOSTICS
|
||||||
bool "Colored diagnostics"
|
bool "Colored diagnostics"
|
||||||
default y
|
default y
|
||||||
|
|
|
@ -20,6 +20,9 @@ set_property(TARGET compiler PROPERTY coverage --coverage -fno-inline)
|
||||||
# clang flag for colourful diagnostic messages
|
# clang flag for colourful diagnostic messages
|
||||||
set_compiler_property(PROPERTY diagnostic -fcolor-diagnostics)
|
set_compiler_property(PROPERTY diagnostic -fcolor-diagnostics)
|
||||||
|
|
||||||
|
# clang flag to save temporary object files
|
||||||
|
set_compiler_property(PROPERTY save_temps -save-temps)
|
||||||
|
|
||||||
#######################################################
|
#######################################################
|
||||||
# This section covers flags related to warning levels #
|
# This section covers flags related to warning levels #
|
||||||
#######################################################
|
#######################################################
|
||||||
|
|
|
@ -103,6 +103,9 @@ set_compiler_property(PROPERTY freestanding)
|
||||||
# Flag to include debugging symbol in compilation
|
# Flag to include debugging symbol in compilation
|
||||||
set_compiler_property(PROPERTY debug)
|
set_compiler_property(PROPERTY debug)
|
||||||
|
|
||||||
|
# Flags to save temporary object files
|
||||||
|
set_compiler_property(PROPERTY save_temps)
|
||||||
|
|
||||||
set_compiler_property(PROPERTY no_common)
|
set_compiler_property(PROPERTY no_common)
|
||||||
|
|
||||||
# Flags for imacros. The specific header must be appended by user.
|
# Flags for imacros. The specific header must be appended by user.
|
||||||
|
|
|
@ -180,6 +180,9 @@ check_set_compiler_property(PROPERTY freestanding -ffreestanding)
|
||||||
# Flag to enable debugging
|
# Flag to enable debugging
|
||||||
set_compiler_property(PROPERTY debug -g)
|
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
|
# GCC 11 by default emits DWARF version 5 which cannot be parsed by
|
||||||
# pyelftools. Can be removed once pyelftools supports v5.
|
# pyelftools. Can be removed once pyelftools supports v5.
|
||||||
check_set_compiler_property(APPEND PROPERTY debug -gdwarf-4)
|
check_set_compiler_property(APPEND PROPERTY debug -gdwarf-4)
|
||||||
|
|
Loading…
Reference in a new issue