+2017-03-02 Nick Clifton <nickc@redhat.com>
+
+ * readelf.c (print_gnu_build_attribute_description): Use global
+ symbols for OPEN attributes if at all possible.
+
2017-03-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf.c (debug_displays_assert): New static assertion.
for (i = 0; i < pnote->descsz; i += desc_size)
{
+ Elf_Internal_Sym * saved_sym = NULL;
Elf_Internal_Sym * sym;
unsigned long offset;
{
if (strtab[sym->st_name] == 0)
continue;
+
if (pnote->type == NT_GNU_BUILD_ATTRIBUTE_OPEN)
- printf (_(" (file: %s)"), strtab + sym->st_name);
+ {
+ /* For OPEN attributes we prefer GLOBAL symbols, if there
+ is one that matches. But keep a record of a matching
+ LOCAL symbol, just in case that is all that we can find. */
+ if (ELF_ST_BIND (sym->st_info) == STB_LOCAL)
+ {
+ saved_sym = sym;
+ continue;
+ }
+ printf (_(" (file: %s)"), strtab + sym->st_name);
+ }
else if (ELF_ST_TYPE (sym->st_info) != STT_FUNC)
continue;
else
break;
}
}
+
if (sym == symtab + nsyms)
- printf (_(" (<symbol name unknown>)"));
+ {
+ if (saved_sym)
+ printf (_(" (file: %s)"), strtab + saved_sym->st_name);
+ else
+ printf (_(" (<symbol name unknown>)"));
+ }
}
printf ("\n");