bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/23425] New: unresolved symbol diagnostic ends up calling find_ab


From: rguenth at gcc dot gnu.org
Subject: [Bug ld/23425] New: unresolved symbol diagnostic ends up calling find_abstract_instance with relocations applied causing spurious 'DWARF error: invalid abstract instance DIE ref'
Date: Wed, 18 Jul 2018 07:27:35 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=23425

            Bug ID: 23425
           Summary: unresolved symbol diagnostic ends up calling
                    find_abstract_instance with relocations applied
                    causing spurious 'DWARF error: invalid abstract
                    instance DIE ref'
           Product: binutils
           Version: 2.30
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

Backtrace from the 2.31 branch:

#0  _bfd_error_handler (
    fmt=0x690150 "DWARF error: invalid abstract instance DIE ref")
    at /space/rguenther/src/binutils-gdb/bfd/bfd.c:1177
#1  0x00000000004c6214 in find_abstract_instance (unit=0x7056d8, 
    orig_info_ptr=0x76df90 "\004> ", attr_ptr=0x7fffffffcd10, pname=0x770f18, 
    is_linkage=0x770f14, filename_ptr=0x770f00, linenumber_ptr=0x770f0c)
    at /space/rguenther/src/binutils-gdb/bfd/dwarf2.c:2843
#2  0x00000000004c6cbe in scan_unit_for_symbols (unit=0x7056d8)
    at /space/rguenther/src/binutils-gdb/bfd/dwarf2.c:3169
#3  0x00000000004c789f in comp_unit_find_nearest_line (unit=0x7056d8, 
    addr=4198435, filename_ptr=0x7fffffffd018, function_ptr=0x7fffffffce70, 
    linenumber_ptr=0x7fffffffd00c, discriminator_ptr=0x0, stash=0x7054a0)
    at /space/rguenther/src/binutils-gdb/bfd/dwarf2.c:3616
#4  0x00000000004c9975 in _bfd_dwarf2_find_nearest_line (abfd=0x6fe880, 
    symbols=0x705270, symbol=0x0, section=0x700dd0, offset=35, 
    filename_ptr=0x7fffffffd018, functionname_ptr=0x7fffffffd010, 
    linenumber_ptr=0x7fffffffd00c, discriminator_ptr=0x0, 
    debug_sections=0x68f9a0 <dwarf_debug_sections>, addr_size=4, 
    pinfo=0x700090) at /space/rguenther/src/binutils-gdb/bfd/dwarf2.c:4807
#5  0x0000000000491807 in _bfd_elf_find_nearest_line (abfd=0x6fe880, 
    symbols=0x705270, section=0x700dd0, offset=35, 
    filename_ptr=0x7fffffffd018, functionname_ptr=0x7fffffffd010, 
    line_ptr=0x7fffffffd00c, discriminator_ptr=0x0)
    at /space/rguenther/src/binutils-gdb/bfd/elf.c:8752
#6  0x000000000042574f in vfinfo (fp=0x7ffff7bd2080 <_IO_2_1_stderr_>, 
    fmt=0x555b18 ": undefined reference to `%pT'\n", ap=0x7fffffffd208, 
    is_warning=1) at /space/rguenther/src/binutils-gdb/ld/ldmisc.c:350
#7  0x000000000042643f in einfo (
    fmt=0x555b10 "%X%P: %C: undefined reference to `%pT'\n")
    at /space/rguenther/src/binutils-gdb/ld/ldmisc.c:626
#8  0x000000000041fd50 in undefined_symbol (info=0x6ced80 <link_info>, 
    name=0x70506c "_ZNSsC1Ev", abfd=0x6fe880, section=0x700dd0, address=35, 
    error=1) at /space/rguenther/src/binutils-gdb/ld/ldmain.c:1346
#9  0x000000000046ad3d in elf_x86_64_relocate_section (output_bfd=0x6e7210, 
    info=0x6ced80 <link_info>, input_bfd=0x6fe880, input_section=0x700dd0, 
    contents=0x701f60 "UH\211", <incomplete sequence \345\270>, 
    relocs=0x7050f8, local_syms=0x6f32b0, local_sections=0x76dd60)
    at /space/rguenther/src/binutils-gdb/bfd/elf64-x86-64.c:2483

The code says it only handles refs within the same file but the guard
for this, a zero die_ref, doesn't work after applying relocations to
.debug_info and this function ends up being called from the unresolved
symbol diagnostic causing a spurious DWARF error to be reported.

      /* We only support DW_FORM_ref_addr within the same file, so
         any relocations should be resolved already.  Check this by
         testing for a zero die_ref;  There can't be a valid reference
         to the header of a .debug_info section.
         DW_FORM_ref_addr is an offset relative to .debug_info.
         Normally when using the GNU linker this is accomplished by
         emitting a symbolic reference to a label, because .debug_info
         sections are linked at zero.  When there are multiple section
         groups containing .debug_info, as there might be in a
         relocatable object file, it would be reasonable to assume that
         a symbolic reference to a label in any .debug_info section
         might be used.  Since we lay out multiple .debug_info
         sections at non-zero VMAs (see place_sections), and read
         them contiguously into stash->info_ptr_memory, that means
         the reference is relative to stash->info_ptr_memory.  */
      size_t total;

      info_ptr = unit->stash->info_ptr_memory;
      info_ptr_end = unit->stash->info_ptr_end;
      total = info_ptr_end - info_ptr;
      if (!die_ref || die_ref >= total)
        {
          _bfd_error_handler
            (_("DWARF error: invalid abstract instance DIE ref"));
          bfd_set_error (bfd_error_bad_value);
          return FALSE;

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]