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@xxxxxxxxxx> >> Reviewed-by: James Clark <james.clark@xxxxxxx> >> --- >> 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. > >> endif >> endif >> endif