Skip to content

Commit d32edb9

Browse files
tejlmandSebastianBoe
authored andcommitted
nrf_security: symbol rename script now passes settings through script
The symbol rename archive script used a generator expression to pass all objects to the symbol_rename_archive_script.cmake among other arguments. When there are many objects in the library, then the command execution string becomes very long. On Windows, long execution commands are wrapped inside a bat-file. This might look like: ...\post-build.bat 7eb3ae9870a59d55 Resulting in SES-NE to try to execute the post-build.bat including the following SHA as a single command, which fails. This is fixed by generating a CMake file with required arguments to symbol_rename_archive_script.cmake, and the pass this settings file as argument to the script. Fixes: NCSDK-10510 Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent f7522e5 commit d32edb9

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

nrf_security/cmake/extensions.cmake

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -649,15 +649,24 @@ function(nrf_security_target_embed_objects)
649649
${CMAKE_CURRENT_BINARY_DIR}/symbol_rename_${backend_name}.txt
650650
)
651651

652+
set(symbol_rename_include"\
653+
set(CMAKE_OBJCOPY ${CMAKE_OBJCOPY})\n\
654+
set(CMAKE_AR ${CMAKE_AR})\n\
655+
set(OBJECTS $<TARGET_OBJECTS:${target}>)\n\
656+
set(ARCHIVE $<TARGET_FILE:${SEC_LIBS_TARGET}>)\n\
657+
set(RENAME ${CMAKE_CURRENT_BINARY_DIR}/symbol_rename_${backend_name}.txt)\n\
658+
set(OUT_FOLDER ${CMAKE_CURRENT_BINARY_DIR}/${backend_name})\n"
659+
)
660+
661+
file(GENERATE OUTPUT
662+
${CMAKE_CURRENT_BINARY_DIR}/symbol_rename_${target}_include.cmake
663+
CONTENT "${symbol_rename_include}"
664+
)
665+
652666
add_custom_command(TARGET ${SEC_LIBS_TARGET}
653667
POST_BUILD
654668
COMMAND ${CMAKE_COMMAND}
655-
-DCMAKE_OBJCOPY=${CMAKE_OBJCOPY}
656-
-DCMAKE_AR=${CMAKE_AR}
657-
-DOBJECTS="$<TARGET_OBJECTS:${target}>"
658-
-DARCHIVE=$<TARGET_FILE:${SEC_LIBS_TARGET}>
659-
-DRENAME="${CMAKE_CURRENT_BINARY_DIR}/symbol_rename_${backend_name}.txt"
660-
-DOUT_FOLDER=${CMAKE_CURRENT_BINARY_DIR}/${backend_name}
669+
-DINCLUDE=${CMAKE_CURRENT_BINARY_DIR}/symbol_rename_${target}_include.cmake
661670
-P ${NRF_SECURITY_ROOT}/cmake/symbol_rename_archive_script.cmake
662671
)
663672
else()

nrf_security/cmake/symbol_rename_archive_script.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
# Note: The OUTPUT is the same as input in the current version of the script.
1616
# This will change in an upcoming refactoring
1717
#
18+
if(DEFINED INCLUDE)
19+
include(${INCLUDE})
20+
endif()
21+
1822
execute_process(
1923
COMMAND ${CMAKE_COMMAND} -E make_directory ${OUT_FOLDER}
2024
)

0 commit comments

Comments
 (0)