Skip to content

Commit 3a8a047

Browse files
committed
perf build: Don't use -ffat-lto-objects in the python feature test when building with clang-13
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@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: 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> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent dd6e1fe commit 3a8a047

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

tools/perf/Makefile.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ ifdef PYTHON_CONFIG
272272
PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
273273
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null)
274274
FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
275+
ifeq ($(CC_NO_CLANG), 0)
276+
PYTHON_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PYTHON_EMBED_CCOPTS))
277+
endif
275278
endif
276279

277280
FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)

tools/perf/util/setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ def clang_has_option(option):
2525
vars[var] = sub("-fstack-protector-strong", "", vars[var])
2626
if not clang_has_option("-fno-semantic-interposition"):
2727
vars[var] = sub("-fno-semantic-interposition", "", vars[var])
28+
if not clang_has_option("-ffat-lto-objects"):
29+
vars[var] = sub("-ffat-lto-objects", "", vars[var])
2830

2931
from distutils.core import setup, Extension
3032

0 commit comments

Comments
 (0)