nuttx/boards:add KEEP to *(.init_array .init_array.*)

replace *(.init_array .init_array.*) with KEEP(*(.init_array .init_array.*)).

The KEEP statement within a linker script will instruct the linker to keep the specified section, even if no symbols inside it are referenced. This statement is used within the SECTIONS section of the linker script. This becomes relevant when garbage collection is performed at link time, enabled by passing the --gc-sections switch to the linker. The KEEP statement instructs the linker to use the specified section as a root node when creating a dependency graph, looking for unused sections. Essentially forcing the section to be marked as used.

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
This commit is contained in:
cuiziwei
2023-02-27 14:21:36 +08:00
committed by Xiang Xiao
parent 1dfcdaad84
commit 25eb09c3bb
306 changed files with 306 additions and 307 deletions
@@ -44,7 +44,7 @@ SECTIONS
.init_section : {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
KEEP(*(.init_array .init_array.*))
_einit = ABSOLUTE(.);
} > kflash