mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-02 11:01:35 +08:00
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.
This commit is contained in:
@ -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] != '.')
|
||||
|
Reference in New Issue
Block a user