linux/tools/perf/util
Arnaldo Carvalho de Melo 09e6f9f983 perf python: Fix splitting CC into compiler and options
Noticed this build failure on archlinux:base when building with clang:

  clang-14: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]

In tools/perf/util/setup.py we check if clang supports that option, but
since commit 3cad53a6f9 ("perf python: Account for multiple words
in CC") this got broken as in the common case where CC="clang":

  >>> cc="clang"
  >>> print(cc.split()[0])
  clang
  >>> option="-ffat-lto-objects"
  >>> print(str(cc.split()[1:]) + option)
  []-ffat-lto-objects
  >>>

And then the Popen will call clang with that bogus option name that in
turn will not produce the b"unknown argument" or b"is not supported"
that this function uses to detect if the option is not available and
thus later on clang will be called with an unknown/unsupported option.

Fix it by looking if really there are options in the provided CC
variable, and if so override 'cc' with the first token and append the
options to the 'option' variable.

Fixes: 3cad53a6f9 ("perf python: Account for multiple words in CC")
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Fangrui Song <maskray@google.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Keeping <john@metanate.com>
Cc: Khem Raj <raj.khem@gmail.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Link: http://lore.kernel.org/lkml/Y6Rq5F5NI0v1QQHM@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-12-22 11:34:30 -03:00
..
arm-spe-decoder
bpf_skel perf lock contention: Support lock addr/name filtering for BPF 2022-12-21 14:52:39 -03:00
c++
cs-etm-decoder
hisi-ptt-decoder
include
intel-pt-decoder
libunwind
scripting-engines perf scripting python: Don't be strict at handling libtraceevent enumerations 2022-12-21 17:30:38 -03:00
Build perf cs-etm: Print auxtrace info even if OpenCSD isn't linked 2022-12-14 11:24:31 -03:00
PERF-VERSION-GEN
affinity.c perf tools: Use dedicated non-atomic clear/set bit helpers 2022-12-05 09:29:06 -03:00
affinity.h
amd-sample-raw.c
annotate.c
annotate.h
archinsn.h
arm-spe.c
arm-spe.h
arm64-frame-pointer-unwind-support.c
arm64-frame-pointer-unwind-support.h
auxtrace.c
auxtrace.h
block-info.c
block-info.h
block-range.c
block-range.h
bpf-event.c
bpf-event.h
bpf-loader.c Merge remote-tracking branch 'torvalds/master' into perf/core 2022-12-16 09:53:53 -03:00
bpf-loader.h
bpf-prologue.c
bpf-prologue.h
bpf-utils.c
bpf-utils.h
bpf_counter.c
bpf_counter.h
bpf_counter_cgroup.c
bpf_ftrace.c
bpf_kwork.c
bpf_lock_contention.c perf lock contention: Support lock addr/name filtering for BPF 2022-12-21 14:52:39 -03:00
bpf_map.c
bpf_map.h
bpf_off_cpu.c perf off_cpu: Fix a typo in BTF tracepoint name, it should be 'btf_trace_sched_switch' 2022-12-14 11:24:31 -03:00
branch.c
branch.h perf branch: Fix interpretation of branch records 2022-12-05 09:29:14 -03:00
build-id.c
build-id.h
cache.h
cacheline.c
cacheline.h
call-path.c
call-path.h
callchain.c
callchain.h
cap.c
cap.h
cgroup.c
cgroup.h
clockid.c
clockid.h
cloexec.c
cloexec.h
color.c
color.h
color_config.c
comm.c
comm.h
compress.h
config.c
config.h
copyfile.c
copyfile.h
counts.c
counts.h
cpu-set-sched.h
cpumap.c
cpumap.h
cputopo.c
cputopo.h
cs-etm-base.c perf cs-etm: Print auxtrace info even if OpenCSD isn't linked 2022-12-14 11:24:31 -03:00
cs-etm.c perf cs-etm: Print auxtrace info even if OpenCSD isn't linked 2022-12-14 11:24:31 -03:00
cs-etm.h perf cs-etm: Print auxtrace info even if OpenCSD isn't linked 2022-12-14 11:24:31 -03:00
data-convert-bt.c perf tools: Check if libtracevent has TEP_FIELD_IS_RELATIVE 2022-12-14 11:16:12 -03:00
data-convert-json.c perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
data-convert.h
data.c
data.h
db-export.c
db-export.h
debug.c perf debug: Set debug_peo_args and redirect_to_stderr variable to correct values in perf_quiet_option() 2022-12-20 15:16:33 -03:00
debug.h
demangle-java.c
demangle-java.h
demangle-ocaml.c
demangle-ocaml.h
demangle-rust.c
demangle-rust.h
dlfilter.c perf tools: Fix usage of the verbose variable 2022-12-20 15:16:33 -03:00
dlfilter.h
dso.c
dso.h
dsos.c
dsos.h
dump-insn.c
dump-insn.h
dwarf-aux.c
dwarf-aux.h
dwarf-regs.c
env.c
env.h
event.c
event.h
events_stats.h
evlist-hybrid.c
evlist-hybrid.h
evlist.c perf evlist: Remove group option. 2022-12-14 15:28:18 -03:00
evlist.h perf evlist: Remove group option. 2022-12-14 15:28:18 -03:00
evsel.c Merge remote-tracking branch 'torvalds/master' into perf/core 2022-12-16 09:53:53 -03:00
evsel.h perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
evsel_config.h
evsel_fprintf.c perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
evsel_fprintf.h
evswitch.c
evswitch.h
expr.c Merge remote-tracking branch 'torvalds/master' into perf/core 2022-12-16 09:53:53 -03:00
expr.h
expr.l
expr.y
find-map.c
fncache.c
fncache.h
ftrace.h
genelf.c
genelf.h
genelf_debug.c
generate-cmdlist.sh
get_current_dir_name.c
get_current_dir_name.h
hashmap.c
hashmap.h
header.c perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
header.h perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
help-unknown-cmd.c
help-unknown-cmd.h
hisi-ptt.c
hisi-ptt.h
hist.c perf hist: Add perf_hpp_fmt->init() callback 2022-12-21 14:52:40 -03:00
hist.h perf hist: Add perf_hpp_fmt->init() callback 2022-12-21 14:52:40 -03:00
intel-bts.c
intel-bts.h
intel-pt.c perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
intel-pt.h
intlist.c
intlist.h
iostat.c perf stat: Pass through 'struct outstate' 2022-11-24 09:40:37 -03:00
iostat.h perf stat: Pass through 'struct outstate' 2022-11-24 09:40:37 -03:00
jit.h
jitdump.c
jitdump.h
kvm-stat.h
kwork.h
levenshtein.c
levenshtein.h
llvm-utils.c
llvm-utils.h
lock-contention.h perf lock contention: Add -L/--lock-filter option 2022-12-21 14:52:39 -03:00
lzma.c
machine.c machine: Adopt is_lock_function() from builtin-lock.c 2022-12-14 11:16:12 -03:00
machine.h machine: Adopt is_lock_function() from builtin-lock.c 2022-12-14 11:16:12 -03:00
map.c
map.h
map_symbol.h
maps.c
maps.h
mem-events.c
mem-events.h
mem2node.c
mem2node.h
memswap.c
memswap.h
metricgroup.c Merge remote-tracking branch 'torvalds/master' into perf/core 2022-12-16 09:53:53 -03:00
metricgroup.h perf list: Reorganize to use callbacks to allow honouring command line options 2022-11-23 10:29:59 -03:00
mmap.c perf tools: Use dedicated non-atomic clear/set bit helpers 2022-12-05 09:29:06 -03:00
mmap.h
mutex.c
mutex.h
namespaces.c
namespaces.h
off_cpu.h
ordered-events.c
ordered-events.h
parse-branch-options.c perf record: Add remaining branch filters: "no_cycles", "no_flags" & "hw_index" 2022-12-14 11:16:12 -03:00
parse-branch-options.h
parse-events-hybrid.c
parse-events-hybrid.h
parse-events.c perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
parse-events.h perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
parse-events.l
parse-events.y
parse-regs-options.c
parse-regs-options.h
parse-sublevel-options.c
parse-sublevel-options.h
path.c
path.h
perf-hooks-list.h
perf-hooks.c
perf-hooks.h
perf_api_probe.c
perf_api_probe.h
perf_event_attr_fprintf.c
perf_regs.c
perf_regs.h
pfm.c perf list: List callback support for libpfm 2022-11-24 10:04:52 -03:00
pfm.h perf list: List callback support for libpfm 2022-11-24 10:04:52 -03:00
pmu-hybrid.c
pmu-hybrid.h
pmu.c perf tool: Move pmus list variable to a new file 2022-12-14 11:16:12 -03:00
pmu.h perf list: Reorganize to use callbacks to allow honouring command line options 2022-11-23 10:29:59 -03:00
pmu.l
pmu.y
pmus.c perf tool: Move pmus list variable to a new file 2022-12-14 11:16:12 -03:00
pmus.h perf tool: Move pmus list variable to a new file 2022-12-14 11:16:12 -03:00
print-events.c perf list: Reorganize to use callbacks to allow honouring command line options 2022-11-23 10:29:59 -03:00
print-events.h perf list: Reorganize to use callbacks to allow honouring command line options 2022-11-23 10:29:59 -03:00
print_binary.c
print_binary.h
probe-event.c
probe-event.h
probe-file.c
probe-file.h
probe-finder.c
probe-finder.h
pstack.c
pstack.h
python-ext-sources
python.c perf evlist: Remove group option. 2022-12-14 15:28:18 -03:00
rb_resort.h
rblist.c
rblist.h
record.c perf evlist: Remove group option. 2022-12-14 15:28:18 -03:00
record.h perf evlist: Remove group option. 2022-12-14 15:28:18 -03:00
rlimit.c
rlimit.h
rwsem.c
rwsem.h
s390-cpumcf-kernel.h
s390-cpumsf-kernel.h
s390-cpumsf.c
s390-cpumsf.h
s390-sample-raw.c
sample-raw.c
sample-raw.h
sample.h
session.c perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
session.h perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
setns.c
setup.py perf python: Fix splitting CC into compiler and options 2022-12-22 11:34:30 -03:00
sideband_evlist.c
smt.c
smt.h
sort.c perf hist: Improve srcline_{from,to} sort key performance 2022-12-21 14:52:40 -03:00
sort.h perf hist: Add perf_hpp_fmt->init() callback 2022-12-21 14:52:40 -03:00
spark.c
spark.h
srccode.c
srccode.h
srcline.c perf srcline: Conditionally suppress addr2line warnings 2022-12-21 14:52:40 -03:00
srcline.h
stat-display.c perf stat: Update event skip condition for system-wide per-thread mode and merged uncore and hybrid events 2022-12-14 11:16:12 -03:00
stat-shadow.c Merge remote-tracking branch 'torvalds/master' into perf/core 2022-12-16 09:53:53 -03:00
stat.c Merge remote-tracking branch 'torvalds/master' into perf/core 2022-12-16 09:53:53 -03:00
stat.h
strbuf.c
strbuf.h
stream.c
stream.h
strfilter.c
strfilter.h
string.c
string2.h
strlist.c
strlist.h
svghelper.c perf tools: Use dedicated non-atomic clear/set bit helpers 2022-12-05 09:29:06 -03:00
svghelper.h
symbol-elf.c perf symbol: Add filename__has_section() 2022-12-21 14:52:40 -03:00
symbol-minimal.c perf symbol: Add filename__has_section() 2022-12-21 14:52:40 -03:00
symbol.c
symbol.h perf symbol: Add filename__has_section() 2022-12-21 14:52:40 -03:00
symbol_conf.h
symbol_fprintf.c
symsrc.h
synthetic-events.c perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
synthetic-events.h
syscalltbl.c
syscalltbl.h
target.c
target.h
term.c
term.h
thread-stack.c
thread-stack.h
thread.c
thread.h
thread_map.c
thread_map.h
time-utils.c
time-utils.h
tool.h
top.c
top.h
topdown.c
topdown.h
trace-event-info.c perf util: Add host_is_bigendian to util.h 2022-12-14 11:16:12 -03:00
trace-event-parse.c perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
trace-event-read.c perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
trace-event-scripting.c perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
trace-event.c perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
trace-event.h perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
tracepoint.c
tracepoint.h
trigger.h
tsc.c
tsc.h
units.c
units.h
unwind-libdw.c
unwind-libdw.h
unwind-libunwind-local.c
unwind-libunwind.c
unwind.h
usage.c
util.c
util.h perf util: Add host_is_bigendian to util.h 2022-12-14 11:16:12 -03:00
values.c
values.h
vdso.c
vdso.h
zlib.c
zstd.c