diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2012-08-06 00:41:19 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-08-09 15:19:14 -0400 |
commit | 166ccc9c244828da9214a0e7ba4d5dde6a26dcc1 (patch) | |
tree | 3fbe7d7ff788ca17842ea0d5ccc4efe5a6becb62 | |
parent | b25085be457b4292a563c0bf2fab2ef5b7bb3c45 (diff) |
perf symbols: Introduce symbol__elf_init()
The symbol__elf_init() is for initializing internal libelf data
structure and getting rid of its dependency outside of ELF/symboling
handling code.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1344228082-15569-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-buildid-list.c | 4 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 8 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 1 |
3 files changed, 9 insertions, 4 deletions
diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c index 6b2bcfbde150..7d6842826a0c 100644 --- a/tools/perf/builtin-buildid-list.c +++ b/tools/perf/builtin-buildid-list.c | |||
@@ -16,8 +16,6 @@ | |||
16 | #include "util/session.h" | 16 | #include "util/session.h" |
17 | #include "util/symbol.h" | 17 | #include "util/symbol.h" |
18 | 18 | ||
19 | #include <libelf.h> | ||
20 | |||
21 | static const char *input_name; | 19 | static const char *input_name; |
22 | static bool force; | 20 | static bool force; |
23 | static bool show_kernel; | 21 | static bool show_kernel; |
@@ -71,7 +69,7 @@ static int perf_session__list_build_ids(void) | |||
71 | { | 69 | { |
72 | struct perf_session *session; | 70 | struct perf_session *session; |
73 | 71 | ||
74 | elf_version(EV_CURRENT); | 72 | symbol__elf_init(); |
75 | 73 | ||
76 | session = perf_session__new(input_name, O_RDONLY, force, false, | 74 | session = perf_session__new(input_name, O_RDONLY, force, false, |
77 | &build_id__mark_dso_hit_ops); | 75 | &build_id__mark_dso_hit_ops); |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 8b63b678e127..a61fec4518da 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1453,6 +1453,11 @@ out_close: | |||
1453 | return err; | 1453 | return err; |
1454 | } | 1454 | } |
1455 | 1455 | ||
1456 | void symbol__elf_init(void) | ||
1457 | { | ||
1458 | elf_version(EV_CURRENT); | ||
1459 | } | ||
1460 | |||
1456 | static bool dso__build_id_equal(const struct dso *dso, u8 *build_id) | 1461 | static bool dso__build_id_equal(const struct dso *dso, u8 *build_id) |
1457 | { | 1462 | { |
1458 | return memcmp(dso->build_id, build_id, sizeof(dso->build_id)) == 0; | 1463 | return memcmp(dso->build_id, build_id, sizeof(dso->build_id)) == 0; |
@@ -2754,7 +2759,8 @@ int symbol__init(void) | |||
2754 | 2759 | ||
2755 | symbol_conf.priv_size = ALIGN(symbol_conf.priv_size, sizeof(u64)); | 2760 | symbol_conf.priv_size = ALIGN(symbol_conf.priv_size, sizeof(u64)); |
2756 | 2761 | ||
2757 | elf_version(EV_CURRENT); | 2762 | symbol__elf_init(); |
2763 | |||
2758 | if (symbol_conf.sort_by_name) | 2764 | if (symbol_conf.sort_by_name) |
2759 | symbol_conf.priv_size += (sizeof(struct symbol_name_rb_node) - | 2765 | symbol_conf.priv_size += (sizeof(struct symbol_name_rb_node) - |
2760 | sizeof(struct symbol)); | 2766 | sizeof(struct symbol)); |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 1fe733a1e21f..355993d3abbf 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -309,6 +309,7 @@ void machines__destroy_guest_kernel_maps(struct rb_root *machines); | |||
309 | 309 | ||
310 | int symbol__init(void); | 310 | int symbol__init(void); |
311 | void symbol__exit(void); | 311 | void symbol__exit(void); |
312 | void symbol__elf_init(void); | ||
312 | size_t symbol__fprintf_symname_offs(const struct symbol *sym, | 313 | size_t symbol__fprintf_symname_offs(const struct symbol *sym, |
313 | const struct addr_location *al, FILE *fp); | 314 | const struct addr_location *al, FILE *fp); |
314 | size_t symbol__fprintf_symname(const struct symbol *sym, FILE *fp); | 315 | size_t symbol__fprintf_symname(const struct symbol *sym, FILE *fp); |