Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Add an option to build without libbfd

Some distributions, like debian, don't link perf with libbfd. Add a
build flag to make this configuration buildable and testable.

This was inspired by:

https://lore.kernel.org/linux-perf-users/20210910102307.2055484-1-tonyg@leastfixedpoint.com/T/#u

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: tony garnock-jones <tonyg@leastfixedpoint.com>
Link: http://lore.kernel.org/lkml/20210910225756.729087-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
0d1c50ac 4a86d414

+27 -24
+27 -24
tools/perf/Makefile.config
··· 827 827 endif 828 828 endif 829 829 830 - ifeq ($(feature-libbfd), 1) 831 - EXTLIBS += -lbfd -lopcodes 832 - else 833 - # we are on a system that requires -liberty and (maybe) -lz 834 - # to link against -lbfd; test each case individually here 835 830 836 - # call all detections now so we get correct 837 - # status in VF output 838 - $(call feature_check,libbfd-liberty) 839 - $(call feature_check,libbfd-liberty-z) 840 - 841 - ifeq ($(feature-libbfd-liberty), 1) 842 - EXTLIBS += -lbfd -lopcodes -liberty 843 - FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl 831 + ifndef NO_LIBBFD 832 + ifeq ($(feature-libbfd), 1) 833 + EXTLIBS += -lbfd -lopcodes 844 834 else 845 - ifeq ($(feature-libbfd-liberty-z), 1) 846 - EXTLIBS += -lbfd -lopcodes -liberty -lz 847 - FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl 848 - endif 849 - endif 850 - $(call feature_check,disassembler-four-args) 851 - endif 835 + # we are on a system that requires -liberty and (maybe) -lz 836 + # to link against -lbfd; test each case individually here 852 837 853 - ifeq ($(feature-libbfd-buildid), 1) 854 - CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT 855 - else 856 - msg := $(warning Old version of libbfd/binutils things like PE executable profiling will not be available); 838 + # call all detections now so we get correct 839 + # status in VF output 840 + $(call feature_check,libbfd-liberty) 841 + $(call feature_check,libbfd-liberty-z) 842 + 843 + ifeq ($(feature-libbfd-liberty), 1) 844 + EXTLIBS += -lbfd -lopcodes -liberty 845 + FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl 846 + else 847 + ifeq ($(feature-libbfd-liberty-z), 1) 848 + EXTLIBS += -lbfd -lopcodes -liberty -lz 849 + FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl 850 + endif 851 + endif 852 + $(call feature_check,disassembler-four-args) 853 + endif 854 + 855 + ifeq ($(feature-libbfd-buildid), 1) 856 + CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT 857 + else 858 + msg := $(warning Old version of libbfd/binutils things like PE executable profiling will not be available); 859 + endif 857 860 endif 858 861 859 862 ifdef NO_DEMANGLE