aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/config
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2014-02-19 10:52:56 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-02-24 07:29:36 -0500
commit45757895c785e0a4c10afd5670cdc26cea2bbc97 (patch)
tree1c97c6d8f651a4ab316e124526a1def2e0efafd7 /tools/perf/config
parent7a0447d61d2d754988add992be2b46d4587ae86a (diff)
perf tools: Add feature check for libdw dwarf unwind
Adding feature check test code for libdw dwarf unwind. 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-4-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/config')
-rw-r--r--tools/perf/config/Makefile19
-rw-r--r--tools/perf/config/feature-checks/Makefile6
-rw-r--r--tools/perf/config/feature-checks/test-all.c5
-rw-r--r--tools/perf/config/feature-checks/test-libdw-dwarf-unwind.c13
4 files changed, 35 insertions, 8 deletions
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 9429805f395c..074fa618cc7b 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -59,6 +59,18 @@ ifeq ($(NO_PERF_REGS),0)
59 CFLAGS += -DHAVE_PERF_REGS_SUPPORT 59 CFLAGS += -DHAVE_PERF_REGS_SUPPORT
60endif 60endif
61 61
62ifndef NO_LIBELF
63 # for linking with debug library, run like:
64 # make DEBUG=1 LIBDW_DIR=/opt/libdw/
65 ifdef LIBDW_DIR
66 LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
67 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
68
69 FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
70 FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
71 endif
72endif
73
62# include ARCH specific config 74# include ARCH specific config
63-include $(src-perf)/arch/$(ARCH)/Makefile 75-include $(src-perf)/arch/$(ARCH)/Makefile
64 76
@@ -267,13 +279,6 @@ else
267 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); 279 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
268 endif 280 endif
269 else 281 else
270 # for linking with debug library, run like:
271 # make DEBUG=1 LIBDW_DIR=/opt/libdw/
272 ifdef LIBDW_DIR
273 LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
274 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
275 endif
276
277 ifneq ($(feature-dwarf), 1) 282 ifneq ($(feature-dwarf), 1)
278 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); 283 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);
279 NO_DWARF := 1 284 NO_DWARF := 1
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile
index 12e551346fa6..2b492f5480e2 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -26,7 +26,8 @@ FILES= \
26 test-libunwind-debug-frame.bin \ 26 test-libunwind-debug-frame.bin \
27 test-on-exit.bin \ 27 test-on-exit.bin \
28 test-stackprotector-all.bin \ 28 test-stackprotector-all.bin \
29 test-timerfd.bin 29 test-timerfd.bin \
30 test-libdw-dwarf-unwind.bin
30 31
31CC := $(CROSS_COMPILE)gcc -MD 32CC := $(CROSS_COMPILE)gcc -MD
32PKG_CONFIG := $(CROSS_COMPILE)pkg-config 33PKG_CONFIG := $(CROSS_COMPILE)pkg-config
@@ -141,6 +142,9 @@ test-backtrace.bin:
141test-timerfd.bin: 142test-timerfd.bin:
142 $(BUILD) 143 $(BUILD)
143 144
145test-libdw-dwarf-unwind.bin:
146 $(BUILD)
147
144-include *.d 148-include *.d
145 149
146############################### 150###############################
diff --git a/tools/perf/config/feature-checks/test-all.c b/tools/perf/config/feature-checks/test-all.c
index 9b8a544155bb..fc37eb3ca17b 100644
--- a/tools/perf/config/feature-checks/test-all.c
+++ b/tools/perf/config/feature-checks/test-all.c
@@ -89,6 +89,10 @@
89# include "test-stackprotector-all.c" 89# include "test-stackprotector-all.c"
90#undef main 90#undef main
91 91
92#define main main_test_libdw_dwarf_unwind
93# include "test-libdw-dwarf-unwind.c"
94#undef main
95
92int main(int argc, char *argv[]) 96int main(int argc, char *argv[])
93{ 97{
94 main_test_libpython(); 98 main_test_libpython();
@@ -111,6 +115,7 @@ int main(int argc, char *argv[])
111 main_test_libnuma(); 115 main_test_libnuma();
112 main_test_timerfd(); 116 main_test_timerfd();
113 main_test_stackprotector_all(); 117 main_test_stackprotector_all();
118 main_test_libdw_dwarf_unwind();
114 119
115 return 0; 120 return 0;
116} 121}
diff --git a/tools/perf/config/feature-checks/test-libdw-dwarf-unwind.c b/tools/perf/config/feature-checks/test-libdw-dwarf-unwind.c
new file mode 100644
index 000000000000..f676a3ff442a
--- /dev/null
+++ b/tools/perf/config/feature-checks/test-libdw-dwarf-unwind.c
@@ -0,0 +1,13 @@
1
2#include <elfutils/libdwfl.h>
3
4int main(void)
5{
6 /*
7 * This function is guarded via: __nonnull_attribute__ (1, 2).
8 * Passing '1' as arguments value. This code is never executed,
9 * only compiled.
10 */
11 dwfl_thread_getframes((void *) 1, (void *) 1, NULL);
12 return 0;
13}