[PATCH v4 mtd-utils 3/4] configure.ac: Add a check for execinfo and backtrace
Zhihao Cheng
chengzhihao1 at huawei.com
Wed Feb 26 22:58:14 PST 2025
在 2025/2/27 4:13, Khem Raj 写道:
> On Wed, Feb 26, 2025 at 10:23 AM Ross Burton <Ross.Burton at arm.com> wrote:
>>
>> On 19 Feb 2025, at 13:02, Fabio Estevam <festevam at gmail.com> wrote:
>>>
>>> musl relies on an external execinfo library to provide backtrace
>>> functionality. If musl cannot link to libexecinfo, the following link
>>> error happens:
>>>
>>> Fix the problem by checking for backtrace support in libc first and if not
>>> found, then check for backtrace support in the external libexecinfo.
>>
>> If this is the right solution, it’s not complete.
>>
>> mtd-utils already checks for the presence of execinfo.h and uses that when creating lib/libmissing.a, which if execinfo.h isn’t present will contain a stub backtrace() implementation that simply returns 0. The test suite already uses this so it can build on systems without musl, but presumably nobody tested mtd-utils on musl after "ubifs-utils: Add implementations for linux kernel printing functions” landed, which added more users of backtrace().
>>
>> I think either mtd-utils should hard-depend on _something_ providing backtrace(), be it the libc or a drop-in library, or it should use backtrace() if present and gracefully fallback otherwise (as it’s a convenience feature). Not both, which is what this patch achieves.
>>
That sounds plausible, that's possibly what commit
3516b8b7558a69dfd("Add libmissing") wanted to do.
>> I’ll send an alternative patch in a moment which uses libmissing.a instead of relying on an external libexecinfo.
>>
>
> I think looking for libexecinfo is perhaps fine, its that when
> backtrace is not found in libc and in libexecinfo, it should still
> work by falling back to stub.
>
Hi, Khem. IMHO,maybe copying 'execinfo.h' into musl is a hack way, then
users could modify mtd-utils(eg. link external libexecinfo) according to
the specific compiler, but that's not a common way for all compilers.
What if the library contains 'backtrace' function is not named as
'libexecinfo'?
>> Note that the rest of the series is good, this is the only change I have comments on.
>>
>> Ross
>> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
> .
>
More information about the linux-mtd
mailing list