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. 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/[email protected]/ 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

