native_simulator: Be sure the symbol_to_keep section is kept
The native simulator final link can garbage collect unused symbols. So let's ensure the symbol to keep ones are indeed kept even if not used. Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
parent
7d65c55a50
commit
fa7ab41c1b
2 changed files with 25 additions and 0 deletions
|
@ -4,6 +4,9 @@
|
|||
set(zephyr_build_path ${CMAKE_BINARY_DIR}/zephyr)
|
||||
get_property(CCACHE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
|
||||
|
||||
target_link_options(native_simulator INTERFACE
|
||||
"-T ${ZEPHYR_BASE}/boards/posix/common/natsim_linker_script.ld")
|
||||
|
||||
set(nsi_config_content
|
||||
${nsi_config_content}
|
||||
"NSI_BUILD_OPTIONS:=$<JOIN:$<TARGET_PROPERTY:native_simulator,INTERFACE_COMPILE_OPTIONS>,\ >"
|
||||
|
|
22
boards/posix/common/natsim_linker_script.ld
Normal file
22
boards/posix/common/natsim_linker_script.ld
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Extra linker command/script file for the native simulator runner
|
||||
*/
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
symbol_to_keep :
|
||||
{
|
||||
KEEP(*(symbol_to_keep*));
|
||||
}
|
||||
} INSERT AFTER .data;
|
||||
|
||||
/*
|
||||
* Note this script augments the default native simulator linker script
|
||||
*/
|
Loading…
Add table
Add a link
Reference in a new issue