From 992d14948bdc91128ddbfb41256c0e015a6fa2dc Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Wed, 10 Apr 2024 17:43:45 +0200 Subject: [PATCH] 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 1408d1e5b8ce is no longer needed. Signed-off-by: Luca Burelli --- tests/subsys/llext/simple/CMakeLists.txt | 54 +++++++++---------- .../llext/simple/src/test_llext_simple.c | 2 - tests/subsys/llext/simple/testcase.yaml | 12 +---- 3 files changed, 28 insertions(+), 40 deletions(-) diff --git a/tests/subsys/llext/simple/CMakeLists.txt b/tests/subsys/llext/simple/CMakeLists.txt index 2bea2e9b7b..92ddab5258 100644 --- a/tests/subsys/llext/simple/CMakeLists.txt +++ b/tests/subsys/llext/simple/CMakeLists.txt @@ -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} +) diff --git a/tests/subsys/llext/simple/src/test_llext_simple.c b/tests/subsys/llext/simple/src/test_llext_simple.c index e45c7fd61b..2833caa2ad 100644 --- a/tests/subsys/llext/simple/src/test_llext_simple.c +++ b/tests/subsys/llext/simple/src/test_llext_simple.c @@ -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 */ /* diff --git a/tests/subsys/llext/simple/testcase.yaml b/tests/subsys/llext/simple/testcase.yaml index 472596e357..961d94faf7 100644 --- a/tests/subsys/llext/simple/testcase.yaml +++ b/tests/subsys/llext/simple/testcase.yaml @@ -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