diff --git a/boards/x86/qemu/qemu-i486/scripts/qemu.ld b/boards/x86/qemu/qemu-i486/scripts/qemu.ld index 290bd86b94e1e..711b858f8cd57 100644 --- a/boards/x86/qemu/qemu-i486/scripts/qemu.ld +++ b/boards/x86/qemu/qemu-i486/scripts/qemu.ld @@ -31,7 +31,15 @@ SECTIONS _etext = ABSOLUTE(.); } - .text ALIGN (0x1000) : { + .init_section ALIGN(0x1000) : + { + _sinit = ABSOLUTE(.); + KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) + KEEP(*(.init_array EXCLUDE_FILE(*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o) .ctors)) + _einit = ABSOLUTE(.); + } + + .rodata ALIGN (0x1000) : { _srodata = ABSOLUTE(.); *(.rodata .rodata.*) *(.fixup) diff --git a/boards/x86_64/intel64/qemu-intel64/scripts/qemu.ld b/boards/x86_64/intel64/qemu-intel64/scripts/qemu.ld index 85351ae7f720e..61181c0d5dde0 100644 --- a/boards/x86_64/intel64/qemu-intel64/scripts/qemu.ld +++ b/boards/x86_64/intel64/qemu-intel64/scripts/qemu.ld @@ -77,6 +77,14 @@ SECTIONS _etext = ABSOLUTE(.); } + .init_section ALIGN(0x1000) : + { + _sinit = ABSOLUTE(.); + KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) + KEEP(*(.init_array EXCLUDE_FILE(*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o) .ctors)) + . = ALIGN(4096); + _einit = ABSOLUTE(.); + } .rodata ALIGN(0x1000) : {