From 30150d91b5d98c3747ccca20836da15cf6853e45 Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Wed, 18 Sep 2024 22:08:25 +0300 Subject: [PATCH 1/2] zephyr: wrapper: remove dead smex code As of commit 0868b1f71e7e ("zephyr: Remove legacy logging artifacts") smex is no longer included in Zephyr builds. As such, there's no need to include a ".static_log_entries" ELF section in the Zephyr ELFs. This was originally added via commit ca6e3c3bff38 ("zephyr: add smex_placeholder()"). Signed-off-by: Laurentiu Mihalcea --- zephyr/wrapper.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index e74b1abd466c..db5f9277fea5 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -167,29 +167,8 @@ unsigned int _xtos_ints_off(unsigned int mask) return 0; } -/* Zephyr redefines log_message() and mtrace_printf() which leaves - * totally empty the .static_log_entries ELF sections for the - * sof-logger. This makes smex fail. Define at least one such section to - * fix the build when sof-logger is not used. - */ -static inline const void *smex_placeholder_f(void) -{ - _DECLARE_LOG_ENTRY(LOG_LEVEL_DEBUG, - "placeholder so .static_log.X are not all empty", - _TRACE_INV_CLASS, 0); - - return &log_entry; -} - -/* Need to actually use the function and export something otherwise the - * compiler optimizes everything away. - */ -const void *_smex_placeholder; - int task_main_start(struct sof *sof) { - _smex_placeholder = smex_placeholder_f(); - /* init default audio components */ sys_comp_init(sof); From 22bc520a8ee18aeeca057aa3a7b9e1f828a69120 Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Wed, 18 Sep 2024 22:16:18 +0300 Subject: [PATCH 2/2] include: sof: trace: don't place trace ctx in special section If trace is disabled (i.e: CONFIG_TRACE=n) there's no need to place the trace context inside a special linker section (i.e: .trace_ctx). This spares platforms that don't use trace from having to include the .trace_ctx section inside their linker scripts. Signed-off-by: Laurentiu Mihalcea --- src/include/sof/trace/trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/sof/trace/trace.h b/src/include/sof/trace/trace.h index d1beb48d81e2..9da28fab36a3 100644 --- a/src/include/sof/trace/trace.h +++ b/src/include/sof/trace/trace.h @@ -393,7 +393,7 @@ struct tr_ctx { uint32_t level; /**< Default log level */ }; -#if defined(UNIT_TEST) +#if defined(UNIT_TEST) || !defined(CONFIG_TRACE) #define TRACE_CONTEXT_SECTION #else #define TRACE_CONTEXT_SECTION __section(".trace_ctx")