rv-virt: Add .init_section to linker script

Provide _sinit/_einit to make it possible to enable
libcxx on rv-virt platform.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
Huang Qi 2024-02-27 17:01:08 +08:00 committed by Xiang Xiao
parent b413a1f4f7
commit fdaacb9408
3 changed files with 24 additions and 24 deletions

View File

@ -65,6 +65,14 @@ SECTIONS
_etext = . ;
}
.init_section :
{
_sinit = ABSOLUTE(.);
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
KEEP(*(.init_array .ctors))
_einit = ABSOLUTE(.);
}
.rodata :
{
_srodata = . ;

View File

@ -65,6 +65,14 @@ SECTIONS
_etext = . ;
}
.init_section :
{
_sinit = ABSOLUTE(.);
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
KEEP(*(.init_array .ctors))
_einit = ABSOLUTE(.);
}
.rodata :
{
_srodata = . ;

View File

@ -43,6 +43,14 @@ SECTIONS
_etext = . ;
}
.init_section :
{
_sinit = ABSOLUTE(.);
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
KEEP(*(.init_array .ctors))
_einit = ABSOLUTE(.);
}
.rodata :
{
_srodata = . ;
@ -78,30 +86,6 @@ SECTIONS
_edata = . ;
}
/* C++ support. For each global and static local C++ object,
* GCC creates a small subroutine to construct the object. Pointers
* to these routines (not the routines themselves) are stored as
* simple, linear arrays in the .ctors section of the object file.
* Similarly, pointers to global/static destructor routines are
* stored in .dtors.
*/
.ctors :
{
_sctors = . ;
*(.ctors) /* Old ABI: Unallocated */
*(.init_array) /* New ABI: Allocated */
_edtors = . ;
}
.dtors :
{
_sdtors = . ;
*(.dtors) /* Old ABI: Unallocated */
*(.fini_array) /* New ABI: Allocated */
_edtors = . ;
}
.bss :
{
_sbss = . ;