aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/nm.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 35cd691..cf54b0f 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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>
PR ld/20815
diff --git a/binutils/nm.c b/binutils/nm.c
index d537441..7b4bcdf 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -762,6 +762,7 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean is_dynamic, void *minisyms,
asection *sec;
bfd_vma sz;
asymbol *temp;
+ int synthetic = (sym->flags & BSF_SYNTHETIC);
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);
- 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;
- else if (bfd_is_com_section (sec))
+ else if (!synthetic && bfd_is_com_section (sec))
sz = sym->value;
else
{