From 346bc3f0d253504097c9ae93bc5340e867c5cd95 Mon Sep 17 00:00:00 2001 From: Sairamreddy Bojja Date: Thu, 25 Sep 2025 23:08:16 +0530 Subject: [PATCH] posal: Resolve build issues and enable GNU extensions Add _GNU_SOURCE macro to enable GNU-specific APIs like pthread_setname_np and dlinfo. Correct type mismatch by casting to timer_t* instead of posal_timer_info_t*. These changes address build errors and warnings encountered during compilation with GCC 14.2, ensuring compatibility and cleaner builds across platforms. Signed-off-by: Sairamreddy Bojja --- fwk/platform/posal/src/linux/posal_data_log.c | 2 +- fwk/platform/posal/src/linux/posal_linux_thread.c | 1 + fwk/platform/posal/src/linux/posal_rtld.c | 1 + fwk/platform/posal/src/linux/posal_timer.c | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fwk/platform/posal/src/linux/posal_data_log.c b/fwk/platform/posal/src/linux/posal_data_log.c index 92d3bba..ab0f8d5 100644 --- a/fwk/platform/posal/src/linux/posal_data_log.c +++ b/fwk/platform/posal/src/linux/posal_data_log.c @@ -491,7 +491,7 @@ static void *posal_data_alloc_log_buffer_internal(uint32_t buf_si * Returns NULL if log code is disabled on the GUI */ - log_pkt_ptr = log_alloc(log_code, log_pkt_size); + log_pkt_ptr = (void *)(uintptr_t) log_alloc(log_code, log_pkt_size); if (NULL == log_pkt_ptr) { AR_MSG(DBG_ERROR_PRIO, "posal_data_alloc(): Invalid log ptr allocation log_pkt_ptr = %p", log_pkt_ptr); diff --git a/fwk/platform/posal/src/linux/posal_linux_thread.c b/fwk/platform/posal/src/linux/posal_linux_thread.c index 612479a..d1d2d67 100644 --- a/fwk/platform/posal/src/linux/posal_linux_thread.c +++ b/fwk/platform/posal/src/linux/posal_linux_thread.c @@ -11,6 +11,7 @@ /* ---------------------------------------------------------------------------- * Include Files * ------------------------------------------------------------------------- */ +#define _GNU_SOURCE #include "posal.h" #include "posal_thread_profiling.h" #include "posal_internal.h" diff --git a/fwk/platform/posal/src/linux/posal_rtld.c b/fwk/platform/posal/src/linux/posal_rtld.c index 7822ba7..ca6a0a4 100644 --- a/fwk/platform/posal/src/linux/posal_rtld.c +++ b/fwk/platform/posal/src/linux/posal_rtld.c @@ -11,6 +11,7 @@ /* ======================================================================= INCLUDE FILES FOR MODULE ========================================================================== */ +#define _GNU_SOURCE #include "posal.h" #include "posal_internal.h" #include "posal_rtld.h" diff --git a/fwk/platform/posal/src/linux/posal_timer.c b/fwk/platform/posal/src/linux/posal_timer.c index 6fe324e..2c6e2e0 100644 --- a/fwk/platform/posal/src/linux/posal_timer.c +++ b/fwk/platform/posal/src/linux/posal_timer.c @@ -149,7 +149,7 @@ int32_t posal_timer_create_v2(posal_timer_t * pp_timer, //Allocate timer id timer_t *timerId = NULL; - if (NULL == (timerId = (posal_timer_info_t *)posal_memory_malloc(sizeof(timer_t), heap_id))) + if (NULL == (timerId = (timer_t *)posal_memory_malloc(sizeof(timer_t), heap_id))) { AR_MSG(DBG_ERROR_PRIO, "Memory allocation failure"); posal_memory_free(p_timer);