summaryrefslogtreecommitdiff
path: root/tools/include
diff options
context:
space:
mode:
authorAchill Gilgenast <fossdd@pwned.life>2025-06-22 04:45:49 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-07-17 19:32:09 +0300
commit7837fb8e97fc5b10461fc95278ff535697f52efc (patch)
tree01ba56ae102a78db8c263ea6202c3ff0a2b568e8 /tools/include
parent8842fa503c2288a6f644c837457798ec6905b5fc (diff)
downloadlinux-7837fb8e97fc5b10461fc95278ff535697f52efc.tar.xz
kallsyms: fix build without execinfo
commit a95743b53031b015e8949e845a9f6fdfb2656347 upstream. 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 c104c16073b7 ("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: c104c16073b7 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/include')
-rw-r--r--tools/include/linux/kallsyms.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/include/linux/kallsyms.h b/tools/include/linux/kallsyms.h
index 5a37ccbec54f..f61a01dd7eb7 100644
--- a/tools/include/linux/kallsyms.h
+++ b/tools/include/linux/kallsyms.h
@@ -18,6 +18,7 @@ static inline const char *kallsyms_lookup(unsigned long addr,
return NULL;
}
+#ifdef HAVE_BACKTRACE_SUPPORT
#include <execinfo.h>
#include <stdlib.h>
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)
free(name);
}
+#else
+static inline void print_ip_sym(const char *loglvl, unsigned long ip) {}
+#endif
#endif