Re: [mtd:spi-mem-ecc 30/30] ld.lld: error: undefined symbol: nand_ecc_unregister_on_host_hw_engine

From: Miquel Raynal
Date: Wed Feb 02 2022 - 09:45:10 EST


Hi Mark,

lkp@xxxxxxxxx wrote on Tue, 1 Feb 2022 13:28:45 +0800:

> tree: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git spi-mem-ecc
> head: 6d0fadec1de4434fce145b374ef25c665357fa60
> commit: 6d0fadec1de4434fce145b374ef25c665357fa60 [30/30] spi: mxic: Add support for pipelined ECC operations
> config: hexagon-randconfig-r001-20220130 (https://download.01.org/0day-ci/archive/20220201/202202011308.a6RlPiGp-lkp@xxxxxxxxx/config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6b1e844b69f15bb7dffaf9365cd2b355d2eb7579)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/commit/?id=6d0fadec1de4434fce145b374ef25c665357fa60
> git remote add mtd https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git
> git fetch --no-tags mtd spi-mem-ecc
> git checkout 6d0fadec1de4434fce145b374ef25c665357fa60
> # save the config file to linux build tree
> mkdir build_dir
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All errors (new ones prefixed by >>):
>
> >> ld.lld: error: undefined symbol: nand_ecc_unregister_on_host_hw_engine
> >>> referenced by spi-mxic.c
> >>> spi/spi-mxic.o:(mxic_spi_remove) in archive drivers/built-in.a
> >>> referenced by spi-mxic.c
> >>> spi/spi-mxic.o:(mxic_spi_remove) in archive drivers/built-in.a

I've failed to prevent faulty configurations with regular depends
on/select keywords, so I've come with a new solution which received a
successful build coverage test from the 0-day robots.

In order to still be able to use the spi controller driver (=y) while
mtd is =m or =n, I need to add an IS_REACHABLE() check in a couple of
headers. This way we can just imply the right MTD symbols from the
SPI_MXIC Kconfig entry.

I'll send a v11 with these changes which seem to rather cleanly address
all situations. I don't think I can do without these extra checks as
select/imply will not propagate the real value of the Kconfig symbol
(y/m) like depends on does.

Thanks,
Miquèl