* [PATCH v1 02/11] perf bench messaging: Add missing includes and sort headers
2026-09-17 4:53 [PATCH v1 01/11] perf aslr: Add missing includes and sort headers Ian Rogers
@ 2026-09-17 4:53 ` Ian Rogers
2026-09-17 4:53 ` [PATCH v1 03/11] perf unwind-libdw: missing <stdlib.h> in libdw_set_initial_registers() Ian Rogers
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Ian Rogers @ 2026-09-17 4:53 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, linux-perf-users, linux-kernel
Cc: sashiko-bot
Sashiko reported:
When building the perf tool on systems using musl libc, compilation
of tools/perf/bench/sched-messaging.c fails due to missing
signal-related header declarations.
The POSIX signal API and associated constants (SIGKILL, SIGINT,
SIGTERM) are referenced in sig_handler() and bench_sched_messaging()
but require an explicit inclusion of <signal.h>. While builds on
glibc succeed because the header is implicitly pulled in via other
includes, strict libc environments like musl do not provide this
implicit namespace pollution. This results in undeclared identifier
errors for kill() and signal() during the build process.
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/bench/sched-messaging.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c
index 4fb6657fc826..5bdcc0595367 100644
--- a/tools/perf/bench/sched-messaging.c
+++ b/tools/perf/bench/sched-messaging.c
@@ -14,21 +14,23 @@
#include "bench.h"
/* Test groups of 20 processes spraying to 20 receivers */
-#include <pthread.h>
+#include <errno.h>
+#include <limits.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/wait.h>
-#include <sys/time.h>
-#include <poll.h>
-#include <limits.h>
+
#include <err.h>
#include <linux/list.h>
#include <linux/time64.h>
+#include <poll.h>
+#include <pthread.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
#define DATASIZE 100
--
2.55.0.1082.g2b9226bbc0-goog
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v1 03/11] perf unwind-libdw: missing <stdlib.h> in libdw_set_initial_registers()
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 ` Ian Rogers
2026-09-17 4:53 ` [PATCH v1 04/11] perf llvm: missing explicit POSIX headers in symbol__disassemble_llvm() Ian Rogers
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Ian Rogers @ 2026-09-17 4:53 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, linux-perf-users, linux-kernel
Cc: sashiko-bot
Sashiko reported:
When building the perf tool against strict C standard libraries
(such as musl libc), compilation fails in
tools/perf/util/unwind-libdw.c due to implicit declarations of
memory allocation functions.
The libdw_set_initial_registers() function dynamically allocates an
array of DWARF registers using calloc() and subsequently releases it
with free(). However, the source file lacks an explicit #include
<stdlib.h>. On build environments where standard headers do not
implicitly chain-include <stdlib.h>, these functions remain
undeclared, resulting in fatal implicit function declaration errors
that break the build.
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/unwind-libdw.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c
index ebea101e1001..714ff455f28b 100644
--- a/tools/perf/util/unwind-libdw.c
+++ b/tools/perf/util/unwind-libdw.c
@@ -1,24 +1,29 @@
// SPDX-License-Identifier: GPL-2.0
+#include "unwind-libdw.h"
+
#include <assert.h>
+#include <errno.h>
+#include <inttypes.h>
+#include <stdlib.h>
+
#include <linux/compiler.h>
+#include <linux/types.h>
+#include <linux/zalloc.h>
+
+#include <dwarf-regs.h>
#include <elfutils/libdw.h>
#include <elfutils/libdwfl.h>
-#include <inttypes.h>
-#include <errno.h>
+
+#include "callchain.h"
#include "debug.h"
#include "dso.h"
-#include <dwarf-regs.h>
-#include "unwind.h"
-#include "unwind-libdw.h"
+#include "event.h"
#include "machine.h"
#include "map.h"
+#include "perf_regs.h"
#include "symbol.h"
#include "thread.h"
-#include <linux/types.h>
-#include <linux/zalloc.h>
-#include "event.h"
-#include "perf_regs.h"
-#include "callchain.h"
+#include "unwind.h"
#include "util/env.h"
/*
--
2.55.0.1082.g2b9226bbc0-goog
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v1 04/11] perf llvm: missing explicit POSIX headers in symbol__disassemble_llvm()
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 ` Ian Rogers
2026-09-17 4:53 ` [PATCH v1 05/11] perf dso: missing POSIX headers string.h and limits.h Ian Rogers
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Ian Rogers @ 2026-09-17 4:53 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, linux-perf-users, linux-kernel
Cc: sashiko-bot
Sashiko reported:
When building the perf tool in an environment utilizing a strict C
library such as musl libc, compilation fails because
tools/perf/util/llvm.c omits explicit inclusion of <stdlib.h> and
<inttypes.h>.
The function symbol__disassemble_llvm() directly invokes free() for
memory deallocation and utilizes the PRIx64 macro for formatting
64-bit integers. While glibc often implicitly provides these POSIX
definitions via other includes, relying on transitive inclusion
creates a brittle dependency that violates perf subsystem
portability guidelines. On environments that do not implicitly pull
in these headers, the compiler encounters undeclared identifier and
unknown type name errors for free() and PRIx64, preventing
successful builds of the perf toolchain.
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/llvm.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/llvm.c b/tools/perf/util/llvm.c
index a0deb742a733..95efd089014b 100644
--- a/tools/perf/util/llvm.c
+++ b/tools/perf/util/llvm.c
@@ -1,5 +1,14 @@
// SPDX-License-Identifier: GPL-2.0
#include "llvm.h"
+
+#include <errno.h>
+#include <inttypes.h>
+#include <stdlib.h>
+
+#include <fcntl.h>
+#include <linux/zalloc.h>
+#include <unistd.h>
+
#include "annotate.h"
#include "debug.h"
#include "dso.h"
@@ -7,10 +16,6 @@
#include "namespaces.h"
#include "srcline.h"
#include "symbol.h"
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <linux/zalloc.h>
#ifdef HAVE_LIBLLVM_SUPPORT
#include "llvm-c-helpers.h"
--
2.55.0.1082.g2b9226bbc0-goog
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v1 05/11] perf dso: missing POSIX headers string.h and limits.h
2026-09-17 4:53 [PATCH v1 01/11] perf aslr: Add missing includes and sort headers Ian Rogers
` (2 preceding siblings ...)
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
2026-09-17 4:53 ` [PATCH v1 06/11] perf test: missing stdio.h and signal.h inclusions in cmd_test() Ian Rogers
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Ian Rogers @ 2026-09-17 4:53 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, linux-perf-users, linux-kernel
Cc: sashiko-bot
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
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v1 06/11] perf test: missing stdio.h and signal.h inclusions in cmd_test()
2026-09-17 4:53 [PATCH v1 01/11] perf aslr: Add missing includes and sort headers Ian Rogers
` (3 preceding siblings ...)
2026-09-17 4:53 ` [PATCH v1 05/11] perf dso: missing POSIX headers string.h and limits.h Ian Rogers
@ 2026-09-17 4:53 ` 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
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Ian Rogers @ 2026-09-17 4:53 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, linux-perf-users, linux-kernel
Cc: sashiko-bot
Sashiko reported:
When compiling the perf tool against musl libc, the build fails in
tools/perf/tests/builtin-test.c due to missing explicit inclusions
of <stdio.h> and <signal.h>.
The file relies on standard I/O functions like fdopen() and
fprintf(), as well as signal handling constructs like signal(),
SIGINT, and SIGTERM within __cmd_test() and related helpers. While
glibc may implicitly pull in these definitions through other
standard headers such as <stdlib.h> or <unistd.h>, musl libc
strictly enforces POSIX namespace separation and avoids implicit
header inclusion. Because the required headers are absent, the
compiler cannot resolve these standard library types and macros,
resulting in a direct compilation failure on musl-based systems.
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/tests/builtin-test.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 4d0784b16723..ca3e7b84d5d7 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -5,16 +5,15 @@
* Builtin regression testing command: ever growing number of sanity tests
*/
#include <ctype.h>
-#include <fcntl.h>
#include <errno.h>
-#ifdef HAVE_BACKTRACE_SUPPORT
-#include <execinfo.h>
-#endif
#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
+#include <fcntl.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/zalloc.h>
@@ -44,6 +43,10 @@
#include "util/strbuf.h"
#include "util/term.h"
+#ifdef HAVE_BACKTRACE_SUPPORT
+#include <execinfo.h>
+#endif
+
static const char *junit_filename;
static struct strbuf junit_xml_buf = STRBUF_INIT;
--
2.55.0.1082.g2b9226bbc0-goog
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v1 07/11] perf ui annotate-data: missing explicit inclusion of stdlib.h and stdio.h
2026-09-17 4:53 [PATCH v1 01/11] perf aslr: Add missing includes and sort headers Ian Rogers
` (4 preceding siblings ...)
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 ` Ian Rogers
2026-09-17 4:53 ` [PATCH v1 08/11] perf annotate-data: missing <string.h> inclusion for libc string functions Ian Rogers
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Ian Rogers @ 2026-09-17 4:53 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, linux-perf-users, linux-kernel
Cc: sashiko-bot
Sashiko reported:
When compiling the Linux kernel performance tools (perf) on a system
using musl libc, a build failure occurs in
tools/perf/ui/browsers/annotate-data.c due to missing standard
header inclusions.
The source file directly invokes standard POSIX library functions
such as calloc(), free(), and snprintf() without explicitly
including <stdlib.h> and <stdio.h>. While glibc implicitly pulls in
these declarations via other included headers, musl libc strictly
separates standard header declarations and does not implicitly
expose them. This namespace isolation causes the compiler to
generate implicit-function-declaration errors when encountering
these undeclared identifiers, permanently failing the build.
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/ui/browsers/annotate-data.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/perf/ui/browsers/annotate-data.c b/tools/perf/ui/browsers/annotate-data.c
index c6e07a9b6408..5ec02bfe30e4 100644
--- a/tools/perf/ui/browsers/annotate-data.c
+++ b/tools/perf/ui/browsers/annotate-data.c
@@ -1,6 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
+
#include <linux/zalloc.h>
#include <sys/ttydefaults.h>
@@ -10,8 +13,8 @@
#include "ui/ui.h"
#include "util/annotate.h"
#include "util/annotate-data.h"
-#include "util/evsel.h"
#include "util/evlist.h"
+#include "util/evsel.h"
#include "util/sort.h"
#define FOLDED_SIGN '+'
--
2.55.0.1082.g2b9226bbc0-goog
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v1 08/11] perf annotate-data: missing <string.h> inclusion for libc string functions
2026-09-17 4:53 [PATCH v1 01/11] perf aslr: Add missing includes and sort headers Ian Rogers
` (5 preceding siblings ...)
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 ` 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
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Ian Rogers @ 2026-09-17 4:53 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, linux-perf-users, linux-kernel
Cc: sashiko-bot
Sashiko reported:
When compiling the perf tool with musl libc,
tools/perf/util/annotate-data.c fails to build due to the missing
<string.h> header.
The source file utilizes standard C library string and memory
functions, such as memset() in init_type_state() and strcmp() in
data_type_cmp(). While glibc implicitly pulls in <string.h> via
other standard headers, musl libc enforces stricter header
separation. Because the header is not explicitly included at the top
of the file, the compiler encounters implicit function declarations
for these standard string functions. This results in a direct
compile-time build 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/annotate-data.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/annotate-data.c b/tools/perf/util/annotate-data.c
index aff60a630fd0..02df833504be 100644
--- a/tools/perf/util/annotate-data.c
+++ b/tools/perf/util/annotate-data.c
@@ -4,20 +4,23 @@
*
* Written by Namhyung Kim <namhyung@kernel.org>
*/
+#include "annotate-data.h"
+
#include <errno.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
-#include <inttypes.h>
+#include <string.h>
+
#include <linux/zalloc.h>
#include "annotate.h"
-#include "annotate-data.h"
-#include "debuginfo.h"
#include "debug.h"
+#include "debuginfo.h"
#include "dso.h"
#include "dwarf-regs.h"
-#include "evsel.h"
#include "evlist.h"
+#include "evsel.h"
#include "map.h"
#include "map_symbol.h"
#include "sort.h"
--
2.55.0.1082.g2b9226bbc0-goog
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v1 09/11] perf mem: missing stdio.h and limits.h in mem-events.c
2026-09-17 4:53 [PATCH v1 01/11] perf aslr: Add missing includes and sort headers Ian Rogers
` (6 preceding siblings ...)
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 ` 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
9 siblings, 0 replies; 11+ messages in thread
From: Ian Rogers @ 2026-09-17 4:53 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, linux-perf-users, linux-kernel
Cc: sashiko-bot
Sashiko reported:
When compiling the perf tool against a strict POSIX C library such
as musl libc, tools/perf/util/mem-events.c fails to build due to the
use of undeclared standard symbols.
The source file defines an array using PATH_MAX in
perf_pmu__mem_events_supported(), and utilizes fprintf() with stderr
in perf_pmu__mem_events_list():
Because the required <limits.h> and <stdio.h> headers are not
explicitly included, these symbols remain undeclared. While glibc
masks this omission by implicitly pulling in these definitions via
other standard headers, musl libc adheres strictly to POSIX
inclusions. This causes the compiler to reject the undeclared
PATH_MAX macro, the stderr stream, and the fprintf() function,
halting the build process on systems utilizing strict libc
implementations.
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/mem-events.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index 0b49fce251fc..64aecc2b67e5 100644
--- a/tools/perf/util/mem-events.c
+++ b/tools/perf/util/mem-events.c
@@ -1,22 +1,28 @@
// SPDX-License-Identifier: GPL-2.0
+#include "mem-events.h"
+
+#include <errno.h>
+#include <limits.h>
#include <stddef.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
+
+#include <linux/kernel.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
+
#include <api/fs/fs.h>
-#include <linux/kernel.h>
+
#include "cpumap.h"
-#include "map_symbol.h"
-#include "mem-events.h"
-#include "mem-info.h"
#include "debug.h"
#include "evsel.h"
-#include "symbol.h"
+#include "map_symbol.h"
+#include "mem-info.h"
#include "pmu.h"
#include "pmus.h"
+#include "symbol.h"
unsigned int perf_mem_events__loads_ldlat = 30;
--
2.55.0.1082.g2b9226bbc0-goog
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v1 10/11] perf config: undeclared PATH_MAX due to missing <limits.h> inclusion
2026-09-17 4:53 [PATCH v1 01/11] perf aslr: Add missing includes and sort headers Ian Rogers
` (7 preceding siblings ...)
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 ` Ian Rogers
2026-09-17 4:53 ` [PATCH v1 11/11] perf mem: missing standard POSIX headers in builtin-mem.c Ian Rogers
9 siblings, 0 replies; 11+ messages in thread
From: Ian Rogers @ 2026-09-17 4:53 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, linux-perf-users, linux-kernel
Cc: sashiko-bot
Sashiko reported:
When compiling the perf tool against a strict C library such as musl
libc, a build failure occurs in home_perfconfig() and
perf_config__set_variable() due to an undeclared PATH_MAX
identifier.
The PATH_MAX macro is defined in the standard POSIX <limits.h>
header. Because tools/perf/util/config.c does not explicitly
include this header, build environments that lack implicit header
inclusion fail to resolve the identifier. This causes a compiler
error when evaluating the size of stack-allocated path arrays,
stopping the build.
Add the header file.
Reported-by: sashiko-bot@kernel.org
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/util/config.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index b2972c35c1ec..5d0cfd86ede6 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -12,6 +12,7 @@
#include "config.h"
#include <errno.h>
+#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
--
2.55.0.1082.g2b9226bbc0-goog
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v1 11/11] perf mem: missing standard POSIX headers in builtin-mem.c
2026-09-17 4:53 [PATCH v1 01/11] perf aslr: Add missing includes and sort headers Ian Rogers
` (8 preceding siblings ...)
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 ` Ian Rogers
9 siblings, 0 replies; 11+ messages in thread
From: Ian Rogers @ 2026-09-17 4:53 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, linux-perf-users, linux-kernel
Cc: sashiko-bot
Sashiko reported:
When compiling the perf tool with musl libc, the build fails in
tools/perf/builtin-mem.c due to missing explicit include directives
for standard POSIX headers.
The source file directly invokes standard libc functions, including
calloc() and free() (from stdlib.h), strcmp() and strdup() (from
string.h), and printf-family functions (from stdio.h). While glibc
often provides these declarations implicitly by pulling them
transitively through other headers like <unistd.h>, musl libc
strictly enforces POSIX namespace boundaries and does not expose
them implicitly.
Because tools/perf/builtin-mem.c lacks explicit #include directives
for <stdlib.h>, <string.h>, and <stdio.h>, compiling against musl
libc results in undeclared identifier and implicit function
declaration errors for these standard library routines, causing a
fatal build failure.
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/builtin-mem.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index 6101a26b3a78..265264a1bdad 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -1,30 +1,35 @@
// SPDX-License-Identifier: GPL-2.0
#include <errno.h>
#include <inttypes.h>
-#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <linux/err.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
-#include "builtin.h"
-#include "perf.h"
#include <subcmd/parse-options.h>
+
+#include "builtin.h"
+#include "perf.h"
#include "util/auxtrace.h"
-#include "util/trace-event.h"
-#include "util/tool.h"
-#include "util/session.h"
#include "util/data.h"
-#include "util/map_symbol.h"
-#include "util/mem-events.h"
#include "util/debug.h"
#include "util/dso.h"
#include "util/map.h"
-#include "util/symbol.h"
+#include "util/map_symbol.h"
+#include "util/mem-events.h"
#include "util/pmus.h"
#include "util/sample.h"
+#include "util/session.h"
#include "util/sort.h"
#include "util/string2.h"
+#include "util/symbol.h"
+#include "util/tool.h"
+#include "util/trace-event.h"
#include "util/util.h"
-#include <linux/err.h>
#define MEM_OPERATION_LOAD 0x1
#define MEM_OPERATION_STORE 0x2
--
2.55.0.1082.g2b9226bbc0-goog
^ permalink raw reply [flat|nested] 11+ messages in thread