Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1DEBUG_CFLAGS :=
2debug-flags-y := -g
3
4ifdef CONFIG_DEBUG_INFO_SPLIT
5DEBUG_CFLAGS += -gsplit-dwarf
6endif
7
8debug-flags-$(CONFIG_DEBUG_INFO_DWARF4) += -gdwarf-4
9debug-flags-$(CONFIG_DEBUG_INFO_DWARF5) += -gdwarf-5
10ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_AS_IS_GNU),yy)
11# Clang does not pass -g or -gdwarf-* option down to GAS.
12# Add -Wa, prefix to explicitly specify the flags.
13KBUILD_AFLAGS += $(addprefix -Wa$(comma), $(debug-flags-y))
14endif
15DEBUG_CFLAGS += $(debug-flags-y)
16KBUILD_AFLAGS += $(debug-flags-y)
17
18ifdef CONFIG_DEBUG_INFO_REDUCED
19DEBUG_CFLAGS += -fno-var-tracking
20ifdef CONFIG_CC_IS_GCC
21DEBUG_CFLAGS += -femit-struct-debug-baseonly
22endif
23endif
24
25ifdef CONFIG_DEBUG_INFO_COMPRESSED
26DEBUG_CFLAGS += -gz=zlib
27KBUILD_AFLAGS += -gz=zlib
28KBUILD_LDFLAGS += --compress-debug-sections=zlib
29endif
30
31KBUILD_CFLAGS += $(DEBUG_CFLAGS)
32export DEBUG_CFLAGS