1 DEBUG_CFLAGS := 1 DEBUG_CFLAGS := 2 DEBUG_RUSTFLAGS := 2 DEBUG_RUSTFLAGS := 3 3 4 debug-flags-y := -g 4 debug-flags-y := -g 5 5 6 ifdef CONFIG_DEBUG_INFO_SPLIT 6 ifdef CONFIG_DEBUG_INFO_SPLIT 7 DEBUG_CFLAGS += -gsplit-dwarf 7 DEBUG_CFLAGS += -gsplit-dwarf 8 endif 8 endif 9 9 10 debug-flags-$(CONFIG_DEBUG_INFO_DWARF4) += -gd 10 debug-flags-$(CONFIG_DEBUG_INFO_DWARF4) += -gdwarf-4 11 debug-flags-$(CONFIG_DEBUG_INFO_DWARF5) += -gd 11 debug-flags-$(CONFIG_DEBUG_INFO_DWARF5) += -gdwarf-5 12 ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_AS_IS_GNU) 12 ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_AS_IS_GNU),yy) 13 # Clang does not pass -g or -gdwarf-* option d 13 # Clang does not pass -g or -gdwarf-* option down to GAS. 14 # Add -Wa, prefix to explicitly specify the fl 14 # Add -Wa, prefix to explicitly specify the flags. 15 KBUILD_AFLAGS += $(addprefix -Wa$(comma), $( 15 KBUILD_AFLAGS += $(addprefix -Wa$(comma), $(debug-flags-y)) 16 endif 16 endif 17 DEBUG_CFLAGS += $(debug-flags-y) 17 DEBUG_CFLAGS += $(debug-flags-y) 18 KBUILD_AFLAGS += $(debug-flags-y) 18 KBUILD_AFLAGS += $(debug-flags-y) 19 19 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 << 24 endif << 25 << 26 ifdef CONFIG_DEBUG_INFO_REDUCED 20 ifdef CONFIG_DEBUG_INFO_REDUCED 27 DEBUG_CFLAGS += -fno-var-tracking 21 DEBUG_CFLAGS += -fno-var-tracking 28 DEBUG_RUSTFLAGS += -Cdebuginfo=1 22 DEBUG_RUSTFLAGS += -Cdebuginfo=1 29 ifdef CONFIG_CC_IS_GCC 23 ifdef CONFIG_CC_IS_GCC 30 DEBUG_CFLAGS += -femit-struct-debug-baseonl 24 DEBUG_CFLAGS += -femit-struct-debug-baseonly 31 endif 25 endif 32 else 26 else 33 DEBUG_RUSTFLAGS += -Cdebuginfo=2 27 DEBUG_RUSTFLAGS += -Cdebuginfo=2 34 endif 28 endif 35 29 36 ifdef CONFIG_DEBUG_INFO_COMPRESSED_ZLIB 30 ifdef CONFIG_DEBUG_INFO_COMPRESSED_ZLIB 37 DEBUG_CFLAGS += -gz=zlib 31 DEBUG_CFLAGS += -gz=zlib 38 DEBUG_RUSTFLAGS += -Zdebuginfo-compression=zli << 39 KBUILD_AFLAGS += -gz=zlib 32 KBUILD_AFLAGS += -gz=zlib 40 KBUILD_LDFLAGS += --compress-debug-sections=z 33 KBUILD_LDFLAGS += --compress-debug-sections=zlib 41 else ifdef CONFIG_DEBUG_INFO_COMPRESSED_ZSTD 34 else ifdef CONFIG_DEBUG_INFO_COMPRESSED_ZSTD 42 DEBUG_CFLAGS += -gz=zstd 35 DEBUG_CFLAGS += -gz=zstd 43 DEBUG_RUSTFLAGS += -Zdebuginfo-compression=zst << 44 KBUILD_AFLAGS += -gz=zstd 36 KBUILD_AFLAGS += -gz=zstd 45 KBUILD_LDFLAGS += --compress-debug-sections=z 37 KBUILD_LDFLAGS += --compress-debug-sections=zstd 46 endif 38 endif 47 39 48 KBUILD_CFLAGS += $(DEBUG_CFLAGS) 40 KBUILD_CFLAGS += $(DEBUG_CFLAGS) 49 export DEBUG_CFLAGS 41 export DEBUG_CFLAGS 50 42 51 KBUILD_RUSTFLAGS += $(DEBUG_RUSTFLAGS) 43 KBUILD_RUSTFLAGS += $(DEBUG_RUSTFLAGS) 52 export DEBUG_RUSTFLAGS 44 export DEBUG_RUSTFLAGS
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.