Re: [RESEND PATCH v2] kallsyms: fix build without execinfo

From: Achill Gilgenast
Date: Mon Jun 23 2025 - 07:53:34 EST


On Sun Jun 22, 2025 at 8:36 PM CEST, Andrew Morton wrote:
> On Sun, 22 Jun 2025 03:45:49 +0200 Achill Gilgenast <fossdd@xxxxxxxxxx> wrote:
>
>> 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.
>>
>> ...
>>
>> --- 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)
>
> I'm not seeing anything in there which needs execinfo.h. Can we simply
> remove the inclusion?

No, since backtrace_symbols is provided by execinfo.h.