From a152d20ac5e50f5ddacf9185ef3def50dba9fd68 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 8 May 2019 23:44:15 +0300 Subject: [PATCH] CMakeLists.txt: Link libkernel.a as whole-archive, like everything else There was a report that a non-trivial application (MicroPython with experimental LVGL bindings) errors out at link stage: ld: libmicropython.a(main.o): in function `k_timer_start': zephyr/include/generated/syscalls/kernel.h:55: undefined reference to `z_impl_k_timer_start' ld: libmicropython.a(main.o):(._k_timer.static.lvgl_timer+0xc): undefined reference to `z_timer_expiration_handler' These functions are of course defined and available in libkernel.a. Investigating the link command, turned out that while all other Zephyr constituent libraries are linked with --whole-archive flag, libkernel.a isn't. Changing that fixed the issue above. Given that it is in no way special than any other build process constituent libs (the only difference is that it's always present, while presence of other libs depends on configuration), this appears to be a change which make sense. Signed-off-by: Paul Sokolovsky --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index faf403e7ed84c..88dfa6f280766 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -706,8 +706,8 @@ set(zephyr_lnk -u_ConfigAbsSyms ${LINKERFLAGPREFIX},--whole-archive ${ZEPHYR_LIBS_PROPERTY} - ${LINKERFLAGPREFIX},--no-whole-archive kernel + ${LINKERFLAGPREFIX},--no-whole-archive $ ${LIB_INCLUDE_DIR} -L${PROJECT_BINARY_DIR}