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/[email protected] Fixes: c104c16 ("Kunit to check the longest symbol length") Signed-off-by: Achill Gilgenast <[email protected]> Cc: Luis Henriques <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent d7b8f8e commit a95743b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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)