Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp8749818pxu; Sun, 27 Dec 2020 18:44:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJzH7leRwBKO3qr3VhYu37K9PrwxJklnNz1YW8pJcNC+abBIOBtaEKXlGVNpVtBV+gfUj0G/ X-Received: by 2002:a05:6402:1d15:: with SMTP id dg21mr39894793edb.280.1609123446240; Sun, 27 Dec 2020 18:44:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609123446; cv=none; d=google.com; s=arc-20160816; b=vSKm08rKR9UjV8e9AR1qH7nP+oF4a4fpM7AbiTse8Hau9OLeIJWyhM+U+K4M5FCaL5 x6c1VZvkakHMjUHEtPBjf+kNKrOoTsdrHVztYJc2FDG5h+hqxfEWDrsfeCpIvIZOtXNf +IqjZHHGaporzH78YJQ+X7n73cdt37BnsW5Qvy+Ui8GlQUQn48aYtiDWqErNCE4PQfi/ 6OdYE2UKZKM6Pu5YXY0M/wcm8OyNGJIieMEhkABgWHhhUb7n8JxgldLxExKgwW0/tOen 4/rXbRPLx+3oTbXcEEGJFPg1cu4f4ZTYN8sda8xpeKQnp1QXVW0CSxzCQw8e1PgPJtkv cDSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:content-transfer-encoding :mime-version:subject:cc:to:from:dkim-signature; bh=c/Ou/kG0IGXrZXF2bpT2eD4g6EjPFR87QllRTAJk7vs=; b=fUBmtOUEyfIIghJdd0o5GsUTSH6dMoY4ZKpxGLZbWS/i0dnPeg2h7l11pNDz7qz3Xu H2oYKLGSjtYLmJot56xeVKVMfSmZp9ENH01H4DAeu/ySBkh1EjGlcpyEUo6T2hps0SE/ bz70IN/b4RIcsPWFViRjsISAHcs1q2LDqyWn83i7M6N66jISwXyK3nYBrm67Tx3BIi7o ytUwm3zGIgk3BS6E+6RjqO5iHxj69RfrO0YE3Q40/H5dReNT84E7/T7UBB8AfiGgjwn0 i6GlproLgGaI2hQ/4z8g1m7rHuCUDqTliX4C4qUGOGZOIl0ofDEQeatcwUT2OAcPqXhO a6dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=IVcm6yQ8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pw3si15867169ejb.186.2020.12.27.18.43.44; Sun, 27 Dec 2020 18:44:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=IVcm6yQ8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726511AbgL1Cml (ORCPT + 99 others); Sun, 27 Dec 2020 21:42:41 -0500 Received: from smtp2.axis.com ([195.60.68.18]:55196 "EHLO smtp2.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726289AbgL1Cml (ORCPT ); Sun, 27 Dec 2020 21:42:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1609123360; x=1640659360; h=from:to:cc:subject:mime-version: content-transfer-encoding:message-id:date; bh=c/Ou/kG0IGXrZXF2bpT2eD4g6EjPFR87QllRTAJk7vs=; b=IVcm6yQ8mJSj7kvBtiYmWf598tat8GB6FGHzxIIn1xJM0MSsZR7SNG6b Gx+hYIC8QizuwPA6CJD+r5/4YV5vCztg/KqqC/1wEIpnFI5HKpvNnSUc8 rzRY2CVz7NJehp2YGIlVSL5Est20zpCLRcF66i7OoD1sAolNWUAD+jllZ wmUMCKelj+Mtc8BTA6qZZeDGEAzlNHFBGm7vms2Yc++xd7F6RQBcwoRed n+7g4McQItYwxdpgzW/EljTkPWILOS/5+Rrr4CU+gOm8VM2Zi7zkynMdx kquUrHPV/b0msPg9HDEYh3bY4/lVXwC6dIJMQIkvvQY5W7ph7clSbX51c A==; From: Hans-Peter Nilsson To: , CC: John Garry , Will Deacon , Mathieu Poirier , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Kim Phillips Subject: [PATCH] perf arm64: Simplify mksyscalltbl MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT Message-ID: <20201228024159.2BB66203B5@pchp3.se.axis.com> Date: Mon, 28 Dec 2020 03:41:59 +0100 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: John Garry Cc: Will Deacon Cc: Mathieu Poirier Cc: Leo Yan Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Mark Rutland Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Kim Phillips --- tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl index a7ca48d1e37b..22cdf911dd9a 100755 --- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl +++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl @@ -23,34 +23,17 @@ create_table_from_c() { local sc nr last_sc - create_table_exe=`mktemp ${TMPDIR:-/tmp}/create-table-XXXXXX` - - { - - cat <<-_EoHEADER - #include - #include "$input" - int main(int argc, char *argv[]) - { - _EoHEADER - while read sc nr; do - printf "%s\n" " printf(\"\\t[%d] = \\\"$sc\\\",\\n\", __NR_$sc);" + printf "%s\n" " [$nr] = \"$sc\"," last_sc=$sc done - printf "%s\n" " printf(\"#define SYSCALLTBL_ARM64_MAX_ID %d\\n\", __NR_$last_sc);" - printf "}\n" - - } | $hostcc -I $incpath/include/uapi -o $create_table_exe -x c - - - $create_table_exe - - rm -f $create_table_exe + printf "%s\n" "#define SYSCALLTBL_ARM64_MAX_ID __NR_$last_sc" } create_table() { + echo "#include \"$input\"" echo "static const char *syscalltbl_arm64[] = {" create_table_from_c echo "};" -- 2.11.0 brgds, H-P