[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <csrtenswfduvfgyalcydxudcwjo7ezt5vuvfxkkrbpza6o3cls@t55uhpt4363z>
Date: Mon, 6 Oct 2025 16:39:45 -0700
From: Justin Stitt <justinstitt@...gle.com>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>, Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>, Bill Wendling <morbo@...gle.com>,
James Clark <james.clark@...aro.org>, linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev
Subject: Re: [PATCH v1] perf build: Don't leave a.out file when building with
clang
Hi,
On Mon, Oct 06, 2025 at 03:21:16PM -0700, Ian Rogers wrote:
> Testing clang features doesn't specify a "-o" option so an a.out file
> is created and left in the make directory (not the output). Fix this
> by specifying a "-o" of "/dev/null". Reorganize the code a little to
> help with readability.
>
> Signed-off-by: Ian Rogers <irogers@...gle.com>
Tested-by: Justin Stitt <justinstitt@...gle.com>
> ---
> tools/perf/util/setup.py | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
> index dd289d15acfd..6caf2126b1cd 100644
> --- a/tools/perf/util/setup.py
> +++ b/tools/perf/util/setup.py
> @@ -22,8 +22,16 @@ assert srctree, "Environment variable srctree, for the Linux sources, not set"
> src_feature_tests = f'{srctree}/tools/build/feature'
>
> def clang_has_option(option):
> - cc_output = Popen([cc, cc_options + option, path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines()
> - return [o for o in cc_output if ((b"unknown argument" in o) or (b"is not supported" in o) or (b"unknown warning option" in o))] == [ ]
> + error_substrings = (
> + b"unknown argument",
> + b"is not supported",
> + b"unknown warning option"
> + )
> + clang_command = [cc, cc_options + option,
> + "-o", "/dev/null",
> + path.join(src_feature_tests, "test-hello.c") ]
> + cc_output = Popen(clang_command, stderr=PIPE).stderr.readlines()
> + return not any(any(error in line for error in error_substrings) for line in cc_output)
>
> if cc_is_clang:
> from sysconfig import get_config_vars
> --
> 2.51.0.618.g983fd99d29-goog
>
>
Thanks
Justin
Powered by blists - more mailing lists