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 <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2009-04-01 11:38:37 -03:00
parent c73972591b
commit 2584df6335
2 changed files with 7 additions and 1 deletions

View File

@ -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... */

View File

@ -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;