From 3cad53a6f9cdbafa32ea8413809f23a28734c7c5 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sun, 4 Dec 2022 18:55:34 -0800 Subject: [PATCH] perf python: Account for multiple words in CC Sometimes build systems may append options e.g. --sysroot etc. to CC variable especially in cross-compile environments like yocto project where CC varable is composed of cross-compiler name and some needed options for it to work in a relocatable environment. Therefore separate out the compiler name from rest of the options in CC, then add the options via second argument to Popen() API Reviewed-by: Florian Fainelli Signed-off-by: Khem Raj Cc: Adrian Hunter Cc: Fangrui Song Cc: Florian Fainelli Cc: Ian Rogers Cc: Jiri Olsa Cc: John Keeping Cc: Leo Yan Cc: Michael Petlan Cc: Namhyung Kim Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: Sedat Dilek Link: https://lore.kernel.org/r/20221205025534.150006-1-raj.khem@gmail.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index e80ffbbfacfb..4f265d0222c4 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -7,7 +7,7 @@ cc_is_clang = b"clang version" in Popen([cc.split()[0], "-v"], stderr=PIPE).stde src_feature_tests = getenv('srctree') + '/tools/build/feature' def clang_has_option(option): - cc_output = Popen([cc, option, path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines() + cc_output = Popen([cc.split()[0], str(cc.split()[1:]) + 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))] == [ ] if cc_is_clang: -- 2.11.0