Skip to content

Commit 69a3ed2

Browse files
laurenmurphyx64fabiobaltieri
authored andcommitted
llext: replace stripping script with call to zephyr sdk strip
Replace custom stripping script with a call to Zephyr SDK strip. Signed-off-by: Lauren Murphy <[email protected]>
1 parent c792d78 commit 69a3ed2

File tree

3 files changed

+12
-236
lines changed

3 files changed

+12
-236
lines changed

cmake/bintools/arcmwdt/target.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ function(zephyr_sdk_target_cmake)
2828
# temporarily had to use GNU objcopy instead
2929
find_program(CMAKE_OBJCOPY ${CROSS_COMPILE}objcopy PATHS ${ZEPHYR_SDK_INSTALL_DIR} NO_DEFAULT_PATH)
3030
message(STATUS "Found GNU objcopy helper for MWDT: ${CMAKE_OBJCOPY} (Zephyr SDK ${SDK_VERSION})")
31+
# Needed for LLEXT
32+
find_program(CMAKE_GNU_STRIP ${CROSS_COMPILE}strip PATHS ${ZEPHYR_SDK_INSTALL_DIR} NO_DEFAULT_PATH)
33+
message(STATUS "Found GNU strip helper for MWDT: ${CMAKE_GNU_STRIP} (Zephyr SDK ${SDK_VERSION})")
3134
endfunction()
3235

3336
zephyr_sdk_target_cmake()

cmake/modules/extensions.cmake

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5966,22 +5966,23 @@ function(add_llext_target target_name)
59665966
endif()
59675967

59685968
# 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.
59725972
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}
59775977
)
59785978
else()
5979-
set(mwdt_strip_arcextmap_shstrtab_cmd ${CMAKE_COMMAND} -E true)
5979+
set(gnu_strip_for_mwdt_cmd ${CMAKE_COMMAND} -E true)
59805980
endif()
59815981

59825982
# Remove sections that are unused by the llext loader
59835983
add_custom_command(
59845984
OUTPUT ${llext_pkg_output}
5985+
COMMAND ${gnu_strip_for_mwdt_cmd}
59855986
COMMAND $<TARGET_PROPERTY:bintools,elfconvert_command>
59865987
$<TARGET_PROPERTY:bintools,elfconvert_flag>
59875988
$<TARGET_PROPERTY:bintools,elfconvert_flag_strip_unneeded>
@@ -5990,7 +5991,6 @@ function(add_llext_target target_name)
59905991
$<TARGET_PROPERTY:bintools,elfconvert_flag_infile>${llext_pkg_input}
59915992
$<TARGET_PROPERTY:bintools,elfconvert_flag_outfile>${llext_pkg_output}
59925993
$<TARGET_PROPERTY:bintools,elfconvert_flag_final>
5993-
COMMAND ${mwdt_strip_arcextmap_shstrtab_cmd}
59945994
COMMAND ${slid_inject_cmd}
59955995
DEPENDS ${llext_pkg_input}
59965996
COMMAND_EXPAND_LISTS

scripts/build/llext_mwdt_strip_arcextmap.py

Lines changed: 0 additions & 227 deletions
This file was deleted.

0 commit comments

Comments
 (0)