blob: 9f39b0130551f3d35182df243a3fc9de38a1e264 [file] [log] [blame]
Masahiro Yamada6947fd92021-10-12 12:25:03 +09001DEBUG_CFLAGS :=
2
3ifdef CONFIG_DEBUG_INFO_SPLIT
4DEBUG_CFLAGS += -gsplit-dwarf
5else
6DEBUG_CFLAGS += -g
7endif
8
9ifndef CONFIG_AS_IS_LLVM
10KBUILD_AFLAGS += -Wa,-gdwarf-2
11endif
12
13ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
14dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
15dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5
16DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
17endif
18
19ifdef CONFIG_DEBUG_INFO_REDUCED
20DEBUG_CFLAGS += -fno-var-tracking
21ifdef CONFIG_CC_IS_GCC
22DEBUG_CFLAGS += -femit-struct-debug-baseonly
23endif
24endif
25
26ifdef CONFIG_DEBUG_INFO_COMPRESSED
27DEBUG_CFLAGS += -gz=zlib
28KBUILD_AFLAGS += -gz=zlib
29KBUILD_LDFLAGS += --compress-debug-sections=zlib
30endif
31
32KBUILD_CFLAGS += $(DEBUG_CFLAGS)
33export DEBUG_CFLAGS