https://bugs.llvm.org/show_bug.cgi?id=46804

            Bug ID: 46804
           Summary: llvm-dwarfdump cannot handle .debug_ranges/.debug_loc
                    empty relocated range in ET_REL object
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: llvm-dwarfdump
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

See http://lists.llvm.org/pipermail/llvm-dev/2020-July/143575.html for full
context.

A .debug_ranges/.debug_loc sequence ends with an entry containing 0 for the two
addresses. In a fully-linked object, llvm-dwarfdump handles this fine. However,
in an ET_REL file, there might be relocations patching an apparent 0, 0 entry.
The parsing code does resolve relocations before determining if an address is
zero. However, if the relocations happen to be section-relative (or
symbol-relative, where the symbol is at a section start), the resultant address
will be the relocation addend, which could be 0 in both cases.

Simple example:

.section .foo,"a",@progbits
nop

.section .debug_ranges,"",@progbits:
.quad foo
.quad foo
.quad 0, 0 # actual terminator

This is a particular problem in .debug_loc, where the entry might have some
data afterwards, so a premature termination will cause parsing to completely
fail.

The solution is to not treat an address patched by a relocation as 0, for the
purpose of termination.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to