Skip to content

Commit 9854e7a

Browse files
hpataxisdotcomacmel
authored andcommitted
perf arm64: Simplify mksyscalltbl
This patch isn't intended to have any effect on the compiled code. It just removes one level of indirection: calling the *host* compiler to build and then run a program that just printf:s the numerical entries of the syscall-table. In other words, the generated syscalls.c changes from: [46] = "ftruncate", to: [__NR3264_ftruncate] = "ftruncate", The latter is as good as the former to the user of perf, and this can be done directly by the shell-script. The syscalls defined as non-literal values (like "#define __NR_ftruncate __NR3264_ftruncate") are trivially resolved at compile-time without namespace-leaking and/or collision for its sole user, perf/util/syscalltbl.c, that just #includes the generated file. A future "-mabi=32" support would probably have to handle this differently, but that is a pre-existing problem not affected by this simplification. Calling the *host* compiler only complicates things and accidentally can get a completely wrong set of files and syscall numbers, see earlier commits. Note that the script parameter hostcc is now unused. At the time of this patch, powerpc (the origin, see comments), and also e.g. x86 has moved on, from filtering "gcc -dM -E" output to reading separate specific text-file, a table of syscall numbers. IMHO should arm64 consider adopting this. Signed-off-by: Hans-Peter Nilsson <[email protected]> Cc: Alexander Shishkin <[email protected]> Reviewed-by: Leo Yan <[email protected]> Tested-by: Leo Yan <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Kim Phillips <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent c3c2e8e commit 9854e7a

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

tools/perf/arch/arm64/entry/syscalls/mksyscalltbl

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,34 +23,17 @@ create_table_from_c()
2323
{
2424
local sc nr last_sc
2525

26-
create_table_exe=`mktemp ${TMPDIR:-/tmp}/create-table-XXXXXX`
27-
28-
{
29-
30-
cat <<-_EoHEADER
31-
#include <stdio.h>
32-
#include "$input"
33-
int main(int argc, char *argv[])
34-
{
35-
_EoHEADER
36-
3726
while read sc nr; do
38-
printf "%s\n" " printf(\"\\t[%d] = \\\"$sc\\\",\\n\", __NR_$sc);"
27+
printf "%s\n" " [$nr] = \"$sc\","
3928
last_sc=$sc
4029
done
4130

42-
printf "%s\n" " printf(\"#define SYSCALLTBL_ARM64_MAX_ID %d\\n\", __NR_$last_sc);"
43-
printf "}\n"
44-
45-
} | $hostcc -I $incpath/include/uapi -o $create_table_exe -x c -
46-
47-
$create_table_exe
48-
49-
rm -f $create_table_exe
31+
printf "%s\n" "#define SYSCALLTBL_ARM64_MAX_ID __NR_$last_sc"
5032
}
5133

5234
create_table()
5335
{
36+
echo "#include \"$input\""
5437
echo "static const char *syscalltbl_arm64[] = {"
5538
create_table_from_c
5639
echo "};"

0 commit comments

Comments
 (0)