Skip to content

Commit

Permalink
risc-v: disable linker relaxations during gp init
Browse files Browse the repository at this point in the history
  • Loading branch information
yannishuber authored and aykevl committed Jul 7, 2020
1 parent 0b94e48 commit 7ed7e6c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/device/riscv/start.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ _start:
// Load the globals pointer. The program will load pointers relative to this
// register, so it must be set to the right value on startup.
// See: https://gnu-mcu-eclipse.github.io/arch/riscv/programmer/#the-gp-global-pointer-register
// Linker relaxations must be disabled to avoid the initialization beign
// relaxed with an uninitialized global pointer: mv gp, gp
.option push
.option norelax
la gp, __global_pointer$
.option pop

// Jump to runtime.main
call main

0 comments on commit 7ed7e6c

Please sign in to comment.