cmake: add_llext_target: use toolchain-specific partial linking option

The partial linking option depends on the linker used in the build
process, and this flag is already defined by the Zephyr toolchains.
Use the $<TARGET_PROPERTY:linker,partial_linking> generator expression
to retrieve it instead of hardcoding the value for the GNU linker.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This commit is contained in:
Luca Burelli 2024-04-11 09:05:20 +02:00 committed by Alberto Escolar
parent 5d2670ac1f
commit 14509a8d7b

View file

@ -5328,7 +5328,8 @@ function(add_llext_target target_name)
# output a relocatable file. The output file suffix is changed so
# the result looks like the object file it actually is.
add_executable(${llext_lib_target} EXCLUDE_FROM_ALL ${source_files})
target_link_options(${llext_lib_target} PRIVATE -r)
target_link_options(${llext_lib_target} PRIVATE
$<TARGET_PROPERTY:linker,partial_linking>)
set_target_properties(${llext_lib_target} PROPERTIES
SUFFIX ${CMAKE_C_OUTPUT_EXTENSION})
set(llext_lib_output $<TARGET_FILE:${llext_lib_target}>)