From: Ian Rogers <irogers@google.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: sashiko-bot@kernel.org
Subject: [PATCH v1 05/11] perf dso: missing POSIX headers string.h and limits.h
Date: Wed, 16 Sep 2026 21:53:20 -0700 [thread overview]
Message-ID: <20260917045326.63601-5-irogers@google.com> (raw)
In-Reply-To: <20260917045326.63601-1-irogers@google.com>
Sashiko reported:
When building the perf tool on a system using the musl C library,
compilation of tools/perf/util/dso.c fails because it utilizes
standard string operations and the PATH_MAX macro without explicitly
including <string.h> and <limits.h>.
Functions like dso__read_binary_type_filename() allocate arrays
sized by PATH_MAX and perform string manipulations using strncpy(),
strlen(), and strdup(). While glibc implicitly exposes these POSIX
definitions via other included standard library headers such as
<stdlib.h>, musl enforces strict header dependency
boundaries. Consequently, these macros and functions remain
undeclared during preprocessing, resulting in a fatal compiler
error.
Add the header files and use git clang-format to sort.
Reported-by: sashiko-bot@kernel.org
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/util/dso.c | 47 +++++++++++++++++++++++++------------------
1 file changed, 27 insertions(+), 20 deletions(-)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 42bfe30a3b51..592fb971ffaa 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -1,38 +1,45 @@
// SPDX-License-Identifier: GPL-2.0
+#include "dso.h"
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+
#include <asm/bug.h>
+#include <fcntl.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/zalloc.h>
-#include <sys/time.h>
#include <sys/resource.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#ifdef HAVE_LIBBPF_SUPPORT
-#include <bpf/libbpf.h>
-#include "bpf-event.h"
-#include "bpf-utils.h"
-#endif
+
+#include "annotate-data.h"
+#include "auxtrace.h"
#include "compress.h"
+#include "debug.h"
+#include "dsos.h"
#include "env.h"
+#include "libdw.h"
+#include "machine.h"
+#include "map.h"
#include "namespaces.h"
#include "path.h"
-#include "map.h"
-#include "symbol.h"
#include "srcline.h"
-#include "dso.h"
-#include "dsos.h"
-#include "machine.h"
-#include "auxtrace.h"
-#include "util.h" /* O_CLOEXEC for older systems */
-#include "debug.h"
#include "string2.h"
+#include "symbol.h"
+#include "util.h" /* O_CLOEXEC for older systems */
#include "vdso.h"
-#include "annotate-data.h"
-#include "libdw.h"
+
+#ifdef HAVE_LIBBPF_SUPPORT
+#include <bpf/libbpf.h>
+
+#include "bpf-event.h"
+#include "bpf-utils.h"
+#endif
static const char * const debuglink_paths[] = {
"%.0s%s",
--
2.55.0.1082.g2b9226bbc0-goog
next prev parent reply other threads:[~2026-09-17 4:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 4:53 [PATCH v1 01/11] perf aslr: Add missing includes and sort headers Ian Rogers
2026-09-17 4:53 ` [PATCH v1 02/11] perf bench messaging: " Ian Rogers
2026-09-17 4:53 ` [PATCH v1 03/11] perf unwind-libdw: missing <stdlib.h> in libdw_set_initial_registers() Ian Rogers
2026-09-17 4:53 ` [PATCH v1 04/11] perf llvm: missing explicit POSIX headers in symbol__disassemble_llvm() Ian Rogers
2026-09-17 4:53 ` Ian Rogers [this message]
2026-09-17 4:53 ` [PATCH v1 06/11] perf test: missing stdio.h and signal.h inclusions in cmd_test() Ian Rogers
2026-09-17 4:53 ` [PATCH v1 07/11] perf ui annotate-data: missing explicit inclusion of stdlib.h and stdio.h Ian Rogers
2026-09-17 4:53 ` [PATCH v1 08/11] perf annotate-data: missing <string.h> inclusion for libc string functions Ian Rogers
2026-09-17 4:53 ` [PATCH v1 09/11] perf mem: missing stdio.h and limits.h in mem-events.c Ian Rogers
2026-09-17 4:53 ` [PATCH v1 10/11] perf config: undeclared PATH_MAX due to missing <limits.h> inclusion Ian Rogers
2026-09-17 4:53 ` [PATCH v1 11/11] perf mem: missing standard POSIX headers in builtin-mem.c Ian Rogers
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=20260917045326.63601-5-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=sashiko-bot@kernel.org \
/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®