[PATCH 0/2] RISC-V: implement private GCC library

Mark Kettenis mark.kettenis at xs4all.nl
Tue Dec 2 13:25:27 CET 2025


> From: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> Date: Mon,  1 Dec 2025 18:47:03 +0100
> 
> We currently include libgcc.a when building for the RISC-V architecture.
> For instance lib/mbedtls/external/mbedtls/library/bignum.c uses __ctzdi2().
> 
> At least the Ubuntu Linux distribution has switched to building libgcc.a
> for the RVA23S64 profile. Using this library on RVA20 systems results in
> crashes. We therefore need a private replacement library.

Sound like the real problem here is using a native toolchain instead
of a toolchain for the target at hand.

That said, the solution a sensible one.

> With the series a private GCC library and unit tests are provided for
> 64-bit RISC-V. This is enough to build for CONFIG_WGET_HTTPS as suggested
> in E's patch
> 
> [PATCH] configs: starfive: enable wget https
> https://lore.kernel.org/u-boot/20251112005451.41285-1-e@freeshell.de/
> 
> Heinrich Schuchardt (2):
>   RISC-V: implement private GCC library
>   test: provide unit tests for the RISC-V private GCC library
> 
>  arch/Kconfig            |   1 +
>  arch/riscv/lib/Makefile |   2 +
>  arch/riscv/lib/clz.c    | 105 ++++++++++++++++++++++++++++++++++++++++
>  arch/riscv/lib/ctz.c    |  97 +++++++++++++++++++++++++++++++++++++
>  lib/Kconfig             |   2 +-
>  test/lib/Makefile       |   4 ++
>  test/lib/test_clz.c     |  53 ++++++++++++++++++++
>  test/lib/test_ctz.c     |  53 ++++++++++++++++++++
>  8 files changed, 316 insertions(+), 1 deletion(-)
>  create mode 100644 arch/riscv/lib/clz.c
>  create mode 100644 arch/riscv/lib/ctz.c
>  create mode 100644 test/lib/test_clz.c
>  create mode 100644 test/lib/test_ctz.c
> 
> -- 
> 2.51.0
> 
> 


More information about the U-Boot mailing list