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