Re: [tip:efi/core 3/7] /tmp/slab-258052.s:9870: Error: unrecognized opcode `zext.b a2,a2'

From: Nick Desaulniers
Date: Wed Dec 23 2020 - 15:03:49 EST


On Wed, Dec 23, 2020 at 10:36 AM Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> On Fri, Dec 18, 2020 at 09:03:14AM +0800, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git efi/core
> > head: b283477d394ac41ca59ee20eb9293ae9002eb1d7
> > commit: 6edcf9dc2e1aff3aa1f5a69ee420fb30dd0e968a [3/7] efi/libstub: EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER should not default to yes
> > config: riscv-randconfig-r022-20201217 (attached as .config)
> > compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
> > 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
> > # install riscv cross compiling tool for clang build
> > # apt-get install binutils-riscv64-linux-gnu
> > # https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=6edcf9dc2e1aff3aa1f5a69ee420fb30dd0e968a
> > git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
> > git fetch --no-tags tip efi/core
> > git checkout 6edcf9dc2e1aff3aa1f5a69ee420fb30dd0e968a
> > # save the attached .config to linux build tree
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv
>
> Something's still not good with that test - it fails much earlier for me:
>
> $ COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang /tmp/make.cross ARCH=riscv
> Compiler will be installed in /home/boris/0day
> cd: received redirection to `https://download.01.org/0day-ci/cross-package/'
> lftpget -c https://download.01.org/0day-ci/cross-package/./clang-latest/clang.tar.xz
> tar Jxf clang-latest/clang.tar.xz -C /home/boris/0day
> make W=1 CONFIG_OF_ALL_DTBS=y CONFIG_DTC=y HOSTCC=/home/boris/0day/clang-latest/bin/clang CC=/home/boris/0day/clang-latest/bin/clang LD=/home/boris/0day/clang-latest/bin/ld.lld HOSTLD=/home/boris/0day/clang-latest/bin/ld.lld AR=/home/boris/0day/clang-latest/bin/llvm-ar NM=/home/boris/0day/clang-latest/bin/llvm-nm STRIP=/home/boris/0day/clang-latest/bin/llvm-strip OBJDUMP=/home/boris/0day/clang-latest/bin/llvm-objdump OBJSIZE=/home/boris/0day/clang-latest/bin/llvm-size READELF=/home/boris/0day/clang-latest/bin/llvm-readelf HOSTCXX=/home/boris/0day/clang-latest/bin/clang++ HOSTAR=/home/boris/0day/clang-latest/bin/llvm-ar CROSS_COMPILE=riscv-linux-gnu- --jobs=32 ARCH=riscv
> SYNC include/config/auto.conf.cmd
> ...
>
> scripts/genksyms/parse.y: warning: 9 shift/reduce conflicts [-Wconflicts-sr]
> scripts/genksyms/parse.y: warning: 5 reduce/reduce conflicts [-Wconflicts-rr]
> DTC arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dtb
> DTC arch/riscv/boot/dts/kendryte/k210.dtb
> HOSTCC scripts/genksyms/parse.tab.o
> HOSTCC scripts/genksyms/lex.lex.o
> HOSTLD scripts/genksyms/genksyms
> CC scripts/mod/empty.o
> HOSTCC scripts/mod/mk_elfconfig
> CC scripts/mod/devicetable-offsets.s
> error: unknown target triple 'riscv-unknown-linux-gnu', please use -triple or -arch

Boris,
Thanks for taking the time to try to repro, and the report. Just
curious, which clang are you using? Is it from your distro? If you
have `llc` installed, can you send me the output of `llc --version`?

The reason I ask is; unlike GCC, Clang ships with all non-experimental
backends on by default, and relies on `--target=<triple>` when cross
compiling. You can disable backends when configuring a build of LLVM,
but it's frowned upon for distributions to do so (I do it locally to
speed up development). The above error is indicating that LLVM was
configured to not have RISCV support.

The RISCV backend only recently became a non-experimental (as in on by
default) backend a couple of releases ago, so either you have an old
clang that was intentionally built without experimental backends
(solution: use newer clang, where it should be on by default), or your
distro has disabled the backend (solution: encourage the package
maintainer to fix that), (or you configured LLVM yourself and didn't
enable RISCV).

Either way, you can ignore this report. Known issue with further
discussion here: https://github.com/ClangBuiltLinux/linux/issues/1220.
Happy holidays+new year.

> make[1]: *** [scripts/Makefile.build:117: scripts/mod/devicetable-offsets.s] Error 1
> make[1]: *** Waiting for unfinished jobs....
> error: unknown target triple 'riscv-unknown-linux-gnu', please use -triple or -arch
> make[1]: *** [scripts/Makefile.build:283: scripts/mod/empty.o] Error 1
> make: *** [Makefile:1199: prepare0] Error 2
> $
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@xxxxxxxxxxxxxxxx.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20201223183606.GB29011%40zn.tnic.



--
Thanks,
~Nick Desaulniers