diff options
-rw-r--r-- | tools/perf/Makefile | 57 | ||||
-rw-r--r-- | tools/perf/builtin-inject.c | 5 | ||||
-rw-r--r-- | tools/perf/command-list.txt | 2 | ||||
-rw-r--r-- | tools/perf/perf.c | 2 | ||||
-rwxr-xr-x | tools/perf/util/generate-cmdlist.sh | 15 | ||||
-rw-r--r-- | tools/perf/util/map.c | 3 | ||||
-rw-r--r-- | tools/perf/util/symbol-minimal.c | 39 |
7 files changed, 106 insertions, 17 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index f790e3bf14cb..de6aa8c706cf 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -37,7 +37,12 @@ include config/utilities.mak | |||
37 | # | 37 | # |
38 | # Define NO_NEWT if you do not want TUI support. | 38 | # Define NO_NEWT if you do not want TUI support. |
39 | # | 39 | # |
40 | # Define NO_GTK2 if you do not want GTK+ GUI support. | ||
41 | # | ||
40 | # Define NO_DEMANGLE if you do not want C++ symbol demangling. | 42 | # Define NO_DEMANGLE if you do not want C++ symbol demangling. |
43 | # | ||
44 | # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds) | ||
45 | # | ||
41 | 46 | ||
42 | $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE | 47 | $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE |
43 | @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) | 48 | @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) |
@@ -450,34 +455,57 @@ PYRF_OBJS += $(OUTPUT)util/xyarray.o | |||
450 | -include config.mak.autogen | 455 | -include config.mak.autogen |
451 | -include config.mak | 456 | -include config.mak |
452 | 457 | ||
453 | ifndef NO_DWARF | 458 | ifdef NO_LIBELF |
454 | FLAGS_DWARF=$(ALL_CFLAGS) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS) | ||
455 | ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF)),y) | ||
456 | 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); | ||
457 | NO_DWARF := 1 | 459 | NO_DWARF := 1 |
458 | endif # Dwarf support | 460 | NO_DEMANGLE := 1 |
459 | endif # NO_DWARF | 461 | else |
460 | |||
461 | -include arch/$(ARCH)/Makefile | ||
462 | |||
463 | ifneq ($(OUTPUT),) | ||
464 | BASIC_CFLAGS += -I$(OUTPUT) | ||
465 | endif | ||
466 | |||
467 | FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) | 462 | FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) |
468 | ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y) | 463 | ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y) |
469 | FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS) | 464 | FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS) |
470 | ifneq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC)),y) | 465 | ifneq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC)),y) |
471 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); | 466 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); |
472 | else | 467 | else |
473 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel); | 468 | NO_LIBELF := 1 |
469 | NO_DWARF := 1 | ||
470 | NO_DEMANGLE := 1 | ||
474 | endif | 471 | endif |
475 | endif | 472 | endif |
473 | endif # NO_LIBELF | ||
474 | |||
475 | -include arch/$(ARCH)/Makefile | ||
476 | |||
477 | ifneq ($(OUTPUT),) | ||
478 | BASIC_CFLAGS += -I$(OUTPUT) | ||
479 | endif | ||
480 | |||
481 | ifdef NO_LIBELF | ||
482 | BASIC_CFLAGS += -DNO_LIBELF_SUPPORT | ||
483 | |||
484 | EXTLIBS := $(filter-out -lelf,$(EXTLIBS)) | ||
485 | |||
486 | # Remove ELF/DWARF dependent codes | ||
487 | LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS)) | ||
488 | LIB_OBJS := $(filter-out $(OUTPUT)util/dwarf-aux.o,$(LIB_OBJS)) | ||
489 | LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS)) | ||
490 | LIB_OBJS := $(filter-out $(OUTPUT)util/probe-finder.o,$(LIB_OBJS)) | ||
491 | |||
492 | BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS)) | ||
493 | |||
494 | # Use minimal symbol handling | ||
495 | LIB_OBJS += $(OUTPUT)util/symbol-minimal.o | ||
496 | |||
497 | else # NO_LIBELF | ||
476 | 498 | ||
477 | ifneq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_COMMON)),y) | 499 | ifneq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_COMMON)),y) |
478 | BASIC_CFLAGS += -DLIBELF_NO_MMAP | 500 | BASIC_CFLAGS += -DLIBELF_NO_MMAP |
479 | endif | 501 | endif |
480 | 502 | ||
503 | FLAGS_DWARF=$(ALL_CFLAGS) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS) | ||
504 | ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF)),y) | ||
505 | 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); | ||
506 | NO_DWARF := 1 | ||
507 | endif # Dwarf support | ||
508 | |||
481 | ifndef NO_DWARF | 509 | ifndef NO_DWARF |
482 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) | 510 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) |
483 | msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); | 511 | msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); |
@@ -488,6 +516,7 @@ else | |||
488 | LIB_OBJS += $(OUTPUT)util/dwarf-aux.o | 516 | LIB_OBJS += $(OUTPUT)util/dwarf-aux.o |
489 | endif # PERF_HAVE_DWARF_REGS | 517 | endif # PERF_HAVE_DWARF_REGS |
490 | endif # NO_DWARF | 518 | endif # NO_DWARF |
519 | endif # NO_LIBELF | ||
491 | 520 | ||
492 | ifdef NO_NEWT | 521 | ifdef NO_NEWT |
493 | BASIC_CFLAGS += -DNO_NEWT_SUPPORT | 522 | BASIC_CFLAGS += -DNO_NEWT_SUPPORT |
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 3beab489afc5..64d8ba2fb7bc 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c | |||
@@ -191,10 +191,13 @@ static int perf_event__inject_buildid(struct perf_tool *tool, | |||
191 | * If this fails, too bad, let the other side | 191 | * If this fails, too bad, let the other side |
192 | * account this as unresolved. | 192 | * account this as unresolved. |
193 | */ | 193 | */ |
194 | } else | 194 | } else { |
195 | #ifndef NO_LIBELF_SUPPORT | ||
195 | pr_warning("no symbols found in %s, maybe " | 196 | pr_warning("no symbols found in %s, maybe " |
196 | "install a debug package?\n", | 197 | "install a debug package?\n", |
197 | al.map->dso->long_name); | 198 | al.map->dso->long_name); |
199 | #endif | ||
200 | } | ||
198 | } | 201 | } |
199 | } | 202 | } |
200 | 203 | ||
diff --git a/tools/perf/command-list.txt b/tools/perf/command-list.txt index d695fe40fbff..0303ec692274 100644 --- a/tools/perf/command-list.txt +++ b/tools/perf/command-list.txt | |||
@@ -18,7 +18,7 @@ perf-stat mainporcelain common | |||
18 | perf-timechart mainporcelain common | 18 | perf-timechart mainporcelain common |
19 | perf-top mainporcelain common | 19 | perf-top mainporcelain common |
20 | perf-script mainporcelain common | 20 | perf-script mainporcelain common |
21 | perf-probe mainporcelain common | 21 | perf-probe mainporcelain full |
22 | perf-kmem mainporcelain common | 22 | perf-kmem mainporcelain common |
23 | perf-lock mainporcelain common | 23 | perf-lock mainporcelain common |
24 | perf-kvm mainporcelain common | 24 | perf-kvm mainporcelain common |
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index db37ee3f29b8..e7840e500715 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
@@ -47,7 +47,9 @@ static struct cmd_struct commands[] = { | |||
47 | { "version", cmd_version, 0 }, | 47 | { "version", cmd_version, 0 }, |
48 | { "script", cmd_script, 0 }, | 48 | { "script", cmd_script, 0 }, |
49 | { "sched", cmd_sched, 0 }, | 49 | { "sched", cmd_sched, 0 }, |
50 | #ifndef NO_LIBELF_SUPPORT | ||
50 | { "probe", cmd_probe, 0 }, | 51 | { "probe", cmd_probe, 0 }, |
52 | #endif | ||
51 | { "kmem", cmd_kmem, 0 }, | 53 | { "kmem", cmd_kmem, 0 }, |
52 | { "lock", cmd_lock, 0 }, | 54 | { "lock", cmd_lock, 0 }, |
53 | { "kvm", cmd_kvm, 0 }, | 55 | { "kvm", cmd_kvm, 0 }, |
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh index f06f6fd148f8..389590c1ad21 100755 --- a/tools/perf/util/generate-cmdlist.sh +++ b/tools/perf/util/generate-cmdlist.sh | |||
@@ -21,4 +21,19 @@ do | |||
21 | p | 21 | p |
22 | }' "Documentation/perf-$cmd.txt" | 22 | }' "Documentation/perf-$cmd.txt" |
23 | done | 23 | done |
24 | |||
25 | echo "#ifndef NO_LIBELF_SUPPORT" | ||
26 | sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt | | ||
27 | sort | | ||
28 | while read cmd | ||
29 | do | ||
30 | sed -n ' | ||
31 | /^NAME/,/perf-'"$cmd"'/H | ||
32 | ${ | ||
33 | x | ||
34 | s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/ | ||
35 | p | ||
36 | }' "Documentation/perf-$cmd.txt" | ||
37 | done | ||
38 | echo "#endif /* NO_LIBELF_SUPPORT */" | ||
24 | echo "};" | 39 | echo "};" |
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index 115654c469c6..287cb3452b4b 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
@@ -156,6 +156,7 @@ int map__load(struct map *self, symbol_filter_t filter) | |||
156 | pr_warning(", continuing without symbols\n"); | 156 | pr_warning(", continuing without symbols\n"); |
157 | return -1; | 157 | return -1; |
158 | } else if (nr == 0) { | 158 | } else if (nr == 0) { |
159 | #ifndef NO_LIBELF_SUPPORT | ||
159 | const size_t len = strlen(name); | 160 | const size_t len = strlen(name); |
160 | const size_t real_len = len - sizeof(DSO__DELETED); | 161 | const size_t real_len = len - sizeof(DSO__DELETED); |
161 | 162 | ||
@@ -168,7 +169,7 @@ int map__load(struct map *self, symbol_filter_t filter) | |||
168 | pr_warning("no symbols found in %s, maybe install " | 169 | pr_warning("no symbols found in %s, maybe install " |
169 | "a debug package?\n", name); | 170 | "a debug package?\n", name); |
170 | } | 171 | } |
171 | 172 | #endif | |
172 | return -1; | 173 | return -1; |
173 | } | 174 | } |
174 | /* | 175 | /* |
diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c new file mode 100644 index 000000000000..416ecf3bccf5 --- /dev/null +++ b/tools/perf/util/symbol-minimal.c | |||
@@ -0,0 +1,39 @@ | |||
1 | #include "symbol.h" | ||
2 | |||
3 | |||
4 | int filename__read_build_id(const char *filename __used, void *bf __used, | ||
5 | size_t size __used) | ||
6 | { | ||
7 | return -1; | ||
8 | } | ||
9 | |||
10 | int sysfs__read_build_id(const char *filename __used, void *build_id __used, | ||
11 | size_t size __used) | ||
12 | { | ||
13 | return -1; | ||
14 | } | ||
15 | |||
16 | int filename__read_debuglink(const char *filename __used, | ||
17 | char *debuglink __used, size_t size __used) | ||
18 | { | ||
19 | return -1; | ||
20 | } | ||
21 | |||
22 | int dso__synthesize_plt_symbols(struct dso *dso __used, char *name __used, | ||
23 | struct map *map __used, | ||
24 | symbol_filter_t filter __used) | ||
25 | { | ||
26 | return 0; | ||
27 | } | ||
28 | |||
29 | int dso__load_sym(struct dso *dso __used, struct map *map __used, | ||
30 | const char *name __used, int fd __used, | ||
31 | symbol_filter_t filter __used, int kmodule __used, | ||
32 | int want_symtab __used) | ||
33 | { | ||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | void symbol__elf_init(void) | ||
38 | { | ||
39 | } | ||