Skip to contentSkip to conversation

perf python: Account for multiple words in CC

PATCH Applied Khem Raj 3 participants 3 messages Dec 5, 2022 – Dec 12, 2022 perf events

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 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

Cc Adrian Hunter <[email protected]>
Cc Fangrui Song <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc John Keeping <[email protected]>
Cc Leo Yan <[email protected]>
Cc Michael Petlan <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Nick Desaulniers <[email protected]>
Cc Sedat Dilek <[email protected]>
---
 tools/perf/util/setup.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/setup.py +1 -1
index 5b1e6468d5e8..e9be6e36408f 100644
@@ -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:
Signature · 1 line
2.38.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Khem Raj

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

Quoted 13 lines
Cc Adrian Hunter <[email protected]>
Cc Fangrui Song <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc John Keeping <[email protected]>
Cc Leo Yan <[email protected]>
Cc Michael Petlan <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Nick Desaulniers <[email protected]>
Cc Sedat Dilek <[email protected]>

FWIW:

Signature · 1 line
Florian
maintainer Applied
#2 lore raw

Em Mon, Dec 05, 2022 at 01:01:10PM -0800, Florian Fainelli escreveu:

Quoted 22 lines · Khem Raj
Quoted 7 lines

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

Quoted 13 lines
Cc Adrian Hunter <[email protected]>
Cc Fangrui Song <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc John Keeping <[email protected]>
Cc Leo Yan <[email protected]>
Cc Michael Petlan <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Nick Desaulniers <[email protected]>
Cc Sedat Dilek <[email protected]>
Quoted 3 lines

FWIW:

Thanks, applied.

- Arnaldo