Skip to content

Commit a95743b

Browse files
fossddakpm00
authored andcommitted
kallsyms: fix build without execinfo
Some libc's like musl libc don't provide execinfo.h since it's not part of POSIX. In order to fix compilation on musl, only include execinfo.h if available (HAVE_BACKTRACE_SUPPORT) This was discovered with c104c16 ("Kunit to check the longest symbol length") which starts to include linux/kallsyms.h with Alpine Linux' configs. Link: https://lkml.kernel.org/r/20250622014608.448718-1-fossdd@pwned.life Fixes: c104c16 ("Kunit to check the longest symbol length") Signed-off-by: Achill Gilgenast <fossdd@pwned.life> Cc: Luis Henriques <luis@igalia.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent d7b8f8e commit a95743b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

tools/include/linux/kallsyms.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ static inline const char *kallsyms_lookup(unsigned long addr,
1818
return NULL;
1919
}
2020

21+
#ifdef HAVE_BACKTRACE_SUPPORT
2122
#include <execinfo.h>
2223
#include <stdlib.h>
2324
static inline void print_ip_sym(const char *loglvl, unsigned long ip)
@@ -30,5 +31,8 @@ static inline void print_ip_sym(const char *loglvl, unsigned long ip)
3031

3132
free(name);
3233
}
34+
#else
35+
static inline void print_ip_sym(const char *loglvl, unsigned long ip) {}
36+
#endif
3337

3438
#endif

0 commit comments

Comments
 (0)