aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2016-07-09 14:25:31 +0930
committerAlan Modra <amodra@gmail.com>2016-07-09 16:53:33 +0930
commit32a0481fb147de2cd08c2980b177c298b4582ce7 (patch)
treeb20bded6e8ae35add5d441e504b18282583bf9c4 /binutils
parent11575232311d4fe4652ff37a46581ae4a13ccdc4 (diff)
downloadgdb-32a0481fb147de2cd08c2980b177c298b4582ce7.zip
gdb-32a0481fb147de2cd08c2980b177c298b4582ce7.tar.gz
gdb-32a0481fb147de2cd08c2980b177c298b4582ce7.tar.bz2
PR20337, Objdump makes poor choice of symbols
binutils/ PR binutils/20337 * objdump.c (compare_symbols): For ELF, sort same value/type symbols according to size. ld/ * testsuite/ld-powerpc/elfv2exe.d: Update.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/objdump.c15
2 files changed, 21 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index a854e6a..3bf6972 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2016-07-09 Alan Modra <amodra@gmail.com>
+
+ PR binutils/20337
+ * objdump.c (compare_symbols): For ELF, sort same value/type
+ symbols according to size.
+
2016-07-05 Andre Vieria <andre.simoesdiasvieira@arm.com>
* objdump.c (dump_section_header): Rename SEC_ELF_NOREAD
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 29d2276..2d2bddb 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -738,6 +738,21 @@ compare_symbols (const void *ap, const void *bp)
return 1;
}
+ if (bfd_get_flavour (bfd_asymbol_bfd (a)) == bfd_target_elf_flavour
+ && bfd_get_flavour (bfd_asymbol_bfd (b)) == bfd_target_elf_flavour)
+ {
+ bfd_vma asz, bsz;
+
+ asz = 0;
+ if ((a->flags & BSF_SYNTHETIC) == 0)
+ asz = ((elf_symbol_type *) a)->internal_elf_sym.st_size;
+ bsz = 0;
+ if ((b->flags & BSF_SYNTHETIC) == 0)
+ bsz = ((elf_symbol_type *) b)->internal_elf_sym.st_size;
+ if (asz != bsz)
+ return asz > bsz ? -1 : 1;
+ }
+
/* Symbols that start with '.' might be section names, so sort them
after symbols that don't start with '.'. */
if (an[0] == '.' && bn[0] != '.')