aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-03-02 10:52:51 +0000
committerNick Clifton <nickc@redhat.com>2017-03-02 10:52:51 +0000
commitc871dadee1817d4b9f3ba6ee792730c9eccf88e0 (patch)
treed4482208f51ac32c5095d7d0265a371e661629c2 /binutils
parentb451e98a909e1a6afa71c4a4655adc4cfeea5249 (diff)
downloadfsf-binutils-gdb-c871dadee1817d4b9f3ba6ee792730c9eccf88e0.zip
fsf-binutils-gdb-c871dadee1817d4b9f3ba6ee792730c9eccf88e0.tar.gz
fsf-binutils-gdb-c871dadee1817d4b9f3ba6ee792730c9eccf88e0.tar.bz2
Fix snafu parsing GNU_BUILD_NOTEs on ARM and AArch64 architectures.
* readelf.c (print_gnu_build_attribute_description): Use global symbols for OPEN attributes if at all possible.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/readelf.c22
2 files changed, 25 insertions, 2 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index fa33a43..dc93395 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+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.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 5cccccb..3bae045 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -16585,6 +16585,7 @@ print_gnu_build_attribute_description (Elf_Internal_Note * pnote,
for (i = 0; i < pnote->descsz; i += desc_size)
{
+ Elf_Internal_Sym * saved_sym = NULL;
Elf_Internal_Sym * sym;
unsigned long offset;
@@ -16609,8 +16610,19 @@ print_gnu_build_attribute_description (Elf_Internal_Note * pnote,
{
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
@@ -16618,8 +16630,14 @@ print_gnu_build_attribute_description (Elf_Internal_Note * pnote,
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");