From 2584df633553c939c8f37c0150cca201da903239 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 1 Apr 2009 11:38:37 -0300 Subject: [PATCH] ctf_loader: Fill in the binding information for variables and functions Using elf_sym__bind, i.e. Elf_Sym->st_info bind subfield. Signed-off-by: Arnaldo Carvalho de Melo --- ctf_loader.c | 3 ++- elf_symtab.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ctf_loader.c b/ctf_loader.c index 839a664..9fbe3c3 100644 --- a/ctf_loader.c +++ b/ctf_loader.c @@ -93,6 +93,7 @@ static struct function *function__new(uint16_t **ptr, GElf_Sym *sym, /* FIXME: should use the .strtab string */ self->name = strings__add(strings, name); self->vtable_entry = -1; + self->external = elf_sym__bind(sym) == STB_GLOBAL; INIT_LIST_HEAD(&self->vtable_node); INIT_LIST_HEAD(&self->tool_node); INIT_LIST_HEAD(&self->lexblock.tags); @@ -575,7 +576,7 @@ static struct variable *variable__new(uint16_t type, GElf_Sym *sym, self->addr = elf_sym__value(sym); /* FIXME: should use the .strtab string */ self->name = strings__add(strings, name); - self->external = 1; + self->external = elf_sym__bind(sym) == STB_GLOBAL; self->tag.tag = DW_TAG_variable; self->tag.type = type; long id = -1; /* FIXME: not needed for variables... */ diff --git a/elf_symtab.h b/elf_symtab.h index a2d456b..a93a53a 100644 --- a/elf_symtab.h +++ b/elf_symtab.h @@ -40,6 +40,11 @@ static inline uint8_t elf_sym__type(const GElf_Sym *sym) return GELF_ST_TYPE(sym->st_info); } +static inline uint8_t elf_sym__bind(const GElf_Sym *sym) +{ + return GELF_ST_BIND(sym->st_info); +} + static inline uint32_t elf_sym__size(const GElf_Sym *sym) { return sym->st_size;