From ff758345eb7a66165264ce454f3fb48d1163026a Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Fri, 17 Oct 2025 16:13:14 -0300 Subject: [PATCH] elf: Suppress unused function clang warning for __ifunc_resolver The __ifunc_resolver macro expands to: extern __typeof (__redirect_name) name __attribute__ ((ifunc ("iname_ifunc"))); static __typeof (__redirect_name) *name_ifunc (void) { [...] }; And although NAME_IFUNC is and alias for NAME, clang still emits an 'unused function 'name_ifunc' [-Werror,-Wunused-function]' warning. The static is used to avoid name pollution on static linkage. Reviewed-by: Sam James --- include/libc-symbols.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/libc-symbols.h b/include/libc-symbols.h index b407fa8f7d..2f9453e0d7 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -86,6 +86,7 @@ /* Obtain the definition of symbol_version_reference. */ #include +#include /* When PIC is defined and SHARED isn't defined, we are building PIE by default. */ @@ -671,7 +672,10 @@ for linking") # define __ifunc_args(type_name, name, expr, init, ...) \ extern __typeof (type_name) name __attribute__ \ ((ifunc (#name "_ifunc"))); \ - __ifunc_resolver (type_name, name, expr, init, static, __VA_ARGS__) + DIAG_PUSH_NEEDS_COMMENT_CLANG; \ + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wunused-function"); \ + __ifunc_resolver (type_name, name, expr, init, static, __VA_ARGS__); \ + DIAG_POP_NEEDS_COMMENT_CLANG; # define __ifunc_args_hidden(type_name, name, expr, init, ...) \ __ifunc_args (type_name, name, expr, init, __VA_ARGS__) -- 2.47.3