From: James Clark <james.clark@linaro.org>
To: Florian Fainelli <florian.fainelli@broadcom.com>,
linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Thomas Richter <tmricht@linux.ibm.com>,
Faisal Bukhari <faisalbukhari523@gmail.com>,
Qinxin Xia <xiaqinxin@huawei.com>,
Thomas Falcon <thomas.falcon@intel.com>,
"open list:PERFORMANCE EVENTS SUBSYSTEM"
<linux-perf-users@vger.kernel.org>
Subject: Re: [PATCH] perf parse-events: Include errno.h before kernel headers
Date: Mon, 26 Oct 2026 18:25:19 +0000 [thread overview]
Message-ID: <440f4ac1-28a3-42a1-a030-7a47b04c0d14@linaro.org> (raw)
In-Reply-To: <20261026174814.3158229-1-florian.fainelli@broadcom.com>
On 26/10/2026 17:48, Florian Fainelli wrote:
> Building perf against uClibc fails in config_term_common():
>
> util/parse-events.c:954:30: error: 'ERANGE' undeclared
>
> The kernel headers included before errno.h pull in asm/errno.h. uClibc's
> bits/errno.h undefines EDOM, EILSEQ and ERANGE before including
> linux/errno.h, but the kernel header include guards prevent these macros
> from being defined again.
>
> Include errno.h before the kernel headers so ERANGE remains defined.
>
> Fixes: 6b9c0261b3fb ("perf record: Add ratio-to-prev term")
> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
> ---
> tools/perf/util/parse-events.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index cc7ad331a49f..efb46ba9ba22 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -1,10 +1,10 @@
> // SPDX-License-Identifier: GPL-2.0
> +#include <errno.h>
> #include <linux/hw_breakpoint.h>
> #include <linux/err.h>
> #include <linux/list_sort.h>
> #include <linux/zalloc.h>
> #include <dirent.h>
> -#include <errno.h>
> #include <sys/ioctl.h>
> #include <sys/param.h>
> #include "cpumap.h"
This seems like a bug in uClibc, if it undefs something but then
includes a header to re-define it that it expects hasn't already been
included. But I suppose even if you fixed it we'd still need some kind
of workaround for older versions.
There's another workaround that is slightly less fragile and doesn't
have to be applied every time linux/err.h is included in this order. If
you change the asm/errno.h include in tools/include/linux/err.h to
errno.h then the libc one will always be processed first. It probably
makes sense for the userspace copy of the header to use a libc errno anyway.
But maybe it's just as hacky as this fix.
Either way:
Reviewed-by: James Clark <james.clark@linaro.org>
next prev parent reply other threads:[~2026-10-26 18:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 17:48 Florian Fainelli
2026-10-26 18:25 ` James Clark [this message]
2026-10-27 20:39 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=440f4ac1-28a3-42a1-a030-7a47b04c0d14@linaro.org \
--to=james.clark@linaro.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=faisalbukhari523@gmail.com \
--cc=florian.fainelli@broadcom.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=thomas.falcon@intel.com \
--cc=tmricht@linux.ibm.com \
--cc=xiaqinxin@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®