[v2,3/4] perf python: don't run the linker for clang feature tests

Message ID 6dd7e9dd522c7c6014f8273affa7a558918b048b.1672192591.git.nabijaczleweli@nabijaczleweli.xyz
State New
Headers
Series [1/2] perf python: fix clang feature detection littering |

Commit Message

Ahelenia Ziemiańska Dec. 28, 2022, 1:57 a.m. UTC
  This, for me, slightly-more-than-halves the time it takes to run
  for a in "-mcet" "-fcf-protection" "-fstack-clash-protection" \
           "-fstack-protector-strong" "-fno-semantic-interposition" \
           "-ffat-lto-objects"; do
    sh -c '$CC "$@"' '' "$a" -o /dev/null ../build/feature/test-hello.c; done
from just over 600ms.

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
---
 tools/perf/util/setup.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index ba0b1e078855..0a557f2bf357 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -6,7 +6,7 @@  cc_is_clang = b"clang version" in Popen(["/bin/sh", "-c", "$CC -v"], stderr=PIPE
 src_feature_tests  = getenv('srctree') + '/tools/build/feature'
 
 def clang_has_option(option):
-    cc_output = Popen(["/bin/sh", "-c", '$CC "$@"', "", option, "-o", "/dev/null", path.join(src_feature_tests, "test-hello.c")], stderr=PIPE).stderr.readlines()
+    cc_output = Popen(["/bin/sh", "-c", '$CC "$@"', "", option, "-c", "-o", "/dev/null", 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: