summaryrefslogtreecommitdiff
path: root/v
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2026-01-09 01:39:52 +0100
committerGitHub <noreply@github.com>2026-01-08 16:39:52 -0800
commita1c373ec89a3500630bafabf406108a8fc568bcc (patch)
tree3599e407de5f1fe4a125dd04524e2331154a1ad2 /v
parent11e43745d141be4bd17e6762d1ad771ade0422a8 (diff)
downloadenv-master.zip
env-master.tar.gz
env-master.tar.bz2
entry.S: illegal addend for R_RISCV_GOT_HI20 (#51)HEADmaster
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.S6
1 files changed, 4 insertions, 2 deletions
diff --git a/v/entry.S b/v/entry.S
index 13d46a3..e2b12c5 100644
--- a/v/entry.S
+++ b/v/entry.S
@@ -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