From dc24583858b68c1119d99e03c410db53a8b04335 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 16 Jun 2025 10:14:05 +0200 Subject: [PATCH] net: sockets_offload: Fix build error with NO_OPTIMIZATIONS When CONFIG_NO_OPTIMIZATIONS the compiler will not inline socket_offload_dns_is_enabled(), which means calls to socket_offload* remain, and the linker will fail with in function `zsock_getaddrinfo': undefined reference to `socket_offload_getaddrinfo' in function `zsock_freeaddrinfo': undefined reference to `socket_offload_freeaddrinfo' Instead of relaying on that function being inlined and the if'ed code being removed, let's just use the preprocessor. Signed-off-by: Alberto Escolar Piedras --- include/zephyr/net/socket_offload.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/zephyr/net/socket_offload.h b/include/zephyr/net/socket_offload.h index 4dcf27250b4..ad86de887f3 100644 --- a/include/zephyr/net/socket_offload.h +++ b/include/zephyr/net/socket_offload.h @@ -67,10 +67,7 @@ void socket_offload_dns_enable(bool enable); #if defined(CONFIG_NET_SOCKETS_OFFLOAD) bool socket_offload_dns_is_enabled(void); #else -static inline bool socket_offload_dns_is_enabled(void) -{ - return false; -} +#define socket_offload_dns_is_enabled() false #endif /* defined(CONFIG_NET_SOCKETS_OFFLOAD) */