[PATCH] Introduce dwfl_module_getsym_info and dwfl_module_addrinfo.

Jan Kratochvil jan.kratochvil at redhat.com
Fri Dec 13 06:53:50 UTC 2013


On Thu, 12 Dec 2013 11:51:37 +0100, Mark Wielaard wrote:
> +/* Fetch one entry from the module's symbol table and the associated
> +   address value. On errors, returns NULL.  If successful, fills in
> +   *SYM, *ADDR and returns the string for st_name.  This works like
> +   gelf_getsym. *ADDR is set to the st_value adjusted to an absolute
> +   value based on the module's location, when the symbol is in an
> +   SHF_ALLOC section. For non-ET_REL files, if the arch uses function
> +   descriptors, and the st_value points to one, the value will be
> +   resolved to the actual function address. Note that since symbols
> +   can come from either the main, debug or auxiliary ELF symbol file
> +   (either dynsym or symtab) and the st_value itself isn't adjusted in
> +   any way (this is different from dwfl_module_getsym).  */
> +extern const char *dwfl_module_getsym_info (Dwfl_Module *mod, int ndx,
> +					    GElf_Sym *sym, GElf_Addr *addr)
> +  __nonnull_attribute__ (3, 4);

Not sure if you have considered dropping the first NULL ELF symbol, when it is
a new API anyway.  OTOH it will simplify neither caller nor the
implementation.

It could also document sh_info does not match the local vs. global symbols;
but that can be documented at any time.


Jan


More information about the elfutils-devel mailing list