From 3cb4661c65f8770f30f2412ff8de136ce367c282 Mon Sep 17 00:00:00 2001 From: linfeng Date: Sun, 7 Jun 2026 17:28:18 +0800 Subject: [PATCH] Replace jump instruction with lla and jr for kernel entry With LTO disabled, a linker error occurs with the j jump instruction. --- components/someboot/src/arch/riscv64/entry.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/someboot/src/arch/riscv64/entry.rs b/components/someboot/src/arch/riscv64/entry.rs index f56d66936f..5bdd8d94d0 100644 --- a/components/someboot/src/arch/riscv64/entry.rs +++ b/components/someboot/src/arch/riscv64/entry.rs @@ -15,8 +15,10 @@ pub unsafe extern "C" fn _head() -> ! { naked_asm!( ".option push", ".option norvc", - // code0/code1 - "j {kernel_entry}", + // code0/code1: use lla+jr instead of j to avoid R_RISCV_JAL + // range limit (±1MB); lla expands to auipc+addi with ±2GB reach + "lla t0, {kernel_entry}", + "jr t0", "nop", ".option pop", // text_offset