summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorStanislav Fomichev <sdf@google.com>2018-11-15 19:32:01 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-12-21 07:42:46 -0500
commit14541b1e7e723859ff2c75c6fc10cdbbec6b8c34 (patch)
tree31d881b0ea5ee36a68a161087fb9bd6c6019f330 /tools
parent5ce29d522e9b8cdc158329a8539bcd6206fc5bf4 (diff)
perf build: Don't unconditionally link the libbfd feature test to -liberty and -lz
Current libbfd feature test unconditionally links against -liberty and -lz. While it's required on some systems (e.g. opensuse), it's completely unnecessary on the others, where only -lbdf is sufficient (debian). This patch streamlines (and renames) the following feature checks: feature-libbfd - only link against -lbfd (debian), see commit 2cf9040714f3 ("perf tools: Fix bfd dependency libraries detection") feature-libbfd-liberty - link against -lbfd and -liberty feature-libbfd-liberty-z - link against -lbfd, -liberty and -lz (opensuse), see commit 280e7c48c3b8 ("perf tools: fix BFD detection on opensuse") (feature-liberty{,-z} were renamed to feature-libbfd-liberty{,z} for clarity) The main motivation is to fix this feature test for bpftool which is currently broken on debian (libbfd feature shows OFF, but we still unconditionally link against -lbfd and it works). Tested on debian with only -lbfd installed (without -liberty); I'd appreciate if somebody on the other systems can test this new detection method. Signed-off-by: Stanislav Fomichev <sdf@google.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/4dfc634cfcfb236883971b5107cf3c28ec8a31be.1542328222.git.sdf@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/build/Makefile.feature4
-rw-r--r--tools/build/feature/Makefile10
-rw-r--r--tools/perf/Makefile.config44
3 files changed, 30 insertions, 28 deletions
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index d47b8f73e2e7..5467c6bf9ceb 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -82,8 +82,8 @@ FEATURE_TESTS_EXTRA := \
82 cplus-demangle \ 82 cplus-demangle \
83 hello \ 83 hello \
84 libbabeltrace \ 84 libbabeltrace \
85 liberty \ 85 libbfd-liberty \
86 liberty-z \ 86 libbfd-liberty-z \
87 libunwind-debug-frame \ 87 libunwind-debug-frame \
88 libunwind-debug-frame-arm \ 88 libunwind-debug-frame-arm \
89 libunwind-debug-frame-aarch64 \ 89 libunwind-debug-frame-aarch64 \
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 2dbcc0d00f52..7ceb4441b627 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -17,8 +17,8 @@ FILES= \
17 test-libbfd.bin \ 17 test-libbfd.bin \
18 test-disassembler-four-args.bin \ 18 test-disassembler-four-args.bin \
19 test-reallocarray.bin \ 19 test-reallocarray.bin \
20 test-liberty.bin \ 20 test-libbfd-liberty.bin \
21 test-liberty-z.bin \ 21 test-libbfd-liberty-z.bin \
22 test-cplus-demangle.bin \ 22 test-cplus-demangle.bin \
23 test-libelf.bin \ 23 test-libelf.bin \
24 test-libelf-getphdrnum.bin \ 24 test-libelf-getphdrnum.bin \
@@ -210,7 +210,7 @@ $(OUTPUT)test-libpython-version.bin:
210 $(BUILD) 210 $(BUILD)
211 211
212$(OUTPUT)test-libbfd.bin: 212$(OUTPUT)test-libbfd.bin:
213 $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl 213 $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
214 214
215$(OUTPUT)test-disassembler-four-args.bin: 215$(OUTPUT)test-disassembler-four-args.bin:
216 $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes 216 $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
@@ -218,10 +218,10 @@ $(OUTPUT)test-disassembler-four-args.bin:
218$(OUTPUT)test-reallocarray.bin: 218$(OUTPUT)test-reallocarray.bin:
219 $(BUILD) 219 $(BUILD)
220 220
221$(OUTPUT)test-liberty.bin: 221$(OUTPUT)test-libbfd-liberty.bin:
222 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty 222 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
223 223
224$(OUTPUT)test-liberty-z.bin: 224$(OUTPUT)test-libbfd-liberty-z.bin:
225 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz 225 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
226 226
227$(OUTPUT)test-cplus-demangle.bin: 227$(OUTPUT)test-cplus-demangle.bin:
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 07c1857c3d7a..b441c88cafa1 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -702,18 +702,20 @@ endif
702 702
703ifeq ($(feature-libbfd), 1) 703ifeq ($(feature-libbfd), 1)
704 EXTLIBS += -lbfd 704 EXTLIBS += -lbfd
705else
706 # we are on a system that requires -liberty and (maybe) -lz
707 # to link against -lbfd; test each case individually here
705 708
706 # call all detections now so we get correct 709 # call all detections now so we get correct
707 # status in VF output 710 # status in VF output
708 $(call feature_check,liberty) 711 $(call feature_check,libbfd-liberty)
709 $(call feature_check,liberty-z) 712 $(call feature_check,libbfd-liberty-z)
710 $(call feature_check,cplus-demangle)
711 713
712 ifeq ($(feature-liberty), 1) 714 ifeq ($(feature-libbfd-liberty), 1)
713 EXTLIBS += -liberty 715 EXTLIBS += -lbfd -liberty
714 else 716 else
715 ifeq ($(feature-liberty-z), 1) 717 ifeq ($(feature-libbfd-liberty-z), 1)
716 EXTLIBS += -liberty -lz 718 EXTLIBS += -lbfd -liberty -lz
717 endif 719 endif
718 endif 720 endif
719endif 721endif
@@ -723,24 +725,24 @@ ifdef NO_DEMANGLE
723else 725else
724 ifdef HAVE_CPLUS_DEMANGLE_SUPPORT 726 ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
725 EXTLIBS += -liberty 727 EXTLIBS += -liberty
726 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
727 else 728 else
728 ifneq ($(feature-libbfd), 1) 729 ifeq ($(filter -liberty,$(EXTLIBS)),)
729 ifneq ($(feature-liberty), 1) 730 $(call feature_check,cplus-demangle)
730 ifneq ($(feature-liberty-z), 1) 731
731 # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT 732 # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
732 # or any of 'bfd iberty z' trinity 733 # or any of 'bfd iberty z' trinity
733 ifeq ($(feature-cplus-demangle), 1) 734 ifeq ($(feature-cplus-demangle), 1)
734 EXTLIBS += -liberty 735 EXTLIBS += -liberty
735 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT 736 else
736 else 737 msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling)
737 msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling) 738 CFLAGS += -DNO_DEMANGLE
738 CFLAGS += -DNO_DEMANGLE
739 endif
740 endif
741 endif 739 endif
742 endif 740 endif
743 endif 741 endif
742
743 ifneq ($(filter -liberty,$(EXTLIBS)),)
744 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
745 endif
744endif 746endif
745 747
746ifneq ($(filter -lbfd,$(EXTLIBS)),) 748ifneq ($(filter -lbfd,$(EXTLIBS)),)