From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> commit 3a8a0475861a443f02e3a9b57d044fe2a0a99291 upstream. Using -ffat-lto-objects in the python feature test when building with clang-13 results in: clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument] error: command '/usr/sbin/clang' failed with exit code 1 cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1 Noticed when building on a docker.io/library/archlinux:base container. Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx> Cc: Fangrui Song <maskray@xxxxxxxxxx> Cc: Florian Fainelli <f.fainelli@xxxxxxxxx> Cc: Ian Rogers <irogers@xxxxxxxxxx> Cc: Jiri Olsa <jolsa@xxxxxxxxxx> Cc: John Keeping <john@xxxxxxxxxxxx> Cc: Leo Yan <leo.yan@xxxxxxxxxx> Cc: Michael Petlan <mpetlan@xxxxxxxxxx> Cc: Namhyung Kim <namhyung@xxxxxxxxxx> Cc: Nathan Chancellor <nathan@xxxxxxxxxx> Cc: Nick Desaulniers <ndesaulniers@xxxxxxxxxx> Cc: Sedat Dilek <sedat.dilek@xxxxxxxxx> Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- tools/perf/Makefile.config | 3 +++ tools/perf/util/setup.py | 2 ++ 2 files changed, 5 insertions(+) --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -272,6 +272,9 @@ ifdef PYTHON_CONFIG PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null) FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) + ifeq ($(CC_NO_CLANG), 0) + PYTHON_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PYTHON_EMBED_CCOPTS)) + endif endif FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -23,6 +23,8 @@ if cc_is_clang: vars[var] = sub("-fstack-protector-strong", "", vars[var]) if not clang_has_option("-fno-semantic-interposition"): vars[var] = sub("-fno-semantic-interposition", "", vars[var]) + if not clang_has_option("-ffat-lto-objects"): + vars[var] = sub("-ffat-lto-objects", "", vars[var]) from distutils.core import setup, Extension Patches currently in stable-queue which might be from acme@xxxxxxxxxx are queue-5.17/perf-unwind-don-t-show-unwind-error-messages-when-au.patch queue-5.17/perf-arm-spe-fix-perf-report-mem-mode.patch queue-5.17/perf-session-remap-buf-if-there-is-no-space-for-even.patch queue-5.17/perf-tools-fix-perf-s-libperf_print-callback.patch queue-5.17/perf-build-don-t-use-ffat-lto-objects-in-the-python-feature-test-when-building-with-clang-13.patch queue-5.17/perf-python-fix-probing-for-some-clang-command-line-options.patch queue-5.17/tools-build-filter-out-options-and-warnings-not-supported-by-clang.patch queue-5.17/tools-build-use-shell-instead-of-to-get-embedded-libperl-s-ccopts.patch