1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

perf build: Make binutil libraries opt in

binutils is GPLv3 so distributions cannot ship perf linked against
libbfd and libiberty as the licenses are incompatible. Rather than
defaulting the build to opting in to libbfd and libiberty support and
opting out via NO_LIBBFD=1 and NO_DEMANGLE=1, make building against
the libraries optional and enabled with BUILD_NONDISTRO=1.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Martin Liška <mliska@suse.cz>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Cc: Roberto Sassu <roberto.sassu@huawei.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Tom Rix <trix@redhat.com>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: llvm@lists.linux.dev
Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Ian Rogers 2023-03-10 22:57:47 -08:00 committed by Arnaldo Carvalho de Melo
parent 175f9315f7
commit dd317df072
3 changed files with 14 additions and 15 deletions

View file

@ -890,7 +890,7 @@ ifneq ($(NO_JEVENTS),1)
endif endif
endif endif
ifndef NO_LIBBFD ifdef BUILD_NONDISTRO
ifeq ($(feature-libbfd), 1) ifeq ($(feature-libbfd), 1)
EXTLIBS += -lbfd -lopcodes EXTLIBS += -lbfd -lopcodes
else else
@ -913,6 +913,7 @@ ifndef NO_LIBBFD
$(call feature_check,disassembler-init-styled) $(call feature_check,disassembler-init-styled)
endif endif
CFLAGS += -DHAVE_LIBBFD_SUPPORT
ifeq ($(feature-libbfd-buildid), 1) ifeq ($(feature-libbfd-buildid), 1)
CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT
else else
@ -923,32 +924,26 @@ endif
ifdef NO_DEMANGLE ifdef NO_DEMANGLE
CFLAGS += -DNO_DEMANGLE CFLAGS += -DNO_DEMANGLE
else else
ifdef HAVE_CPLUS_DEMANGLE_SUPPORT ifdef BUILD_NONDISTRO
EXTLIBS += -liberty
else
ifeq ($(filter -liberty,$(EXTLIBS)),) ifeq ($(filter -liberty,$(EXTLIBS)),)
$(call feature_check,cplus-demangle) ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
# we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
# or any of 'bfd iberty z' trinity
ifeq ($(feature-cplus-demangle), 1)
EXTLIBS += -liberty EXTLIBS += -liberty
else else
msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling) $(call feature_check,cplus-demangle)
CFLAGS += -DNO_DEMANGLE ifeq ($(feature-cplus-demangle), 1)
EXTLIBS += -liberty
endif
endif endif
endif endif
endif endif
ifneq ($(filter -liberty,$(EXTLIBS)),) ifneq ($(filter -liberty,$(EXTLIBS)),)
CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
else
CFLAGS += -DNO_DEMANGLE
endif endif
endif endif
ifneq ($(filter -lbfd,$(EXTLIBS)),)
CFLAGS += -DHAVE_LIBBFD_SUPPORT
endif
ifndef NO_ZLIB ifndef NO_ZLIB
ifeq ($(feature-zlib), 1) ifeq ($(feature-zlib), 1)
CFLAGS += -DHAVE_ZLIB_SUPPORT CFLAGS += -DHAVE_ZLIB_SUPPORT

View file

@ -128,6 +128,8 @@ include ../scripts/utilities.mak
# #
# Define NO_BPF_SKEL to disable BPF skeletons # Define NO_BPF_SKEL to disable BPF skeletons
# #
# Define BUILD_NONDISTRO to enable building an linking against libbfd and
# libiberty distribution license incompatible libraries.
# As per kernel Makefile, avoid funny character set dependencies # As per kernel Makefile, avoid funny character set dependencies
unexport LC_ALL unexport LC_ALL

View file

@ -68,6 +68,7 @@ python_perf_so := $(shell $(MAKE) python_perf_target|grep "Target is:"|awk '{pri
make_clean_all := clean all make_clean_all := clean all
make_python_perf_so := $(python_perf_so) make_python_perf_so := $(python_perf_so)
make_debug := DEBUG=1 make_debug := DEBUG=1
make_nondistro := BUILD_NONDISTRO=1
make_no_libperl := NO_LIBPERL=1 make_no_libperl := NO_LIBPERL=1
make_no_libpython := NO_LIBPYTHON=1 make_no_libpython := NO_LIBPYTHON=1
make_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1 make_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1
@ -134,6 +135,7 @@ MAKE_F := $(MAKE) -f $(MK)
endif endif
run += make_python_perf_so run += make_python_perf_so
run += make_debug run += make_debug
run += make_nondistro
run += make_no_libperl run += make_no_libperl
run += make_no_libpython run += make_no_libpython
run += make_no_scripts run += make_no_scripts