Added init_array support for vexriscv to allow static C++ ctors and C __attribute__((constructor, priority)) in gcc

This commit is contained in:
Dave Berkeley 2022-04-17 11:22:19 +01:00
parent 3dbe349dd9
commit 35a8c8f9f6
2 changed files with 10 additions and 0 deletions

View File

@ -84,6 +84,7 @@ bss_done:
li a0, 0x880 //880 enable timer + external interrupt sources (until mstatus.MIE is set, they will never trigger an interrupt)
csrw mie,a0
call __libc_init_array
call main
infinit_loop:
j infinit_loop

View File

@ -51,6 +51,15 @@ SECTIONS
PROVIDE_HIDDEN (__bios_init_end = .);
} > rom
.init_array :
{
. = ALIGN(4);
__init_array_start = .;
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array))
__init_array_end = .;
} > rom
.data :
{
. = ALIGN(8);