4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-21 00:07:36 +08:00

RISC-V: Initialize the jvt CSR

Set symbol '__jvt_base$' as weak. So if the symbol is not set in the
linker script, the address would be 0. We initialize jvt CSR only if
the address is not 0.

Also use csr number directly instead of using symbolic name to prevent the
backward incompatible issue.

psabi reference:
2d770815dc/riscv-elf.adoc (table-jump-relaxation)
This commit is contained in:
Hau Hsu 2024-01-05 15:06:39 +08:00 committed by Corinna Vinschen
parent 94d871eeac
commit 573458e7fc

View File

@ -26,6 +26,17 @@ _start:
addi gp, gp, %pcrel_lo(1b)
.option pop
/* Initialize jvt CSR (reg addr: 0x0017) */
.weak __jvt_base$
lla a0, __jvt_base$
beqz a0, .Ljvt_init_end
.option push
.option norelax
.option arch, +zicsr
csrw 0x17, a0
.option pop
.Ljvt_init_end:
# Clear the bss segment
la a0, __bss_start
la a2, _end