zephyr/cmake/compiler/gcc/target_xtensa.cmake
Luca Burelli 5b66af8adb llext: build with debug info, strip at packaging time
This patch changes the way extensions are built to allow for debugging
information to be collected. Debug flags are now used when compiling and
linking the extension source code, generating a debuggable ELF file.
The final .llext file is then stripped of unneeded symbols, including
all debugging information, at packaging time.

The debugging flag is still removed from the EDK-exported flags.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-01-27 08:54:44 +01:00

31 lines
544 B
CMake

# SPDX-License-Identifier: Apache-2.0
# Flags not supported by llext linker
# (regexps are supported and match whole word)
set(LLEXT_REMOVE_FLAGS
-ffunction-sections
-fdata-sections
-Os
-mcpu=.*
)
# Flags to be added to llext code compilation
set(LLEXT_APPEND_FLAGS
-nostdlib
-nodefaultlibs
)
if(CONFIG_LLEXT_BUILD_PIC)
set(LLEXT_REMOVE_FLAGS ${LLEXT_REMOVE_FLAGS}
-fno-pic
-fno-pie
)
set(LLEXT_APPEND_FLAGS ${LLEXT_APPEND_FLAGS}
-fPIC
)
else()
set(LLEXT_APPEND_FLAGS ${LLEXT_APPEND_FLAGS}
-ffreestanding
)
endif()