PR20337, Objdump makes poor choice of symbols
authorAlan Modra <amodra@gmail.com>
Sat, 9 Jul 2016 04:55:31 +0000 (14:25 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 9 Jul 2016 07:23:33 +0000 (16:53 +0930)
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.

binutils/ChangeLog
binutils/objdump.c
ld/ChangeLog
ld/testsuite/ld-powerpc/elfv2exe.d

index a854e6a45689ac5d436ab7af047c754ed903bf5a..3bf69726613147ee1f0beab5cce1cb74461e83a0 100644 (file)
@@ -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
index 29d2276f6c27b9a9bfb157c587676872da8d964d..2d2bddb03ce5fc9093befb61522e05371d783d66 100644 (file)
@@ -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] != '.')
index cd6f04c63f55305f09f8d06c4701f413765800cd..cd616f425e253d0eaea23df9d85813b6dd47a02b 100644 (file)
@@ -1,3 +1,7 @@
+2016-07-09  Alan Modra  <amodra@gmail.com>
+
+       * testsuite/ld-powerpc/elfv2exe.d: Update.
+
 2016-07-06  James Bowman  <james.bowman@ftdichip.com>
 
        * scripttempl/ft32.sc (__PMSIZE): Correct __PMSIZE_.
index 3447c37b161ecb564daf838e63a1ebf9c329c0ff..4c3c632247ffbdb199e19fca9aeababbf5e1d7c4 100644 (file)
@@ -19,13 +19,13 @@ Disassembly of section \.text:
 .*:    (7d 89 03 a6|a6 03 89 7d)       mtctr   r12
 .*:    (4e 80 04 20|20 04 80 4e)       bctr
 
-0+100000e0 <_start>:
+0+100000e0 <(f1|_start)>:
 .*:    (3c 40 10 02|02 10 40 3c)       lis     r2,4098
 .*:    (38 42 82 00|00 82 42 38)       addi    r2,r2,-32256
 .*:    (7c 08 02 a6|a6 02 08 7c)       mflr    r0
 .*:    (f8 21 ff e1|e1 ff 21 f8)       stdu    r1,-32\(r1\)
 .*:    (f8 01 00 30|30 00 01 f8)       std     r0,48\(r1\)
-.*:    (4b ff ff f5|f5 ff ff 4b)       bl      .* <_start\+0x8>
+.*:    (4b ff ff f5|f5 ff ff 4b)       bl      .* <(f1|_start)\+0x8>
 .*:    (e8 62 80 08|08 80 62 e8)       ld      r3,-32760\(r2\)
 .*:    (4b ff ff c5|c5 ff ff 4b)       bl      .*\.plt_branch\.f2>
 .*:    (60 00 00 00|00 00 00 60)       nop
This page took 0.029932 seconds and 4 git commands to generate.