[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAP-5=fXKLxo9VufpsvjNJ-Z+oA+6k7zYOz6qH69xSAiRA2K8zg@mail.gmail.com>
Date: Tue, 25 Jun 2024 11:14:42 -0700
From: Ian Rogers <irogers@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: James Clark <james.clark@....com>, Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, Arnaldo Carvalho de Melo <acme@...nel.org>, Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>, Kan Liang <kan.liang@...ux.intel.com>,
John Garry <john.g.garry@...cle.com>, Will Deacon <will@...nel.org>,
Mike Leach <mike.leach@...aro.org>, Leo Yan <leo.yan@...ux.dev>, Guo Ren <guoren@...nel.org>,
Paul Walmsley <paul.walmsley@...ive.com>, Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>, Suzuki K Poulose <suzuki.poulose@....com>,
Yicong Yang <yangyicong@...ilicon.com>, Jonathan Cameron <jonathan.cameron@...wei.com>,
Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...sung.com>,
Alice Ryhl <aliceryhl@...gle.com>, Nick Terrell <terrelln@...com>,
Ravi Bangoria <ravi.bangoria@....com>, Kees Cook <keescook@...omium.org>,
Andrei Vagin <avagin@...gle.com>, Athira Jajeev <atrajeev@...ux.vnet.ibm.com>,
Oliver Upton <oliver.upton@...ux.dev>, Ze Gao <zegao2021@...il.com>,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-csky@...r.kernel.org,
linux-riscv@...ts.infradead.org, coresight@...ts.linaro.org,
rust-for-linux@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH v3 7/8] perf python: Switch module to linking libraries
from building source
On Tue, Jun 25, 2024 at 10:48 AM Namhyung Kim <namhyung@...nel.org> wrote:
>
> Hello,
>
> On Tue, Jun 25, 2024 at 5:24 AM James Clark <james.clark@....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@...gle.com>
> > >> Reviewed-by: James Clark <james.clark@....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.
Will fix it in v2.
> > >
> > >
> > >> + # 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!
Even with a static build it is often the case that the executable is
position independent (-fPIE, and related compiler options) and so
would need this too.
Thanks,
Ian
> Namhyung
Powered by blists - more mailing lists