Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kbuild: move -gsplit-dwarf, -gdwarf-4 option tests to Kconfig

CONFIG_DEBUG_INFO_SPLIT and CONFIG_DEBUG_INFO_DWARF4 enable extra
dwarf options if supported. You never know if they are really enabled
since Makefile may silently turn them off.

The actual behavior will match to the kernel configuration by
testing those compiler flags in the Kconfig stage.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

+4 -2
+2 -2
Makefile
··· 742 742 743 743 ifdef CONFIG_DEBUG_INFO 744 744 ifdef CONFIG_DEBUG_INFO_SPLIT 745 - DEBUG_CFLAGS += $(call cc-option, -gsplit-dwarf, -g) 745 + DEBUG_CFLAGS += -gsplit-dwarf 746 746 else 747 747 DEBUG_CFLAGS += -g 748 748 endif 749 749 KBUILD_AFLAGS += -Wa,-gdwarf-2 750 750 endif 751 751 ifdef CONFIG_DEBUG_INFO_DWARF4 752 - DEBUG_CFLAGS += $(call cc-option, -gdwarf-4,) 752 + DEBUG_CFLAGS += -gdwarf-4 753 753 endif 754 754 755 755 ifdef CONFIG_DEBUG_INFO_REDUCED
+2
lib/Kconfig.debug
··· 179 179 config DEBUG_INFO_SPLIT 180 180 bool "Produce split debuginfo in .dwo files" 181 181 depends on DEBUG_INFO 182 + depends on $(cc-option,-gsplit-dwarf) 182 183 help 183 184 Generate debug info into separate .dwo files. This significantly 184 185 reduces the build directory size for builds with DEBUG_INFO, ··· 195 194 config DEBUG_INFO_DWARF4 196 195 bool "Generate dwarf4 debuginfo" 197 196 depends on DEBUG_INFO 197 + depends on $(cc-option,-gdwarf-4) 198 198 help 199 199 Generate dwarf4 debug info. This requires recent versions 200 200 of gcc and gdb. It makes the debug information larger.