@@ -5966,22 +5966,23 @@ function(add_llext_target target_name)
5966
5966
endif ()
5967
5967
5968
5968
# When using the arcmwdt toolchain, the compiler may emit hundreds of
5969
- # .arcextmap.* sections that bloat the shstrtab. Even when the strip command
5970
- # is used to remove the sections, their names remain in the shstrtab.
5971
- # We must remove them ourselves .
5969
+ # .arcextmap.* sections that bloat the shstrtab. stripac removes
5970
+ # these sections, but it does not remove their names from the shstrtab.
5971
+ # Use GNU strip to remove these sections beforehand .
5972
5972
if (${ZEPHYR_TOOLCHAIN_VARIANT} STREQUAL "arcmwdt" )
5973
- set (mwdt_strip_arcextmap_shstrtab_cmd
5974
- ${PYTHON_EXECUTABLE }
5975
- ${ZEPHYR_BASE} /scripts/build/llext_mwdt_strip_arcextmap.py
5976
- ${llext_pkg_output }
5973
+ set (gnu_strip_for_mwdt_cmd
5974
+ ${CMAKE_GNU_STRIP }
5975
+ --remove-section=.arcextmap* --strip-unneeded
5976
+ ${llext_pkg_input }
5977
5977
)
5978
5978
else ()
5979
- set (mwdt_strip_arcextmap_shstrtab_cmd ${CMAKE_COMMAND} -E true )
5979
+ set (gnu_strip_for_mwdt_cmd ${CMAKE_COMMAND} -E true )
5980
5980
endif ()
5981
5981
5982
5982
# Remove sections that are unused by the llext loader
5983
5983
add_custom_command (
5984
5984
OUTPUT ${llext_pkg_output}
5985
+ COMMAND ${gnu_strip_for_mwdt_cmd}
5985
5986
COMMAND $< TARGET_PROPERTY:bintools,elfconvert_command>
5986
5987
$< TARGET_PROPERTY:bintools,elfconvert_flag>
5987
5988
$< TARGET_PROPERTY:bintools,elfconvert_flag_strip_unneeded>
@@ -5990,7 +5991,6 @@ function(add_llext_target target_name)
5990
5991
$< TARGET_PROPERTY:bintools,elfconvert_flag_infile> ${llext_pkg_input}
5991
5992
$< TARGET_PROPERTY:bintools,elfconvert_flag_outfile> ${llext_pkg_output}
5992
5993
$< TARGET_PROPERTY:bintools,elfconvert_flag_final>
5993
- COMMAND ${mwdt_strip_arcextmap_shstrtab_cmd}
5994
5994
COMMAND ${slid_inject_cmd}
5995
5995
DEPENDS ${llext_pkg_input}
5996
5996
COMMAND_EXPAND_LISTS
0 commit comments