From 227c552a45b315e87523125cdc39d2da85744911 Mon Sep 17 00:00:00 2001 From: WangRunji Date: Sat, 5 Jan 2019 15:49:52 +0800 Subject: [PATCH] fix set gp on riscv --- src/arch/riscv/initcode.S | 7 +++++++ 1 file changed, 7 insertions(+) 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)