1DEBUG_CFLAGS := 2DEBUG_RUSTFLAGS := 3 4debug-flags-y := -g 5 6ifdef CONFIG_DEBUG_INFO_SPLIT 7DEBUG_CFLAGS += -gsplit-dwarf 8endif 9 10debug-flags-$(CONFIG_DEBUG_INFO_DWARF4) += -gdwarf-4 11debug-flags-$(CONFIG_DEBUG_INFO_DWARF5) += -gdwarf-5 12ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_AS_IS_GNU),yy) 13# Clang does not pass -g or -gdwarf-* option down to GAS. 14# Add -Wa, prefix to explicitly specify the flags. 15KBUILD_AFLAGS += $(addprefix -Wa$(comma), $(debug-flags-y)) 16endif 17DEBUG_CFLAGS += $(debug-flags-y) 18KBUILD_AFLAGS += $(debug-flags-y) 19 20ifdef CONFIG_DEBUG_INFO_REDUCED 21DEBUG_CFLAGS += -fno-var-tracking 22DEBUG_RUSTFLAGS += -Cdebuginfo=1 23ifdef CONFIG_CC_IS_GCC 24DEBUG_CFLAGS += -femit-struct-debug-baseonly 25endif 26else 27DEBUG_RUSTFLAGS += -Cdebuginfo=2 28endif 29 30ifdef CONFIG_DEBUG_INFO_COMPRESSED 31DEBUG_CFLAGS += -gz=zlib 32KBUILD_AFLAGS += -gz=zlib 33KBUILD_LDFLAGS += --compress-debug-sections=zlib 34endif 35 36KBUILD_CFLAGS += $(DEBUG_CFLAGS) 37export DEBUG_CFLAGS 38 39KBUILD_RUSTFLAGS += $(DEBUG_RUSTFLAGS) 40export DEBUG_RUSTFLAGS 41