Fix calculation of synthetic symbol sizes (ppc64)
The attached patch fixes a problem where nm displays bogus information for synthetic symbol sizes when --size-sort is used. This happens because the synthetic symbols (dot symbols for ppc64) are generated based on their non-dot symbols. The generation process doesn't copy over the ELF-specific bits of the regular non-dot symbols. When --size-sort is used, the code attempts to access the symbol size from the ELF-specific bits and ends up reading gargabe, causing the size to be displayed incorrectly. With the patch, i can see dot and non-dot symbols having the same size with --size-sort. This doesn't fix the fact that we don't display size information for synthetic symbols without --size-sort, which i may address in the future. binutils/ChangeLog: 2016-12-01 Luis Machado <lgustavo@codesourcery.com> * nm.c (sort_symbols_by_size): Don't read symbol size if symbol is synthetic.
This commit is contained in:
parent
5cd1d8bcc2
commit
cec4b2e3fe
2 changed files with 10 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2016-12-01 Luis Machado <lgustavo@codesourcery.com>
|
||||||
|
|
||||||
|
* nm.c (sort_symbols_by_size): Don't read symbol size if symbol
|
||||||
|
is synthetic.
|
||||||
|
|
||||||
2016-11-30 Nick Clifton <nickc@redhat.com>
|
2016-11-30 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
PR ld/20815
|
PR ld/20815
|
||||||
|
|
|
@ -762,6 +762,7 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean is_dynamic, void *minisyms,
|
||||||
asection *sec;
|
asection *sec;
|
||||||
bfd_vma sz;
|
bfd_vma sz;
|
||||||
asymbol *temp;
|
asymbol *temp;
|
||||||
|
int synthetic = (sym->flags & BSF_SYNTHETIC);
|
||||||
|
|
||||||
if (from + size < fromend)
|
if (from + size < fromend)
|
||||||
{
|
{
|
||||||
|
@ -777,9 +778,11 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean is_dynamic, void *minisyms,
|
||||||
|
|
||||||
sec = bfd_get_section (sym);
|
sec = bfd_get_section (sym);
|
||||||
|
|
||||||
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
|
/* Synthetic symbols don't have a full type set of data available, thus
|
||||||
|
we can't rely on that information for the symbol size. */
|
||||||
|
if (!synthetic && bfd_get_flavour (abfd) == bfd_target_elf_flavour)
|
||||||
sz = ((elf_symbol_type *) sym)->internal_elf_sym.st_size;
|
sz = ((elf_symbol_type *) sym)->internal_elf_sym.st_size;
|
||||||
else if (bfd_is_com_section (sec))
|
else if (!synthetic && bfd_is_com_section (sec))
|
||||||
sz = sym->value;
|
sz = sym->value;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue