llext: remove LOADER_BUILD_ONLY code

The latest commits allow llexts to be built on any architecture, even on
those where llext loading is still unsupported, which is very useful for
testing purposes. This means that the LOADER_BUILD_ONLY logic that was
added for this purpose in 1408d1e5b8 is no longer needed.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This commit is contained in:
Luca Burelli 2024-04-10 17:43:45 +02:00 committed by Alberto Escolar
parent ad8b90ad36
commit 992d14948b
3 changed files with 28 additions and 40 deletions

View file

@ -15,34 +15,32 @@ target_include_directories(app PRIVATE
${ZEPHYR_BASE}/arch/${ARCH}/include
)
if(NOT LOADER_BUILD_ONLY)
set(ext_names hello_world logging relative_jump object syscalls threads_kernel_objects)
set(ext_names hello_world logging relative_jump object syscalls threads_kernel_objects)
if(CONFIG_ARM)
if(NOT CONFIG_CPU_CORTEX_M0 AND NOT CONFIG_CPU_CORTEX_M0PLUS AND NOT CONFIG_CPU_CORTEX_M1)
list(APPEND ext_names movwmovt)
endif()
if(CONFIG_ARM)
if(NOT CONFIG_CPU_CORTEX_M0 AND NOT CONFIG_CPU_CORTEX_M0PLUS AND NOT CONFIG_CPU_CORTEX_M1)
list(APPEND ext_names movwmovt)
endif()
# generate extension targets foreach extension given by 'ext_names'
foreach(ext_name ${ext_names})
set(ext_src ${PROJECT_SOURCE_DIR}/src/${ext_name}_ext.c)
set(ext_bin ${ZEPHYR_BINARY_DIR}/${ext_name}.llext)
set(ext_inc ${ZEPHYR_BINARY_DIR}/include/generated/${ext_name}.inc)
add_llext_target(${ext_name}_ext
OUTPUT ${ext_bin}
SOURCES ${ext_src}
)
generate_inc_file_for_target(app ${ext_bin} ${ext_inc})
endforeach()
# Add a dummy custom processing command to test add_llext_command
get_target_property(proc_in_file hello_world_ext lib_output)
get_target_property(proc_out_file hello_world_ext pkg_input)
add_llext_command(
TARGET hello_world_ext
POST_BUILD
COMMAND echo "dummy patching ${proc_in_file} to create ${proc_out_file}"
COMMAND ${CMAKE_COMMAND} -E copy ${proc_in_file} ${proc_out_file}
)
endif()
# generate extension targets foreach extension given by 'ext_names'
foreach(ext_name ${ext_names})
set(ext_src ${PROJECT_SOURCE_DIR}/src/${ext_name}_ext.c)
set(ext_bin ${ZEPHYR_BINARY_DIR}/${ext_name}.llext)
set(ext_inc ${ZEPHYR_BINARY_DIR}/include/generated/${ext_name}.inc)
add_llext_target(${ext_name}_ext
OUTPUT ${ext_bin}
SOURCES ${ext_src}
)
generate_inc_file_for_target(app ${ext_bin} ${ext_inc})
endforeach()
# Add a dummy custom processing command to test add_llext_command
get_target_property(proc_in_file hello_world_ext lib_output)
get_target_property(proc_out_file hello_world_ext pkg_input)
add_llext_command(
TARGET hello_world_ext
POST_BUILD
COMMAND echo "dummy patching ${proc_in_file} to create ${proc_out_file}"
COMMAND ${CMAKE_COMMAND} -E copy ${proc_in_file} ${proc_out_file}
)

View file

@ -180,7 +180,6 @@ void load_call_unload(struct llext_test *test_case)
llext_unload(&ext);
}
#ifndef LOADER_BUILD_ONLY
/*
* Attempt to load, list, list symbols, call a fn, and unload each
* extension in the test table. This excercises loading, calling into, and
@ -230,7 +229,6 @@ static LLEXT_CONST uint8_t threads_kernel_objects_ext[] __aligned(4) = {
};
LLEXT_LOAD_UNLOAD(threads_kernel_objects, true, threads_objects_perm_setup)
#endif
#endif /* ! LOADER_BUILD_ONLY */
/*

View file

@ -8,22 +8,14 @@ common:
- qemu_cortex_r5 # unsupported relocations
tests:
# add_llext_target() supports a fairly limited number of
# CONFIG_urations. For instance, invoking add_llext_target()
# currently blocks us from compiling subsys/llext/*.c in 64bits mode;
# CMake aborts before even invoking the compiler.
#
# While there is in practice no value in compiling subsys/llext/*.c
# without actually running it to load some extension, let's keep it in
# good shape and ready to be used when add_llext_target()
# limitations get lifted in the future.
# good shape and ready to be used by additional architectures in the
# future.
llext.simple.loader_build:
build_only: true
# How to override the above and allow ANY arch?
arch_allow: arm arm64 x86 x86_64 xtensa posix
extra_args:
- LOADER_BUILD_ONLY=1
- EXTRA_CFLAGS=-DLOADER_BUILD_ONLY=1
llext.simple.readonly:
arch_exclude: xtensa # for now