Move ctors function pointers to .data section, and add .init_array, to fix compilation on Linux

This commit is contained in:
asava 2020-04-26 19:01:14 +03:00
parent af28b47c72
commit b6e39e1a32

View File

@ -45,18 +45,15 @@ SECTIONS {
.data ALIGN(ALIGNOF(.text)) : ALIGN(CONSTANT(COMMONPAGESIZE)) {
*(.data .data.* .gnu.linkonce.d.*)
*(.bss .bss.*)
__beginning_of_section_ctors = .; /* create symbol for start of section */
KEEP(*(.ctors .init_array)) /* .ctors is used on macOS, .init_array on Linux */
__end_of_section_ctors = .; /* create symbol for end of section */
}
.eh_frame ALIGN(CONSTANT(COMMONPAGESIZE)) : {
KEEP (*(.eh_frame))
}
.ctorss ALIGN(CONSTANT(COMMONPAGESIZE)) : {
__beginning_of_section_ctors = .; /* create symbol for start of section */
KEEP (*(.ctors))
__end_of_section_ctors = .; /* create symbol for end of section */
}
.rela (INFO) : {
*(.rela .rela.*)
}