Skip to content

Commit

Permalink
perf symbols: Introduce symbol__elf_init()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed Aug 9, 2012
1 parent b25085b commit 166ccc9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 1 addition & 3 deletions tools/perf/builtin-buildid-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
#include "util/session.h"
#include "util/symbol.h"

#include <libelf.h>

static const char *input_name;
static bool force;
static bool show_kernel;
Expand Down Expand Up @@ -71,7 +69,7 @@ static int perf_session__list_build_ids(void)
{
struct perf_session *session;

elf_version(EV_CURRENT);
symbol__elf_init();

session = perf_session__new(input_name, O_RDONLY, force, false,
&build_id__mark_dso_hit_ops);
Expand Down
8 changes: 7 additions & 1 deletion tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,11 @@ static int dso__load_sym(struct dso *dso, struct map *map, const char *name,
return err;
}

void symbol__elf_init(void)
{
elf_version(EV_CURRENT);
}

static bool dso__build_id_equal(const struct dso *dso, u8 *build_id)
{
return memcmp(dso->build_id, build_id, sizeof(dso->build_id)) == 0;
Expand Down Expand Up @@ -2754,7 +2759,8 @@ int symbol__init(void)

symbol_conf.priv_size = ALIGN(symbol_conf.priv_size, sizeof(u64));

elf_version(EV_CURRENT);
symbol__elf_init();

if (symbol_conf.sort_by_name)
symbol_conf.priv_size += (sizeof(struct symbol_name_rb_node) -
sizeof(struct symbol));
Expand Down
1 change: 1 addition & 0 deletions tools/perf/util/symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ void machines__destroy_guest_kernel_maps(struct rb_root *machines);

int symbol__init(void);
void symbol__exit(void);
void symbol__elf_init(void);
size_t symbol__fprintf_symname_offs(const struct symbol *sym,
const struct addr_location *al, FILE *fp);
size_t symbol__fprintf_symname(const struct symbol *sym, FILE *fp);
Expand Down

0 comments on commit 166ccc9

Please sign in to comment.