diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index b3031127d9a..f0e92c7f74f 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -167,6 +167,10 @@ set_compiler_property(PROPERTY freestanding -ffreestanding) # Flag to enable debugging set_compiler_property(PROPERTY debug -g) +# 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) + set_compiler_property(PROPERTY no_common -fno-common) # GCC compiler flags for imacros. The specific header must be appended by user.