/* DWARF 2 support.
- Copyright (C) 1994-2015 Free Software Foundation, Inc.
+ Copyright (C) 1994-2016 Free Software Foundation, Inc.
Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions
(gavin@cygnus.com).
/* Align the new address to the current section
alignment. */
last_vma = ((last_vma
- + ~((bfd_vma) -1 << sect->alignment_power))
- & ((bfd_vma) -1 << sect->alignment_power));
+ + ~(-((bfd_vma) 1 << sect->alignment_power)))
+ & (-((bfd_vma) 1 << sect->alignment_power)));
sect->vma = last_vma;
last_vma += sz;
}
fail more quickly. */
return FALSE;
+ /* Set BFD_DECOMPRESS to decompress debug sections. */
if ((debug_bfd = bfd_openr (debug_filename, NULL)) == NULL
- || ! bfd_check_format (debug_bfd, bfd_object)
+ || !(debug_bfd->flags |= BFD_DECOMPRESS,
+ bfd_check_format (debug_bfd, bfd_object))
|| (msec = find_debug_info (debug_bfd,
debug_sections, NULL)) == NULL
|| !bfd_generic_link_read_symbols (debug_bfd))
done:
if (function)
{
- if (!function->is_linkage
- && _bfd_elf_find_function (abfd, symbols, section, offset,
- *filename_ptr ? NULL : filename_ptr,
- functionname_ptr))
+ if (!function->is_linkage)
{
- function->name = *functionname_ptr;
+ asymbol *fun;
+ bfd_vma sec_vma;
+
+ fun = _bfd_elf_find_function (abfd, symbols, section, offset,
+ *filename_ptr ? NULL : filename_ptr,
+ functionname_ptr);
+ sec_vma = section->vma;
+ if (section->output_section != NULL)
+ sec_vma = section->output_section->vma + section->output_offset;
+ if (fun != NULL
+ && fun->value + sec_vma == function->arange.low)
+ function->name = *functionname_ptr;
+ /* Even if we didn't find a linkage name, say that we have
+ to stop a repeated search of symbols. */
function->is_linkage = TRUE;
}
- else
- *functionname_ptr = function->name;
+ *functionname_ptr = function->name;
}
if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
unset_sections (stash);
/* Find the function to a particular section and offset,
for error reporting. */
-bfd_boolean
+asymbol *
_bfd_elf_find_function (bfd *abfd,
asymbol **symbols,
asection *section,
} *cache;
if (symbols == NULL)
- return FALSE;
+ return NULL;
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
- return FALSE;
+ return NULL;
cache = elf_tdata (abfd)->elf_find_function_cache;
if (cache == NULL)
cache = bfd_zalloc (abfd, sizeof (*cache));
elf_tdata (abfd)->elf_find_function_cache = cache;
if (cache == NULL)
- return FALSE;
+ return NULL;
}
if (cache->last_section != section
|| cache->func == NULL
}
if (cache->func == NULL)
- return FALSE;
+ return NULL;
if (filename_ptr)
*filename_ptr = cache->filename;
if (functionname_ptr)
*functionname_ptr = bfd_asymbol_name (cache->func);
- return TRUE;
+ return cache->func;
}