diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-04-05 10:33:41 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-04-06 09:44:28 -0400 |
commit | bd0419e2a5a9fd9396cb7dc69044f961f52e19f0 (patch) | |
tree | 423dfe14e53f53206ce4e07006c417322ac8ff5f /tools/build | |
parent | d8e28654f28de74951ab1b7e59d2bebb442972aa (diff) |
perf probe: Check if dwarf_getlocations() is available
If not, tell the user that:
config/Makefile:273: Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157
And return -ENOTSUPP in die_get_var_range(), failing features that
need it, like the one pointed out above.
This fixes the build on older systems, such as Ubuntu 12.04.5.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Vinson Lee <vlee@freedesktop.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-9l7luqkq4gfnx7vrklkq4obs@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/build')
-rw-r--r-- | tools/build/Makefile.feature | 2 | ||||
-rw-r--r-- | tools/build/feature/Makefile | 4 | ||||
-rw-r--r-- | tools/build/feature/test-all.c | 5 | ||||
-rw-r--r-- | tools/build/feature/test-dwarf_getlocations.c | 12 |
4 files changed, 23 insertions, 0 deletions
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index 6b7707270aa3..9f878619077a 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature | |||
@@ -30,6 +30,7 @@ endef | |||
30 | FEATURE_TESTS_BASIC := \ | 30 | FEATURE_TESTS_BASIC := \ |
31 | backtrace \ | 31 | backtrace \ |
32 | dwarf \ | 32 | dwarf \ |
33 | dwarf_getlocations \ | ||
33 | fortify-source \ | 34 | fortify-source \ |
34 | sync-compare-and-swap \ | 35 | sync-compare-and-swap \ |
35 | glibc \ | 36 | glibc \ |
@@ -78,6 +79,7 @@ endif | |||
78 | 79 | ||
79 | FEATURE_DISPLAY ?= \ | 80 | FEATURE_DISPLAY ?= \ |
80 | dwarf \ | 81 | dwarf \ |
82 | dwarf_getlocations \ | ||
81 | glibc \ | 83 | glibc \ |
82 | gtk2 \ | 84 | gtk2 \ |
83 | libaudit \ | 85 | libaudit \ |
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index c5f4c417428d..4ae94dbfdab9 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile | |||
@@ -3,6 +3,7 @@ FILES= \ | |||
3 | test-backtrace.bin \ | 3 | test-backtrace.bin \ |
4 | test-bionic.bin \ | 4 | test-bionic.bin \ |
5 | test-dwarf.bin \ | 5 | test-dwarf.bin \ |
6 | test-dwarf_getlocations.bin \ | ||
6 | test-fortify-source.bin \ | 7 | test-fortify-source.bin \ |
7 | test-sync-compare-and-swap.bin \ | 8 | test-sync-compare-and-swap.bin \ |
8 | test-glibc.bin \ | 9 | test-glibc.bin \ |
@@ -82,6 +83,9 @@ endif | |||
82 | $(OUTPUT)test-dwarf.bin: | 83 | $(OUTPUT)test-dwarf.bin: |
83 | $(BUILD) $(DWARFLIBS) | 84 | $(BUILD) $(DWARFLIBS) |
84 | 85 | ||
86 | $(OUTPUT)test-dwarf_getlocations.bin: | ||
87 | $(BUILD) $(DWARFLIBS) | ||
88 | |||
85 | $(OUTPUT)test-libelf-mmap.bin: | 89 | $(OUTPUT)test-libelf-mmap.bin: |
86 | $(BUILD) -lelf | 90 | $(BUILD) -lelf |
87 | 91 | ||
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c index e499a36c1e4a..a282e8cb84f3 100644 --- a/tools/build/feature/test-all.c +++ b/tools/build/feature/test-all.c | |||
@@ -41,6 +41,10 @@ | |||
41 | # include "test-dwarf.c" | 41 | # include "test-dwarf.c" |
42 | #undef main | 42 | #undef main |
43 | 43 | ||
44 | #define main main_test_dwarf_getlocations | ||
45 | # include "test-dwarf_getlocations.c" | ||
46 | #undef main | ||
47 | |||
44 | #define main main_test_libelf_getphdrnum | 48 | #define main main_test_libelf_getphdrnum |
45 | # include "test-libelf-getphdrnum.c" | 49 | # include "test-libelf-getphdrnum.c" |
46 | #undef main | 50 | #undef main |
@@ -143,6 +147,7 @@ int main(int argc, char *argv[]) | |||
143 | main_test_libelf_mmap(); | 147 | main_test_libelf_mmap(); |
144 | main_test_glibc(); | 148 | main_test_glibc(); |
145 | main_test_dwarf(); | 149 | main_test_dwarf(); |
150 | main_test_dwarf_getlocations(); | ||
146 | main_test_libelf_getphdrnum(); | 151 | main_test_libelf_getphdrnum(); |
147 | main_test_libunwind(); | 152 | main_test_libunwind(); |
148 | main_test_libaudit(); | 153 | main_test_libaudit(); |
diff --git a/tools/build/feature/test-dwarf_getlocations.c b/tools/build/feature/test-dwarf_getlocations.c new file mode 100644 index 000000000000..70162699dd43 --- /dev/null +++ b/tools/build/feature/test-dwarf_getlocations.c | |||
@@ -0,0 +1,12 @@ | |||
1 | #include <stdlib.h> | ||
2 | #include <elfutils/libdw.h> | ||
3 | |||
4 | int main(void) | ||
5 | { | ||
6 | Dwarf_Addr base, start, end; | ||
7 | Dwarf_Attribute attr; | ||
8 | Dwarf_Op *op; | ||
9 | size_t nops; | ||
10 | ptrdiff_t offset = 0; | ||
11 | return (int)dwarf_getlocations(&attr, offset, &base, &start, &end, &op, &nops); | ||
12 | } | ||