diff --git a/src/arch/riscv/initcode.S b/src/arch/riscv/initcode.S index 0ce9b7b..0dc441a 100644 --- a/src/arch/riscv/initcode.S +++ b/src/arch/riscv/initcode.S @@ -3,6 +3,13 @@ .text .globl _start _start: + # set gp +.option push +.option norelax +1: auipc gp, %pcrel_hi(__global_pointer$) + addi gp, gp, %pcrel_lo(1b) +.option pop + # call user-program function LOAD a0, 0(sp) addi a1, sp, (__riscv_xlen / 8)