/* nm.c -- Describe symbol table of a rel file.
- Copyright (C) 1991-2016 Free Software Foundation, Inc.
+ Copyright (C) 1991-2017 Free Software Foundation, Inc.
This file is part of GNU Binutils.
#define file_symbol(s, sn, snl) \
(((s)->flags & BSF_FILE) != 0 \
- || ((sn)[(snl) - 2] == '.' \
+ || ((snl) > 2 \
+ && (sn)[(snl) - 2] == '.' \
&& ((sn)[(snl) - 1] == 'o' \
|| (sn)[(snl) - 1] == 'a')))
asection *sec;
bfd_vma sz;
asymbol *temp;
+ int synthetic = (sym->flags & BSF_SYNTHETIC);
if (from + size < fromend)
{
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
{