Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf syscalltbl: Remove syscall_table.h

The definition of "static const char *const syscalltbl[] = {" is done
in a generated syscalls_32.h or syscalls_64.h that is architecture
dependent. In order to include the appropriate file a syscall_table.h
is found via the perf include path and it includes the syscalls_32.h
or syscalls_64.h as appropriate.

To support having multiple syscall tables, one for 32-bit and one for
64-bit, or for different architectures, an include path cannot be
used. Remove syscall_table.h because of this and inline what it does
into syscalltbl.c.

For architectures without a syscall_table.h this will cause a failure
to include either syscalls_32.h or syscalls_64.h rather than a failure
to include syscall_table.h. For architectures that only included one
or other, the behavior matches BITS_PER_LONG as previously done on
architectures supporting both syscalls_32.h and syscalls_64.h.

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-4-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Ian Rogers and committed by
Namhyung Kim
af472d3c 4773175c

+7 -67
-2
tools/perf/arch/alpha/include/syscall_table.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <asm/syscalls_64.h>
-2
tools/perf/arch/arc/include/syscall_table.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <asm/syscalls_32.h>
-2
tools/perf/arch/arm/include/syscall_table.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <asm/syscalls_32.h>
-8
tools/perf/arch/arm64/include/syscall_table.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <asm/bitsperlong.h> 3 - 4 - #if __BITS_PER_LONG == 64 5 - #include <asm/syscalls_64.h> 6 - #else 7 - #include <asm/syscalls_32.h> 8 - #endif
-2
tools/perf/arch/csky/include/syscall_table.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <asm/syscalls_32.h>
-2
tools/perf/arch/loongarch/include/syscall_table.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <asm/syscall_table_64.h>
-2
tools/perf/arch/mips/include/syscall_table.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <asm/syscalls_64.h>
-8
tools/perf/arch/parisc/include/syscall_table.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <asm/bitsperlong.h> 3 - 4 - #if __BITS_PER_LONG == 64 5 - #include <asm/syscalls_64.h> 6 - #else 7 - #include <asm/syscalls_32.h> 8 - #endif
-8
tools/perf/arch/powerpc/include/syscall_table.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <asm/bitsperlong.h> 3 - 4 - #if __BITS_PER_LONG == 64 5 - #include <asm/syscalls_64.h> 6 - #else 7 - #include <asm/syscalls_32.h> 8 - #endif
-8
tools/perf/arch/riscv/include/syscall_table.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <asm/bitsperlong.h> 3 - 4 - #if __BITS_PER_LONG == 64 5 - #include <asm/syscalls_64.h> 6 - #else 7 - #include <asm/syscalls_32.h> 8 - #endif
-2
tools/perf/arch/s390/include/syscall_table.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <asm/syscalls_64.h>
-2
tools/perf/arch/sh/include/syscall_table.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <asm/syscalls_32.h>
-8
tools/perf/arch/sparc/include/syscall_table.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <asm/bitsperlong.h> 3 - 4 - #if __BITS_PER_LONG == 64 5 - #include <asm/syscalls_64.h> 6 - #else 7 - #include <asm/syscalls_32.h> 8 - #endif
-8
tools/perf/arch/x86/include/syscall_table.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <asm/bitsperlong.h> 3 - 4 - #if __BITS_PER_LONG == 64 5 - #include <asm/syscalls_64.h> 6 - #else 7 - #include <asm/syscalls_32.h> 8 - #endif
-2
tools/perf/arch/xtensa/include/syscall_table.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <asm/syscalls_32.h>
+7 -1
tools/perf/util/syscalltbl.c
··· 7 7 8 8 #include "syscalltbl.h" 9 9 #include <stdlib.h> 10 + #include <asm/bitsperlong.h> 10 11 #include <linux/compiler.h> 11 12 #include <linux/zalloc.h> 12 13 13 14 #include <string.h> 14 15 #include "string2.h" 15 16 16 - #include <syscall_table.h> 17 + #if __BITS_PER_LONG == 64 18 + #include <asm/syscalls_64.h> 19 + #else 20 + #include <asm/syscalls_32.h> 21 + #endif 22 + 17 23 const int syscalltbl_native_max_id = SYSCALLTBL_MAX_ID; 18 24 static const char *const *syscalltbl_native = syscalltbl; 19 25