From 68e25dcee6f95c9a238d807aa011f29d5fb46b74 Mon Sep 17 00:00:00 2001 From: cuiziwei Date: Mon, 1 Apr 2024 19:52:34 +0800 Subject: [PATCH] nuttx/x86_64:Add _sinit and _einit initialization. Signed-off-by: cuiziwei --- boards/x86/qemu/qemu-i486/scripts/qemu.ld | 10 +++++++++- boards/x86_64/intel64/qemu-intel64/scripts/qemu.ld | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/boards/x86/qemu/qemu-i486/scripts/qemu.ld b/boards/x86/qemu/qemu-i486/scripts/qemu.ld index 290bd86b94..711b858f8c 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 85351ae7f7..61181c0d5d 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) : {