riscv64 lds: fix ctors/dtors

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
This commit is contained in:
Callum Farmer 2023-05-20 19:13:14 +01:00 committed by Nigel Croxon
parent a68997b11e
commit 6c142a6df4

View File

@ -31,6 +31,34 @@ SECTIONS {
*(.got.plt) *(.got.plt)
*(.got) *(.got)
/*
* Note that these aren't the using the GNU "CONSTRUCTOR" output section
* command, so they don't start with a size. Because of p2align and the
* end/END definitions, and the fact that they're mergeable, they can also
* have NULLs which aren't guaranteed to be at the end.
*/
. = ALIGN(16);
__init_array_start = .;
*(SORT(.init_array.*))
*(.init_array)
__init_array_end = .;
. = ALIGN(16);
__CTOR_LIST__ = .;
*(SORT(.ctors.*))
*(.ctors)
__CTOR_END__ = .;
. = ALIGN(16);
__DTOR_LIST__ = .;
*(SORT(.dtors.*))
*(.dtors)
__DTOR_END__ = .;
. = ALIGN(16);
__fini_array_start = .;
*(SORT(.fini_array.*))
*(.fini_array)
__fini_array_end = .;
/* the EFI loader doesn't seem to like a .bss section, so we stick /* the EFI loader doesn't seem to like a .bss section, so we stick
it all into .data: */ it all into .data: */
. = ALIGN(16); . = ALIGN(16);
@ -52,10 +80,10 @@ SECTIONS {
*(.rela.got) *(.rela.got)
*(.rela.dyn) *(.rela.dyn)
*(.rela.stab) *(.rela.stab)
*(.rela.init_array) *(.rela.init_array*)
*(.rela.fini_array) *(.rela.fini_array*)
*(.rela.ctors) *(.rela.ctors*)
*(.rela.dtors) *(.rela.dtors*)
} }
. = ALIGN(4096); . = ALIGN(4096);
.rela.plt : { *(.rela.plt) } .rela.plt : { *(.rela.plt) }