Skip to content

Commit 08f01ba

Browse files
aykevldeadprogram
authored andcommitted
riscv: improve startup assembly
Now that we've switched to LLVM 9, we don't need a workaround anymore for the 'la' pseudo-instruction.
1 parent 699312f commit 08f01ba

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/device/riscv/start.S

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
.type _start,@function
44

55
_start:
6-
// Workaround for missing support of the la pseudo-instruction in Clang 8:
7-
// https://reviews.llvm.org/D55325
8-
lui sp, %hi(_stack_top)
9-
addi sp, sp, %lo(_stack_top)
10-
// see https://gnu-mcu-eclipse.github.io/arch/riscv/programmer/#the-gp-global-pointer-register
11-
lui gp, %hi(__global_pointer$)
12-
addi gp, gp, %lo(__global_pointer$)
6+
// Load the stack pointer.
7+
la sp, _stack_top
8+
// Load the globals pointer. The program will load pointers relative to this
9+
// register, so it must be set to the right value on startup.
10+
// See: https://gnu-mcu-eclipse.github.io/arch/riscv/programmer/#the-gp-global-pointer-register
11+
la gp, __global_pointer$
1312
call main

0 commit comments

Comments
 (0)