diff options
author | Jiri Olsa <jolsa@redhat.com> | 2014-02-19 10:52:58 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-02-24 07:29:36 -0500 |
commit | 0a4f2b6a3ba5066947a8cbd7cfa26fb8a9280625 (patch) | |
tree | da64b921c940b5fc6fc2354e2ffec4f22919a956 /tools | |
parent | 5ea8415407a76c4a85ac971ec82d110161cd77f1 (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')
-rw-r--r-- | tools/perf/Makefile.perf | 5 | ||||
-rw-r--r-- | tools/perf/arch/x86/Makefile | 6 | ||||
-rw-r--r-- | tools/perf/config/Makefile | 78 |
3 files changed, 66 insertions, 23 deletions
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 2dff0b8ed611..1f7ec48ac959 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
@@ -61,9 +61,6 @@ include config/utilities.mak | |||
61 | # Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support | 61 | # Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support |
62 | # for dwarf backtrace post unwind. | 62 | # for dwarf backtrace post unwind. |
63 | 63 | ||
64 | # temporarily disabled | ||
65 | NO_LIBDW_DWARF_UNWIND := 1 | ||
66 | |||
67 | ifeq ($(srctree),) | 64 | ifeq ($(srctree),) |
68 | srctree := $(patsubst %/,%,$(dir $(shell pwd))) | 65 | srctree := $(patsubst %/,%,$(dir $(shell pwd))) |
69 | srctree := $(patsubst %/,%,$(dir $(srctree))) | 66 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
@@ -412,7 +409,7 @@ endif | |||
412 | LIB_OBJS += $(OUTPUT)tests/code-reading.o | 409 | LIB_OBJS += $(OUTPUT)tests/code-reading.o |
413 | LIB_OBJS += $(OUTPUT)tests/sample-parsing.o | 410 | LIB_OBJS += $(OUTPUT)tests/sample-parsing.o |
414 | LIB_OBJS += $(OUTPUT)tests/parse-no-sample-id-all.o | 411 | LIB_OBJS += $(OUTPUT)tests/parse-no-sample-id-all.o |
415 | ifndef NO_LIBUNWIND | 412 | ifndef NO_DWARF_UNWIND |
416 | ifeq ($(ARCH),x86) | 413 | ifeq ($(ARCH),x86) |
417 | LIB_OBJS += $(OUTPUT)tests/dwarf-unwind.o | 414 | LIB_OBJS += $(OUTPUT)tests/dwarf-unwind.o |
418 | endif | 415 | endif |
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile index 37c4652cc48a..1641542e3636 100644 --- a/tools/perf/arch/x86/Makefile +++ b/tools/perf/arch/x86/Makefile | |||
@@ -4,12 +4,14 @@ LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o | |||
4 | endif | 4 | endif |
5 | ifndef NO_LIBUNWIND | 5 | ifndef NO_LIBUNWIND |
6 | LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o | 6 | LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o |
7 | LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o | ||
8 | LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o | ||
9 | endif | 7 | endif |
10 | ifndef NO_LIBDW_DWARF_UNWIND | 8 | ifndef NO_LIBDW_DWARF_UNWIND |
11 | LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o | 9 | LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o |
12 | endif | 10 | endif |
11 | ifndef NO_DWARF_UNWIND | ||
12 | LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o | ||
13 | LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o | ||
14 | endif | ||
13 | LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o | 15 | LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o |
14 | LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/tsc.o | 16 | LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/tsc.o |
15 | LIB_H += arch/$(ARCH)/util/tsc.h | 17 | LIB_H += arch/$(ARCH)/util/tsc.h |
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 | ||
164 | LIB_FEATURE_TESTS = \ | 165 | LIB_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 | ||
177 | VF_FEATURE_TESTS = \ | 179 | VF_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 | ||
316 | ifndef NO_LIBUNWIND | 324 | ifndef 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 | ||
329 | endif | ||
330 | |||
331 | dwarf-post-unwind := 1 | ||
332 | dwarf-post-unwind-text := BUG | ||
333 | |||
334 | # setup DWARF post unwinder | ||
335 | ifdef 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) | 342 | else |
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 |
348 | endif | ||
349 | |||
350 | ifeq ($(dwarf-post-unwind),1) | ||
351 | CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT | ||
352 | else | ||
353 | NO_DWARF_UNWIND := 1 | ||
354 | endif | ||
355 | |||
356 | ifndef 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) | ||
337 | endif | 371 | endif |
338 | 372 | ||
339 | ifndef NO_LIBAUDIT | 373 | ifndef NO_LIBAUDIT |
@@ -620,6 +654,10 @@ endef | |||
620 | PERF_FEATURES := $(foreach feat,$(LIB_FEATURE_TESTS),feature-$(feat)($(feature-$(feat)))) | 654 | PERF_FEATURES := $(foreach feat,$(LIB_FEATURE_TESTS),feature-$(feat)($(feature-$(feat)))) |
621 | PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES) | 655 | PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES) |
622 | 656 | ||
657 | ifeq ($(dwarf-post-unwind),1) | ||
658 | PERF_FEATURES += dwarf-post-unwind($(dwarf-post-unwind-text)) | ||
659 | endif | ||
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 | ||
653 | endif | 695 | endif |
654 | 696 | ||
655 | ifeq ($(display_vf),1) | 697 | ifeq ($(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) | ||
662 | endif | 706 | endif |
663 | 707 | ||
664 | ifeq ($(display_lib),1) | 708 | ifeq ($(display_lib),1) |