[PATCH v4 mtd-utils 3/4] configure.ac: Add a check for execinfo and backtrace
Ross Burton
Ross.Burton at arm.com
Wed Feb 26 10:23:24 PST 2025
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.
I’ll send an alternative patch in a moment which uses libmissing.a instead of relying on an external 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