Revert "cmake: compiler/xcc: omit -g if needed for Clang"

This reverts commit deeb98da53.

A less invasive change has been implemented which does not
require changes to the GCC compiler flag file. So revert
the commit.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2022-02-01 09:44:00 -08:00 committed by Anas Nashif
commit 5c037fe122
2 changed files with 5 additions and 11 deletions

View file

@ -162,14 +162,12 @@ check_set_compiler_property(APPEND PROPERTY hosted -fno-freestanding)
# gcc flag for a freestandingapplication # gcc flag for a freestandingapplication
set_compiler_property(PROPERTY freestanding -ffreestanding) set_compiler_property(PROPERTY freestanding -ffreestanding)
if(NOT DEFINED GCC_NO_G_FLAG) # Flag to enable debugging
# Flag to enable debugging set_compiler_property(PROPERTY debug -g)
set_compiler_property(PROPERTY debug -g)
# 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)
endif()
set_compiler_property(PROPERTY no_common -fno-common) set_compiler_property(PROPERTY no_common -fno-common)

View file

@ -1,10 +1,6 @@
# No special flags are needed for xcc. # No special flags are needed for xcc.
# Only select whether gcc or clang flags should be inherited. # Only select whether gcc or clang flags should be inherited.
if(CC STREQUAL "clang") if(CC STREQUAL "clang")
if($ENV{XCC_NO_G_FLAG})
set(GCC_NO_G_FLAG 1)
endif()
include(${ZEPHYR_BASE}/cmake/compiler/clang/compiler_flags.cmake) include(${ZEPHYR_BASE}/cmake/compiler/clang/compiler_flags.cmake)
# Now, let's overwrite the flags that are different in xcc/clang. # Now, let's overwrite the flags that are different in xcc/clang.