Skip to content

Commit f7e9a60

Browse files
nordic-krchnashif
authored andcommitted
kernel: fatal: Fix NO_OPTIMIZATIONS build
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 <[email protected]> (cherry picked from commit 28b4bab)
1 parent c480aa3 commit f7e9a60

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kernel/fatal.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ void z_fatal_error(unsigned int reason, const struct arch_esf *esf)
110110
}
111111
#endif /* CONFIG_ARCH_HAS_NESTED_EXCEPTION_DETECTION */
112112

113-
LOG_ERR("Current thread: %p (%s)", thread,
114-
thread_name_get(thread));
113+
if (IS_ENABLED(CONFIG_MULTITHREADING)) {
114+
LOG_ERR("Current thread: %p (%s)", thread, thread_name_get(thread));
115+
}
115116

116117
coredump(reason, esf, thread);
117118

0 commit comments

Comments
 (0)