diff options
author | Ingo Molnar <mingo@kernel.org> | 2013-09-30 08:45:44 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-10-09 02:48:39 -0400 |
commit | 058f952de9b3075cd888dc3cea60691db0ec4d3f (patch) | |
tree | fa3c6c60ad36cd206dc1cfac62e1da75abfc211f | |
parent | 308e1e700a1337b89c7530a4f4cdde5ccb52fb4e (diff) |
tools/perf/build: Split out feature check: 'libunwind'
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-vTiatsVyva3tfgh3vhxaidxl@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | tools/perf/config/Makefile | 13 | ||||
-rw-r--r-- | tools/perf/config/feature-checks/Makefile | 4 | ||||
-rw-r--r-- | tools/perf/config/feature-checks/test-libunwind.c | 20 |
3 files changed, 32 insertions, 5 deletions
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 0d7558790a02..d684a292536e 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
@@ -113,6 +113,7 @@ FEATURE_TESTS = \ | |||
113 | dwarf \ | 113 | dwarf \ |
114 | libelf-mmap \ | 114 | libelf-mmap \ |
115 | libelf-getphdrnum \ | 115 | libelf-getphdrnum \ |
116 | libunwind \ | ||
116 | libnuma | 117 | libnuma |
117 | 118 | ||
118 | $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test))) | 119 | $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test))) |
@@ -240,15 +241,17 @@ ifneq ($(ARCH),x86) | |||
240 | endif | 241 | endif |
241 | 242 | ||
242 | ifndef NO_LIBUNWIND | 243 | ifndef NO_LIBUNWIND |
243 | # for linking with debug library, run like: | 244 | # |
244 | # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ | 245 | # For linking with debug library, run like: |
246 | # | ||
247 | # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ | ||
248 | # | ||
245 | ifdef LIBUNWIND_DIR | 249 | ifdef LIBUNWIND_DIR |
246 | LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include | 250 | LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include |
247 | LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib | 251 | LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib |
248 | endif | 252 | endif |
249 | 253 | ||
250 | FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(CFLAGS) $(LIBUNWIND_LDFLAGS) $(LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS) | 254 | ifneq ($(feature-libunwind), 1) |
251 | ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y) | ||
252 | msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); | 255 | msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); |
253 | NO_LIBUNWIND := 1 | 256 | NO_LIBUNWIND := 1 |
254 | endif | 257 | endif |
@@ -259,7 +262,7 @@ ifndef NO_LIBUNWIND | |||
259 | EXTLIBS += $(LIBUNWIND_LIBS) | 262 | EXTLIBS += $(LIBUNWIND_LIBS) |
260 | CFLAGS += $(LIBUNWIND_CFLAGS) | 263 | CFLAGS += $(LIBUNWIND_CFLAGS) |
261 | LDFLAGS += $(LIBUNWIND_LDFLAGS) | 264 | LDFLAGS += $(LIBUNWIND_LDFLAGS) |
262 | endif # NO_LIBUNWIND | 265 | endif |
263 | 266 | ||
264 | ifndef NO_LIBAUDIT | 267 | ifndef NO_LIBAUDIT |
265 | FLAGS_LIBAUDIT = $(CFLAGS) $(LDFLAGS) -laudit | 268 | FLAGS_LIBAUDIT = $(CFLAGS) $(LDFLAGS) -laudit |
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile index 83b3a02b64d8..d6d9570a038f 100644 --- a/tools/perf/config/feature-checks/Makefile +++ b/tools/perf/config/feature-checks/Makefile | |||
@@ -11,6 +11,7 @@ FILES= \ | |||
11 | test-dwarf \ | 11 | test-dwarf \ |
12 | test-libelf-mmap \ | 12 | test-libelf-mmap \ |
13 | test-libelf-getphdrnum \ | 13 | test-libelf-getphdrnum \ |
14 | test-libunwind \ | ||
14 | test-libnuma | 15 | test-libnuma |
15 | 16 | ||
16 | CC := $(CC) -MD | 17 | CC := $(CC) -MD |
@@ -57,6 +58,9 @@ test-libelf-getphdrnum: | |||
57 | test-libnuma: | 58 | test-libnuma: |
58 | $(BUILD) -lnuma | 59 | $(BUILD) -lnuma |
59 | 60 | ||
61 | test-libunwind: | ||
62 | $(BUILD) -lunwind -lunwind-x86_64 -lelf | ||
63 | |||
60 | -include *.d */*.d | 64 | -include *.d */*.d |
61 | 65 | ||
62 | ############################### | 66 | ############################### |
diff --git a/tools/perf/config/feature-checks/test-libunwind.c b/tools/perf/config/feature-checks/test-libunwind.c new file mode 100644 index 000000000000..562274695c76 --- /dev/null +++ b/tools/perf/config/feature-checks/test-libunwind.c | |||
@@ -0,0 +1,20 @@ | |||
1 | #include <libunwind.h> | ||
2 | #include <stdlib.h> | ||
3 | |||
4 | extern int UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as, | ||
5 | unw_word_t ip, | ||
6 | unw_dyn_info_t *di, | ||
7 | unw_proc_info_t *pi, | ||
8 | int need_unwind_info, void *arg); | ||
9 | |||
10 | |||
11 | #define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table) | ||
12 | |||
13 | int main(void) | ||
14 | { | ||
15 | unw_addr_space_t addr_space; | ||
16 | addr_space = unw_create_addr_space(NULL, 0); | ||
17 | unw_init_remote(NULL, addr_space, NULL); | ||
18 | dwarf_search_unwind_table(addr_space, 0, NULL, NULL, 0, NULL); | ||
19 | return 0; | ||
20 | } | ||