[PATCH v3 7/8] perf python: Switch module to linking libraries from building source

Namhyung Kim namhyung at kernel.org
Tue Jun 25 10:48:06 PDT 2024


Hello,

On Tue, Jun 25, 2024 at 5:24 AM James Clark <james.clark at arm.com> wrote:
>
>
>
> On 24/06/2024 23:26, Namhyung Kim wrote:
> > On Thu, Jun 13, 2024 at 04:31:21PM -0700, Ian Rogers wrote:
> >> setup.py was building most perf sources causing setup.py to mimic the
> >> Makefile logic as well as flex/bison code to be stubbed out, due to
> >> complexity building. By using libraries fewer functions are stubbed
> >> out, the build is faster and the Makefile logic is reused which should
> >> simplify updating. The libraries are passed through LDFLAGS to avoid
> >> complexity in python.
> >>
> >> Force the -fPIC flag for libbpf.a to ensure it is suitable for linking
> >> into the perf python module.
> >>
> >> Signed-off-by: Ian Rogers <irogers at google.com>
> >> Reviewed-by: James Clark <james.clark at arm.com>
> >> ---
> >>  tools/perf/Makefile.config |   5 +
> >>  tools/perf/Makefile.perf   |   6 +-
> >>  tools/perf/util/python.c   | 271 ++++++++++++++-----------------------
> >>  tools/perf/util/setup.py   |  33 +----
> >>  4 files changed, 110 insertions(+), 205 deletions(-)
> >>
> >> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> >> index 7f1e016a9253..639be696f597 100644
> >> --- a/tools/perf/Makefile.config
> >> +++ b/tools/perf/Makefile.config
> >> @@ -910,6 +910,11 @@ else
> >>           endif
> >>           CFLAGS += -DHAVE_LIBPYTHON_SUPPORT
> >>           $(call detected,CONFIG_LIBPYTHON)
> >> +     ifeq ($(filter -fPIC,$(CFLAGS)),)
> >
> > Nitpick: mixed TAB and SPACEs.
> >
> >
> >> +           # Building a shared library requires position independent code.
> >> +           CFLAGS += -fPIC
> >> +           CXXFLAGS += -fPIC
> >> +         endif
> >
> >
> > I'm curious if it's ok for static libraries too..
> >
> > Thanks,
> > Namhyung
> >
>
> I think I tested the whole set with a static build so it should be ok.

Ok, thanks for checking that!

Namhyung



More information about the linux-riscv mailing list