diff options
| author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2026-01-09 01:39:52 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-08 16:39:52 -0800 |
| commit | a1c373ec89a3500630bafabf406108a8fc568bcc (patch) | |
| tree | 3599e407de5f1fe4a125dd04524e2331154a1ad2 /v | |
| parent | 11e43745d141be4bd17e6762d1ad771ade0422a8 (diff) | |
| download | env-master.zip env-master.tar.gz env-master.tar.bz2 | |
When building riscv-tests with Ubuntu's gcc 15.2.0-7ubuntu1 an error
occurs:
rv32ui-v-simple-entry.o: in function `handle_reset':
(.text.init+0xa4): dangerous relocation:
The addend isn't allowed for R_RISCV_GOT_HI20
Split loading STACK_TOP - SIZEOF_TRAPFRAME_T into separate load and
add instructions.
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc only describes R_RISCV_GOT_HI20 with offset 0 to a label.
The topic of addends for R_RISCV_GOT_HI20 was discussed in https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/184#issuecomment-830988778
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'v')
| -rw-r--r-- | v/entry.S | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -10,7 +10,7 @@ # define REGBYTES 4 #endif -#define STACK_TOP (_end + RISCV_PGSIZE * 4) +#define STACK_SIZE (RISCV_PGSIZE * 4) .section ".text.init","ax",@progbits .globl _start @@ -64,7 +64,9 @@ handle_reset: la t0, trap_vector csrw mtvec, t0 - la sp, STACK_TOP - SIZEOF_TRAPFRAME_T + li t0, STACK_SIZE - SIZEOF_TRAPFRAME_T + la sp, _end + add sp, sp, t0 csrr t0, mhartid slli t0, t0, 12 add sp, sp, t0 |
