exo wrote:
I've researched the issue and as far as I understand the riscv64-elf target is not supported, but riscv64-linux is. My question is what's the practical difference between the two targets?
The -elf target does not associate with any OS, whereas -linux does. This has side-effects such as where GCC searches for the stack canary when compiling with -fstack-protector. In your case, you are noticing that it also fails to add a few linker scripts (that is all the -z options change, in the end), and it disables shared libraries. I presume that is because without an OS, there is nothing that can interpret relocation entries. Now, in your case there actually is, the UEFI runtime will do it for you. I don't know what the best solution here is. I usually just use a compiler that outputs PE directly for the purpose of compiling UEFI bootloaders. But that wouldn't work for the u-boot build system, since it clearly expects to create an ELF file and then objcopy it.