On Tue, 10 Sep 2024 18:44:52 +0900, Masahiro Yamada wrote: > Built-in DTB files are discarded because KERNEL_DTB() is a part of > INIT_DATA, as defined in include/asm-generic/vmlinux.lds.h. > > Currently, modpost warns about mismatched section references to init > data only when the destination section is prefixed with ".init.". > However, ".dtb.init.rodata" is also discarded. > > This commit has revealed some missing annotations. > > overlays[] references builtin DTBs, which become dangling pointers > after early boot. > > testdrv_probe() is not an __init function, yet it holds a reference to > overlays[]. The assumption is that this function is executed only at > the boot time even though it remains in memory. I annotated it as __ref > because otherwise I do not know how to suppress the modpost warning. > > I marked the dtb_start as __initdata in the Xtensa boot code, although > modpost does not warn about it because __dtb_start is not yet defined > at the time of modpost. > > Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx> > --- > > Changes in v2: > - New patch > > arch/xtensa/kernel/setup.c | 2 +- > drivers/of/unittest.c | 5 +++-- > scripts/mod/modpost.c | 2 +- > 3 files changed, 5 insertions(+), 4 deletions(-) > Acked-by: Rob Herring (Arm) <robh@xxxxxxxxxx>