[PATCH 0/2] Clang compatibility improvements for RISC-V
    Yao Zi 
    ziyao at disroot.org
       
    Sun Apr 27 16:50:09 CEST 2025
    
    
  
Originally reported by Nathaniel Hourt[1], U-Boot fails to boot on
JH7110 platforms (starfive_visionfive2_defconfig) when building with
Clang.
This series fixes configuration generation with Clang's preprocessor and
add an alternative codepath for RISC-V to access gd to workaround
misoptimization of Clang, which is sufficient for building images for
JH7110 boards.
Tested with
- starfive_visionfive2_defconfig
- qemu-riscv64_smode_defconfig
- sifive_unleashed_defconfig
built with either GCC 14 or LLVM 19.
Note that images built with LLVM lld are still broken and binutils ld
has to be used for now. To test the changes on JH7110 platforms, this
patch[2] must be applied for SPL to function.
[1]: https://lore.kernel.org/u-boot/932979cb47c4fded7ac19216ca172504@nathaniel.land/
[2]: https://lore.kernel.org/all/20250330162421.238483-1-heinrich.schuchardt@canonical.com/
Yao Zi (2):
  Makefile: Strip leading spaces when preprocessing generated_defconfig
  riscv: Access gd with inline assembly when building with LTO or Clang
 arch/riscv/cpu/cpu.c                 |  6 ++++++
 arch/riscv/include/asm/global_data.h | 19 +++++++++++++++++++
 common/board_r.c                     |  4 +++-
 common/init/board_init.c             |  7 +++++--
 scripts/kconfig/Makefile             |  1 +
 5 files changed, 34 insertions(+), 3 deletions(-)
-- 
2.49.0
    
    
More information about the U-Boot
mailing list