Re: [PATCH] perf python: Track linked libraries as extension dependencies
From: Arnaldo Carvalho de Melo
Date: Fri Oct 02 2026 - 12:19:08 EST
On Thu, Oct 01, 2026 at 09:25:02AM -0700, Ian Rogers wrote:
> On Thu, Oct 1, 2026 at 8:48 AM James Clark <james.clark@xxxxxxxxxx> wrote:
> >
> > Since the Python extension switched to linking perf libraries, setup.py
> > only lists util/python.c as a source. The libraries are supplied through
> > LDFLAGS, which setuptools does not consider when deciding whether the
> > extension needs to be rebuilt.
> >
> > When a library changes, make invokes setup.py, but setuptools can skip
> > the build and the recipe copies the stale cached extension back into
> > python/. This leaves perf and its Python module running different
> > versions of the same code.
> >
> > Pass the linked library paths to setup.py and declare them as Extension
> > dependencies so that library changes trigger a rebuild. Include
> > EXTRA_PERFLIBS in the shared library list so that both make and
> > setuptools track those inputs as well, preserving the existing linker
> > order.
> >
> > Fixes: 9dabf4003423 ("perf python: Switch module to linking libraries from building source")
> > Assisted-by: Codex:GPT-6-Astra
> > Signed-off-by: James Clark <james.clark@xxxxxxxxxx>
>
> Reviewed-by: Ian Rogers <irogers@xxxxxxxxxx>
git am complained, applied manually:
⬢ [acme@tb-x2-perf perf-tools-next]$ patch -p1 < ./20261001_james_clark_perf_python_track_linked_libraries_as_extension_dependencies.mbx
patching file tools/perf/Makefile.perf
Hunk #1 succeeded at 538 (offset 12 lines).
Hunk #2 succeeded at 571 with fuzz 1 (offset 12 lines).
patching file tools/perf/util/setup.py
⬢ [acme@tb-x2-perf perf-tools-next]$
- Arnaldo