Build for RISC-V with LLVM

Nathaniel Hourt i at nathaniel.land
Thu Nov 6 15:39:10 CET 2025


On 2025-11-06 04:29, Yao Zi wrote:
> [...]
> But for other ports, it's necessary to correctly pad the binary
> to the alignment enforced for __image_binary_end/__bss_end. What ports
> did you observe issues on without padding?
> [...]

Only on a Milk-V Megrez board, which is an ESWIN EIC7700X SoC and as 
such, I believe it is not actually supported by upstream u-boot. The 
downstream repo [1] that supports it forked off quite some time ago, and 
thus may not be relevant here... Nevertheless, it also breaks when using 
LLD, because the u-boot-nodtb.bin is not 8-byte-aligned. If I pad it 
with null bytes to the 8-byte position that _end points to and then 
manually concatenate the DTB, it boots up and runs great.

I note that on that board, U-Boot does not have an SPL and is instead 
deployed as a payload of OpenSBI.

[1] https://github.com/milkv-megrez/rockos-u-boot

I suppose I also should've mentioned in my earlier email, I am now 
successfully building and running U-Boot built with Clang and LLD using 
Clang's integrated assembler instead of GNU as and using LLVM's binutils 
for, i.e., objcopy:

> Hit any key to stop autoboot: 0
> StarFive # version
> U-Boot 2025.10-pylon-00761-gc2104da88367-dirty (Nov 06 2025 - 02:03:37 
> +0000)
> 
> clang version 20.1.7+libcxx
> LLD 20.1.7 (compatible with GNU linkers)
> StarFive #

This is what I set out to do, so I am quite excited. =)

Is there anything else I can do to help get this issue properly resolved 
in the code so builds Just Work?

—
Nathaniel


More information about the U-Boot mailing list