6 ifdef CONFIG_DEBUG_INFO_SPLIT
7 DEBUG_CFLAGS += -gsplit-dwarf
10 debug-flags-$(CONFIG_DEBUG_INFO_DWARF4) += -gdwarf-4
11 debug-flags-$(CONFIG_DEBUG_INFO_DWARF5) += -gdwarf-5
12 ifeq ($(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.
15 KBUILD_AFLAGS += $(addprefix -Wa$(comma), $(debug-flags-y))
17 DEBUG_CFLAGS += $(debug-flags-y)
18 KBUILD_AFLAGS += $(debug-flags-y)
20 ifdef CONFIG_DEBUG_INFO_DWARF4
21 DEBUG_RUSTFLAGS += -Zdwarf-version=4
22 else ifdef CONFIG_DEBUG_INFO_DWARF5
23 DEBUG_RUSTFLAGS += -Zdwarf-version=5
26 ifdef CONFIG_DEBUG_INFO_REDUCED
27 DEBUG_CFLAGS += -fno-var-tracking
28 DEBUG_RUSTFLAGS += -Cdebuginfo=1
29 ifdef CONFIG_CC_IS_GCC
30 DEBUG_CFLAGS += -femit-struct-debug-baseonly
33 DEBUG_RUSTFLAGS += -Cdebuginfo=2
36 ifdef CONFIG_DEBUG_INFO_COMPRESSED_ZLIB
37 DEBUG_CFLAGS += -gz=zlib
38 DEBUG_RUSTFLAGS += -Zdebuginfo-compression=zlib
39 KBUILD_AFLAGS += -gz=zlib
40 KBUILD_LDFLAGS += --compress-debug-sections=zlib
41 else ifdef CONFIG_DEBUG_INFO_COMPRESSED_ZSTD
42 DEBUG_CFLAGS += -gz=zstd
43 DEBUG_RUSTFLAGS += -Zdebuginfo-compression=zstd
44 KBUILD_AFLAGS += -gz=zstd
45 KBUILD_LDFLAGS += --compress-debug-sections=zstd
48 KBUILD_CFLAGS += $(DEBUG_CFLAGS)
51 KBUILD_RUSTFLAGS += $(DEBUG_RUSTFLAGS)
52 export DEBUG_RUSTFLAGS