mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-12-19 00:57:33 +01:00
perf build: Remove Makefile.syscalls
Now a single beauty file is generated and used by all architectures, remove the per-architecture Makefiles, Kbuild files and previous generator script. Note: there was conversation with Charlie Jenkins <charlie@rivosinc.com> and they'd written an alternate approach to support multiple architectures: https://lore.kernel.org/all/20250114-perf_syscall_arch_runtime-v1-1-5b304e408e11@rivosinc.com/ It would have been better to have helped Charlie fix their series (my apologies) but they agreed that the approach taken here was likely best for longer term maintainability: https://lore.kernel.org/lkml/Z6Jk_UN9i69QGqUj@ghost/ Signed-off-by: Ian Rogers <irogers@google.com> Reviewed-by: Howard Chu <howardchu95@gmail.com> Reviewed-by: Charlie Jenkins <charlie@rivosinc.com> Reviewed-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Arnaldo Carvalho de Melo <acme@kernel.org> Link: https://lore.kernel.org/r/20250319050741.269828-11-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
1470eaa574
commit
16ab5c708d
|
|
@ -339,7 +339,6 @@ ifeq ($(filter feature-dump,$(MAKECMDGOALS)),feature-dump)
|
||||||
FEATURE_TESTS := all
|
FEATURE_TESTS := all
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
include $(srctree)/tools/perf/scripts/Makefile.syscalls
|
|
||||||
include Makefile.config
|
include Makefile.config
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
syscall-y += syscalls_64.h
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
|
||||||
syscall_abis_64 +=
|
|
||||||
|
|
||||||
syscalltbl = $(srctree)/tools/perf/arch/alpha/entry/syscalls/syscall.tbl
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
syscall-y += syscalls_32.h
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
|
||||||
syscall_abis_32 += arc time32 renameat stat64 rlimit
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
|
||||||
syscall_abis_32 += oabi
|
|
||||||
syscalltbl = $(srctree)/tools/perf/arch/arm/entry/syscalls/syscall.tbl
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
syscall-y += syscalls_32.h
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
syscall-y += syscalls_32.h
|
|
||||||
syscall-y += syscalls_64.h
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
|
||||||
syscall_abis_32 +=
|
|
||||||
syscall_abis_64 += renameat rlimit memfd_secret
|
|
||||||
|
|
||||||
syscalltbl = $(srctree)/tools/perf/arch/arm64/entry/syscalls/syscall_%.tbl
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
syscall-y += syscalls_32.h
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
|
||||||
syscall_abis_32 += csky time32 stat64 rlimit
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
syscall-y += syscalls_64.h
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
|
||||||
syscall_abis_64 +=
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
syscall-y += syscalls_64.h
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
|
||||||
syscall_abis_64 += n64
|
|
||||||
|
|
||||||
syscalltbl = $(srctree)/tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
syscall-y += syscalls_32.h
|
|
||||||
syscall-y += syscalls_64.h
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
|
||||||
syscall_abis_32 +=
|
|
||||||
syscall_abis_64 +=
|
|
||||||
|
|
||||||
syscalltbl = $(srctree)/tools/perf/arch/parisc/entry/syscalls/syscall.tbl
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
syscall-y += syscalls_32.h
|
|
||||||
syscall-y += syscalls_64.h
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
|
||||||
syscall_abis_32 += nospu
|
|
||||||
syscall_abis_64 += nospu
|
|
||||||
|
|
||||||
syscalltbl = $(srctree)/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
syscall-y += syscalls_64.h
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
|
||||||
syscall_abis_32 += riscv memfd_secret
|
|
||||||
syscall_abis_64 += riscv rlimit memfd_secret
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
syscall-y += syscalls_64.h
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
|
||||||
syscall_abis_64 += renameat rlimit memfd_secret
|
|
||||||
|
|
||||||
syscalltbl = $(srctree)/tools/perf/arch/s390/entry/syscalls/syscall.tbl
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
syscall-y += syscalls_32.h
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
|
||||||
syscall_abis_32 +=
|
|
||||||
syscalltbl = $(srctree)/tools/perf/arch/sh/entry/syscalls/syscall.tbl
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
syscall-y += syscalls_32.h
|
|
||||||
syscall-y += syscalls_64.h
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
|
||||||
syscall_abis_32 +=
|
|
||||||
syscall_abis_64 +=
|
|
||||||
syscalltbl = $(srctree)/tools/perf/arch/sparc/entry/syscalls/syscall.tbl
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
syscall-y += syscalls_32.h
|
|
||||||
syscall-y += syscalls_64.h
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
|
||||||
syscall_abis_32 += i386
|
|
||||||
syscall_abis_64 +=
|
|
||||||
|
|
||||||
syscalltbl = $(srctree)/tools/perf/arch/x86/entry/syscalls/syscall_%.tbl
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
syscall-y += syscalls_32.h
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
|
|
||||||
syscall_abis_32 +=
|
|
||||||
syscalltbl = $(srctree)/tools/perf/arch/xtensa/entry/syscalls/syscall.tbl
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
# This Makefile generates headers in
|
|
||||||
# tools/perf/arch/$(SRCARCH)/include/generated/asm from the architecture's
|
|
||||||
# syscall table. This will either be from the generic syscall table, or from a
|
|
||||||
# table that is specific to that architecture.
|
|
||||||
|
|
||||||
PHONY := all
|
|
||||||
all:
|
|
||||||
|
|
||||||
obj := $(OUTPUT)arch/$(SRCARCH)/include/generated/asm
|
|
||||||
|
|
||||||
syscall_abis_32 := common,32
|
|
||||||
syscall_abis_64 := common,64
|
|
||||||
syscalltbl := $(srctree)/tools/scripts/syscall.tbl
|
|
||||||
|
|
||||||
# let architectures override $(syscall_abis_%) and $(syscalltbl)
|
|
||||||
-include $(srctree)/tools/perf/arch/$(SRCARCH)/entry/syscalls/Makefile.syscalls
|
|
||||||
include $(srctree)/tools/build/Build.include
|
|
||||||
-include $(srctree)/tools/perf/arch/$(SRCARCH)/entry/syscalls/Kbuild
|
|
||||||
|
|
||||||
systbl := $(srctree)/tools/perf/scripts/syscalltbl.sh
|
|
||||||
|
|
||||||
syscall-y := $(addprefix $(obj)/, $(syscall-y))
|
|
||||||
|
|
||||||
# Remove stale wrappers when the corresponding files are removed from generic-y
|
|
||||||
old-headers := $(wildcard $(obj)/*.h)
|
|
||||||
unwanted := $(filter-out $(syscall-y),$(old-headers))
|
|
||||||
|
|
||||||
quiet_cmd_remove = REMOVE $(unwanted)
|
|
||||||
cmd_remove = rm -f $(unwanted)
|
|
||||||
|
|
||||||
quiet_cmd_systbl = SYSTBL $@
|
|
||||||
cmd_systbl = $(CONFIG_SHELL) $(systbl) \
|
|
||||||
$(if $(systbl-args-$*),$(systbl-args-$*),$(systbl-args)) \
|
|
||||||
--abis $(subst $(space),$(comma),$(strip $(syscall_abis_$*))) \
|
|
||||||
$< $@
|
|
||||||
|
|
||||||
all: $(syscall-y)
|
|
||||||
$(if $(unwanted),$(call cmd,remove))
|
|
||||||
@:
|
|
||||||
|
|
||||||
$(obj)/syscalls_%.h: $(syscalltbl) $(systbl) FORCE
|
|
||||||
$(call if_changed,systbl)
|
|
||||||
|
|
||||||
targets := $(syscall-y)
|
|
||||||
|
|
||||||
# Create output directory. Skip it if at least one old header exists
|
|
||||||
# since we know the output directory already exists.
|
|
||||||
ifeq ($(old-headers),)
|
|
||||||
$(shell mkdir -p $(obj))
|
|
||||||
endif
|
|
||||||
|
|
||||||
PHONY += FORCE
|
|
||||||
|
|
||||||
FORCE:
|
|
||||||
|
|
||||||
existing-targets := $(wildcard $(sort $(targets)))
|
|
||||||
|
|
||||||
-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
|
|
||||||
|
|
||||||
.PHONY: $(PHONY)
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
#
|
|
||||||
# Generate a syscall table header.
|
|
||||||
#
|
|
||||||
# Each line of the syscall table should have the following format:
|
|
||||||
#
|
|
||||||
# NR ABI NAME [NATIVE] [COMPAT]
|
|
||||||
#
|
|
||||||
# NR syscall number
|
|
||||||
# ABI ABI name
|
|
||||||
# NAME syscall name
|
|
||||||
# NATIVE native entry point (optional)
|
|
||||||
# COMPAT compat entry point (optional)
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
usage() {
|
|
||||||
echo >&2 "usage: $0 [--abis ABIS] INFILE OUTFILE" >&2
|
|
||||||
echo >&2
|
|
||||||
echo >&2 " INFILE input syscall table"
|
|
||||||
echo >&2 " OUTFILE output header file"
|
|
||||||
echo >&2
|
|
||||||
echo >&2 "options:"
|
|
||||||
echo >&2 " --abis ABIS ABI(s) to handle (By default, all lines are handled)"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# default unless specified by options
|
|
||||||
abis=
|
|
||||||
|
|
||||||
while [ $# -gt 0 ]
|
|
||||||
do
|
|
||||||
case $1 in
|
|
||||||
--abis)
|
|
||||||
abis=$(echo "($2)" | tr ',' '|')
|
|
||||||
shift 2;;
|
|
||||||
-*)
|
|
||||||
echo "$1: unknown option" >&2
|
|
||||||
usage;;
|
|
||||||
*)
|
|
||||||
break;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ $# -ne 2 ]; then
|
|
||||||
usage
|
|
||||||
fi
|
|
||||||
|
|
||||||
infile="$1"
|
|
||||||
outfile="$2"
|
|
||||||
|
|
||||||
sorted_table=$(mktemp /tmp/syscalltbl.XXXXXX)
|
|
||||||
grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | sort -n > $sorted_table
|
|
||||||
|
|
||||||
echo "static const char *const syscall_num_to_name[] = {" > $outfile
|
|
||||||
# the params are: nr abi name entry compat
|
|
||||||
# use _ for intentionally unused variables according to SC2034
|
|
||||||
while read nr _ name _ _; do
|
|
||||||
echo " [$nr] = \"$name\"," >> $outfile
|
|
||||||
done < $sorted_table
|
|
||||||
echo "};" >> $outfile
|
|
||||||
|
|
||||||
echo "static const uint16_t syscall_sorted_names[] = {" >> $outfile
|
|
||||||
|
|
||||||
# When sorting by name, add a suffix of 0s upto 20 characters so that system
|
|
||||||
# calls that differ with a numerical suffix don't sort before those
|
|
||||||
# without. This default behavior of sort differs from that of strcmp used at
|
|
||||||
# runtime. Use sed to strip the trailing 0s suffix afterwards.
|
|
||||||
grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | awk '{printf $3; for (i = length($3); i < 20; i++) { printf "0"; }; print " " $1}'| sort | sed 's/\([a-zA-Z1-9]\+\)0\+ \([0-9]\+\)/\1 \2/' > $sorted_table
|
|
||||||
while read name nr; do
|
|
||||||
echo " $nr, /* $name */" >> $outfile
|
|
||||||
done < $sorted_table
|
|
||||||
echo "};" >> $outfile
|
|
||||||
|
|
||||||
rm -f $sorted_table
|
|
||||||
Loading…
Reference in New Issue
Block a user