@@ -938,6 +938,9 @@ ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
KBUILD_RUSTFLAGS_KERNEL += -Zfunction-sections=y
LDFLAGS_vmlinux += --gc-sections
+ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION_DEBUG
+LDFLAGS_vmlinux += --print-gc-sections
+endif
endif
ifdef CONFIG_SHADOW_CALL_STACK
@@ -1404,6 +1404,13 @@ config LD_DEAD_CODE_DATA_ELIMINATION
present. This option is not well tested yet, so use at your
own risk.
+config LD_DEAD_CODE_DATA_ELIMINATION_DEBUG
+ bool "Debug dead code and data elimination (EXPERIMENTAL)"
+ depends on LD_DEAD_CODE_DATA_ELIMINATION
+ default n
+ help
+ Enable --print-gc-sections for --gc-sections
+
config LD_ORPHAN_WARN
def_bool y
depends on ARCH_WANT_LD_ORPHAN_WARN
Enable --print-gc-sections for --gc-sections to monitor which sections are really eliminated. Signed-off-by: Zhangjin Wu <falcon@tinylab.org> --- Makefile | 3 +++ init/Kconfig | 7 +++++++ 2 files changed, 10 insertions(+)