1 DEBUG_CFLAGS := 2 DEBUG_RUSTFLAGS := 3 4 debug-flags-y := -g 5 6 ifdef CONFIG_DEBUG_INFO_SPLIT 7 DEBUG_CFLAGS += -gsplit-dwarf 8 endif 9 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)) 16 endif 17 DEBUG_CFLAGS += $(debug-flags-y) 18 KBUILD_AFLAGS += $(debug-flags-y) 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 27 DEBUG_CFLAGS += -fno-var-tracking 28 DEBUG_RUSTFLAGS += -Cdebuginfo=1 29 ifdef CONFIG_CC_IS_GCC 30 DEBUG_CFLAGS += -femit-struct-debug-baseonly 31 endif 32 else 33 DEBUG_RUSTFLAGS += -Cdebuginfo=2 34 endif 35 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 46 endif 47 48 KBUILD_CFLAGS += $(DEBUG_CFLAGS) 49 export DEBUG_CFLAGS 50 51 KBUILD_RUSTFLAGS += $(DEBUG_RUSTFLAGS) 52 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.