/* nm.c -- Describe symbol table of a rel file.
- Copyright (C) 1991-2017 Free Software Foundation, Inc.
+ Copyright (C) 1991-2018 Free Software Foundation, Inc.
This file is part of GNU Binutils.
if (sym == NULL)
bfd_fatal (bfd_get_filename (abfd));
- if (strcmp (sym->name, "__gnu_lto_slim") == 0)
+ if (sym->name[0] == '_'
+ && sym->name[1] == '_'
+ && strcmp (sym->name + (sym->name[2] == '_'), "__gnu_lto_slim") == 0)
non_fatal (_("%s: plugin needed to handle lto object"),
bfd_get_filename (abfd));
asection *sec;
bfd_vma sz;
asymbol *temp;
- int synthetic = (sym->flags & BSF_SYNTHETIC);
if (from + size < fromend)
{
sec = bfd_get_section (sym);
/* 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)
+ we can't rely on that information for the symbol size. Ditto for
+ bfd/section.c:global_syms like *ABS*. */
+ if ((sym->flags & (BSF_SECTION_SYM | BSF_SYNTHETIC)) == 0
+ && bfd_get_flavour (abfd) == bfd_target_elf_flavour)
sz = ((elf_symbol_type *) sym)->internal_elf_sym.st_size;
- else if (!synthetic && bfd_is_com_section (sec))
+ else if ((sym->flags & (BSF_SECTION_SYM | BSF_SYNTHETIC)) == 0
+ && bfd_is_com_section (sec))
sz = sym->value;
else
{
info.sinfo = &syminfo;
info.ssize = ssize;
- /* Synthetic symbols do not have a full symbol type set of data available. */
- if ((sym->flags & BSF_SYNTHETIC) != 0)
+ /* Synthetic symbols do not have a full symbol type set of data available.
+ Nor do bfd/section.c:global_syms like *ABS*. */
+ if ((sym->flags & (BSF_SECTION_SYM | BSF_SYNTHETIC)) != 0)
{
info.elfinfo = NULL;
info.coffinfo = NULL;
const char * version_string = NULL;
bfd_boolean hidden = FALSE;
- if ((sym->flags & BSF_SYNTHETIC) == 0)
+ if ((sym->flags & (BSF_SECTION_SYM | BSF_SYNTHETIC)) == 0)
version_string = bfd_get_symbol_version_string (abfd, sym, &hidden);
if (bfd_is_und_section (bfd_get_section (sym)))
void *minisyms;
unsigned int size;
struct size_sym *symsizes;
+ asymbol *synthsyms = NULL;
if (! dynamic)
{
if (show_synthetic && size == sizeof (asymbol *))
{
- asymbol *synthsyms;
asymbol **static_syms = NULL;
asymbol **dyn_syms = NULL;
long static_count = 0;
else
print_size_symbols (abfd, dynamic, symsizes, symcount, archive_bfd);
+ if (synthsyms)
+ free (synthsyms);
free (minisyms);
free (symsizes);
}
expandargv (&argc, &argv);
- bfd_init ();
+ if (bfd_init () != BFD_INIT_MAGIC)
+ fatal (_("fatal error: libbfd ABI mismatch"));
set_default_bfd_target ();
while ((c = getopt_long (argc, argv, "aABCDef:gHhlnopPrSst:uvVvX:",