aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/config/Makefile
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2014-02-19 10:52:58 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-02-24 07:29:36 -0500
commit0a4f2b6a3ba5066947a8cbd7cfa26fb8a9280625 (patch)
treeda64b921c940b5fc6fc2354e2ffec4f22919a956 /tools/perf/config/Makefile
parent5ea8415407a76c4a85ac971ec82d110161cd77f1 (diff)
perf tools: Setup default dwarf post unwinder
Factor NO_LIBDW_DWARF_UNWIND makefile variable and code that selects default DWARf post unwinder based on detected features (libdw and libunwind support) If both are detected the libunwind is selected as default. Simple 'make' will try to add: - libunwind unwinder if present - libdw unwinder if present - disable dwarf unwind if non of libunwind and libdw libraries are present If one of the DWARF unwind libraries is detected, message is displayed which one (libunwind/libdw) is compiled in. Examples: - compile in libdw unwinder if present: $ make NO_LIBUNWIND=1 - compile in libdw (with libdw installation directory) unwinder if present: $ make LIBDW_DIR=/opt/elfutils/ NO_LIBUNWIND=1 BUILD: Doing 'make -j4' parallel build Auto-detecting system features: ... dwarf: [ on ] ... glibc: [ on ] ... gtk2: [ on ] ... libaudit: [ on ] ... libbfd: [ on ] ... libelf: [ on ] ... libnuma: [ on ] ... libperl: [ on ] ... libpython: [ on ] ... libslang: [ on ] ... libunwind: [ on ] ... libdw-dwarf-unwind: [ on ] ... DWARF post unwind library: libdw - disable post dwarf unwind completely: $ make NO_LIBUNWIND=1 NO_LIBDW_DWARF_UNWIND=1 BUILD: Doing 'make -j4' parallel build Auto-detecting system features: ... dwarf: [ on ] ... glibc: [ on ] ... gtk2: [ on ] ... libaudit: [ on ] ... libbfd: [ on ] ... libelf: [ on ] ... libnuma: [ on ] ... libperl: [ on ] ... libpython: [ on ] ... libslang: [ on ] ... libunwind: [ on ] ... libdw-dwarf-unwind: [ on ] ... DWARF post unwind library: libunwind Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jean Pihet <jean.pihet@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1392825179-5228-6-git-send-email-jolsa@redhat.com [ Add suggestion about setting LIBDW_DIR when not finding libdw ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/config/Makefile')
-rw-r--r--tools/perf/config/Makefile78
1 files changed, 61 insertions, 17 deletions
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index c040d8618793..f7c81d3e2422 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -159,7 +159,8 @@ CORE_FEATURE_TESTS = \
159 libunwind \ 159 libunwind \
160 on-exit \ 160 on-exit \
161 stackprotector-all \ 161 stackprotector-all \
162 timerfd 162 timerfd \
163 libdw-dwarf-unwind
163 164
164LIB_FEATURE_TESTS = \ 165LIB_FEATURE_TESTS = \
165 dwarf \ 166 dwarf \
@@ -172,7 +173,8 @@ LIB_FEATURE_TESTS = \
172 libperl \ 173 libperl \
173 libpython \ 174 libpython \
174 libslang \ 175 libslang \
175 libunwind 176 libunwind \
177 libdw-dwarf-unwind
176 178
177VF_FEATURE_TESTS = \ 179VF_FEATURE_TESTS = \
178 backtrace \ 180 backtrace \
@@ -280,6 +282,12 @@ else
280 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); 282 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
281 endif 283 endif
282 else 284 else
285 ifndef NO_LIBDW_DWARF_UNWIND
286 ifneq ($(feature-libdw-dwarf-unwind),1)
287 NO_LIBDW_DWARF_UNWIND := 1
288 msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR);
289 endif
290 endif
283 ifneq ($(feature-dwarf), 1) 291 ifneq ($(feature-dwarf), 1)
284 msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev); 292 msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
285 NO_DWARF := 1 293 NO_DWARF := 1
@@ -315,25 +323,51 @@ endif # NO_LIBELF
315 323
316ifndef NO_LIBUNWIND 324ifndef NO_LIBUNWIND
317 ifneq ($(feature-libunwind), 1) 325 ifneq ($(feature-libunwind), 1)
318 msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR); 326 msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
319 NO_LIBUNWIND := 1 327 NO_LIBUNWIND := 1
328 endif
329endif
330
331dwarf-post-unwind := 1
332dwarf-post-unwind-text := BUG
333
334# setup DWARF post unwinder
335ifdef NO_LIBUNWIND
336 ifdef NO_LIBDW_DWARF_UNWIND
337 msg := $(warning Disabling post unwind, no support found.);
338 dwarf-post-unwind := 0
320 else 339 else
321 ifeq ($(ARCH),arm) 340 dwarf-post-unwind-text := libdw
322 $(call feature_check,libunwind-debug-frame) 341 endif
323 ifneq ($(feature-libunwind-debug-frame), 1) 342else
324 msg := $(warning No debug_frame support found in libunwind); 343 dwarf-post-unwind-text := libunwind
325 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME 344 # Enable libunwind support by default.
326 endif 345 ifndef NO_LIBDW_DWARF_UNWIND
327 else 346 NO_LIBDW_DWARF_UNWIND := 1
328 # non-ARM has no dwarf_find_debug_frame() function: 347 endif
348endif
349
350ifeq ($(dwarf-post-unwind),1)
351 CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
352else
353 NO_DWARF_UNWIND := 1
354endif
355
356ifndef NO_LIBUNWIND
357 ifeq ($(ARCH),arm)
358 $(call feature_check,libunwind-debug-frame)
359 ifneq ($(feature-libunwind-debug-frame), 1)
360 msg := $(warning No debug_frame support found in libunwind);
329 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME 361 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
330 endif 362 endif
331 363 else
332 CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT -DHAVE_LIBUNWIND_SUPPORT 364 # non-ARM has no dwarf_find_debug_frame() function:
333 EXTLIBS += $(LIBUNWIND_LIBS) 365 CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
334 CFLAGS += $(LIBUNWIND_CFLAGS) 366 endif
335 LDFLAGS += $(LIBUNWIND_LDFLAGS) 367 CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
336 endif # ifneq ($(feature-libunwind), 1) 368 EXTLIBS += $(LIBUNWIND_LIBS)
369 CFLAGS += $(LIBUNWIND_CFLAGS)
370 LDFLAGS += $(LIBUNWIND_LDFLAGS)
337endif 371endif
338 372
339ifndef NO_LIBAUDIT 373ifndef NO_LIBAUDIT
@@ -620,6 +654,10 @@ endef
620PERF_FEATURES := $(foreach feat,$(LIB_FEATURE_TESTS),feature-$(feat)($(feature-$(feat)))) 654PERF_FEATURES := $(foreach feat,$(LIB_FEATURE_TESTS),feature-$(feat)($(feature-$(feat))))
621PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES) 655PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES)
622 656
657ifeq ($(dwarf-post-unwind),1)
658 PERF_FEATURES += dwarf-post-unwind($(dwarf-post-unwind-text))
659endif
660
623# The $(display_lib) controls the default detection message 661# The $(display_lib) controls the default detection message
624# output. It's set if: 662# output. It's set if:
625# - detected features differes from stored features from 663# - detected features differes from stored features from
@@ -650,6 +688,10 @@ ifeq ($(display_lib),1)
650 $(info ) 688 $(info )
651 $(info Auto-detecting system features:) 689 $(info Auto-detecting system features:)
652 $(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_print_status,$(feat),)) 690 $(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_print_status,$(feat),))
691
692 ifeq ($(dwarf-post-unwind),1)
693 $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text))
694 endif
653endif 695endif
654 696
655ifeq ($(display_vf),1) 697ifeq ($(display_vf),1)
@@ -659,6 +701,8 @@ ifeq ($(display_vf),1)
659 $(call feature_print_var,bindir) 701 $(call feature_print_var,bindir)
660 $(call feature_print_var,libdir) 702 $(call feature_print_var,libdir)
661 $(call feature_print_var,sysconfdir) 703 $(call feature_print_var,sysconfdir)
704 $(call feature_print_var,LIBUNWIND_DIR)
705 $(call feature_print_var,LIBDW_DIR)
662endif 706endif
663 707
664ifeq ($(display_lib),1) 708ifeq ($(display_lib),1)