Hi Ley Foon, You're right it doesn't boot for me either when building with make ARCH=riscv LLVM=1 The following patch fixes it for me though. In hindsigt it's perhaps a bit surprising it works without -ffreestanding in GCC. /Emil --- arch/riscv/lib/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile index e33263cc622a..6dfa919d4cd6 100644 --- a/arch/riscv/lib/Makefile +++ b/arch/riscv/lib/Makefile @@ -4,4 +4,9 @@ lib-$(CONFIG_MMU) += uaccess.o lib-$(CONFIG_64BIT) += tishift.o lib-$(CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE) += string.o +# string.o implements standard library functions like memset/memcpy etc. +# Use -ffreestanding to ensure that the compiler does not try to "optimize" +# them into calls to themselves. +CFLAGS_string.o := -ffreestanding + obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o -- 2.34.1