Compiling U-BOOT for RISCV fails with LLD

image

There seems to be a section type mismatch error when compiling u-boot for the Vision Five 2 with llvm, lld and clang. I don’t know how to fix this, and I could only find related patches for ARM… Any ideas?

The command I ran is:

make OPENSBI=$PWD/../opensbi/opensbi/build/platform/generic/firmware/fw_dynamic.bin HOSTCC=clang CC=clang LD=ld.lld AR=llvm-ar CROSS_COMPILE=riscv64-unknown-elf

I followed the u-boot documentation for this board along with adding extra arguments to use LLVM: StarFive VisionFive2 — Das U-Boot unknown version documentation

There is probably an input section named .dynamic that conflicts with the linker-created section .dynamic of type SHT_DYNAMIC. If that is the case, rename input .dynamic