Skip to content

Commit

Permalink
perf tools: Fix arm64 build by generating unistd_64.h
Browse files Browse the repository at this point in the history
Since pulling in the kernel changes in commit 22f7208 ("tools
headers: Update the syscall table with the kernel sources"), arm64 is
no longer using a generic syscall header and generates one from the
syscall table. Therefore we must also generate the syscall header for
arm64 before building Perf.

Add it as a dependency to libperf which uses one syscall number. Perf
uses more, but as libperf is a dependency of Perf it will be generated
for both.

Future platforms that need this will have to add their own syscall-y
targets in libperf manually. Unfortunately the arch specific files that
do this (e.g. arch/arm64/include/asm/Kbuild) can't easily be imported
into the Perf build. But Perf only needs a subset of the generated files
anyway, so redefining them is probably the correct thing to do.

Fixes: 22f7208 ("tools headers: Update the syscall table with the kernel sources")
Signed-off-by: James Clark <james.clark@linaro.org>
Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Link: https://lore.kernel.org/r/20250417-james-perf-fix-gen-syscall-v1-1-1d268c923901@linaro.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
  • Loading branch information
James Clark authored and Namhyung Kim committed Apr 23, 2025
1 parent 9c32cda commit bfb713e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tools/lib/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
TEST_ARGS := $(if $(V),-v)

INCLUDES = \
-I$(OUTPUT)/../arch/$(SRCARCH)/include/generated/uapi \
-I$(srctree)/tools/lib/perf/include \
-I$(srctree)/tools/lib/ \
-I$(srctree)/tools/include \
Expand Down Expand Up @@ -99,7 +100,16 @@ $(LIBAPI)-clean:
$(call QUIET_CLEAN, libapi)
$(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null

$(LIBPERF_IN): FORCE
uapi-asm := $(OUTPUT)/../arch/$(SRCARCH)/include/generated/uapi/asm
ifeq ($(SRCARCH),arm64)
syscall-y := $(uapi-asm)/unistd_64.h
endif
uapi-asm-generic:
$(if $(syscall-y),\
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-headers obj=$(uapi-asm) \
generic=include/uapi/asm-generic $(syscall-y),)

$(LIBPERF_IN): uapi-asm-generic FORCE
$(Q)$(MAKE) $(build)=libperf

$(LIBPERF_A): $(LIBPERF_IN)
Expand Down
1 change: 1 addition & 0 deletions tools/perf/Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ include $(srctree)/tools/scripts/Makefile.arch
$(call detected_var,SRCARCH)

CFLAGS += -I$(OUTPUT)arch/$(SRCARCH)/include/generated
CFLAGS += -I$(OUTPUT)arch/$(SRCARCH)/include/generated/uapi

# Additional ARCH settings for ppc
ifeq ($(SRCARCH),powerpc)
Expand Down

0 comments on commit bfb713e

Please sign in to comment.