[PATCH] kbuild: protect compiled-in dtb from dead data elimination

From: Marcin Nowakowski
Date: Wed Oct 26 2016 - 04:48:20 EST


DTBs are compiled into byte arrays that are placed inside
.dtb.init.rodata section. As they are never referenced directly from the
code, they get removed during dead data elimination and we end up with
__dtb_start == __dtb_end.

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@xxxxxxxxxx>
Fixes: b67067f1176d ("kbuild: allow archs to select link dead code/data elimination"
---
include/asm-generic/vmlinux.lds.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index abe79e3..ad5d0bb 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -193,7 +193,7 @@
#define KERNEL_DTB() \
STRUCT_ALIGN(); \
VMLINUX_SYMBOL(__dtb_start) = .; \
- *(.dtb.init.rodata) \
+ KEEP(*(.dtb.init.rodata)) \
VMLINUX_SYMBOL(__dtb_end) = .;

/*
--
2.7.4