Skip to content

Commit

Permalink
kernel: fatal: Fix NO_OPTIMIZATIONS build
Browse files Browse the repository at this point in the history
When logging is on and optimization and multithreading is off then
build fails to link because unoptimized compiler/linker seems to not
look beyond the function and it fails trying to link k_thread_name_get.
Reworking the code to make it known to the compiler without optimization
that k_thread_name_get is not needed and not logging current thread
name in that case.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
(cherry picked from commit 28b4bab)
  • Loading branch information
nordic-krch authored and nashif committed Nov 11, 2024
1 parent c480aa3 commit f7e9a60
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kernel/fatal.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ void z_fatal_error(unsigned int reason, const struct arch_esf *esf)
}
#endif /* CONFIG_ARCH_HAS_NESTED_EXCEPTION_DETECTION */

LOG_ERR("Current thread: %p (%s)", thread,
thread_name_get(thread));
if (IS_ENABLED(CONFIG_MULTITHREADING)) {
LOG_ERR("Current thread: %p (%s)", thread, thread_name_get(thread));
}

coredump(reason, esf, thread);

Expand Down

0 comments on commit f7e9a60

Please sign in to comment.