Recently we teached LLD to report line numbers for duplicate variables
definitions, though currently LLD is unable to do that for case when
strings are not built in .debug_info, but stored in .debug_str instead.
That is because out LLDDwarfObj does not handle .debug_str yet.
Patch fixes that.
Details
- Reviewers
ruiu • rafael - Commits
- rG5f928ff1333e: [ELF] - Teach LLD to use information from .debug_str for error reporting.
rG5b262363b46d: [ELF] - Teach LLD to use information from .debug_str for error reporting.
rLLD318519: [ELF] - Teach LLD to use information from .debug_str for error reporting.
rLLD317305: [ELF] - Teach LLD to use information from .debug_str for error reporting.
rL318519: [ELF] - Teach LLD to use information from .debug_str for error reporting.
rL317305: [ELF] - Teach LLD to use information from .debug_str for error reporting.
Diff Detail
Event Timeline
It was reverted in r317378 because of https://bugs.llvm.org/show_bug.cgi?id=35199.
Something looks just broken in libDebugInfo though not sure this patch is OK, so reopening it for now.
I'll be on vacations next week, and will be able to investigate the issue after 13 nov (if nobody fix it earlier).
Reason of crash was that DWARF parsers performs an attempt to parse address ranges
from .dwo files. Previously when no .debug_str was provided by LLD, it failed to do that
and things just worked. After this patch started to provide ".debug_str", code of DWARF
parsers attempts to call DWARFObject::getFileName() to open .dwo and method was not
implemented in LLD.
I don't know why DWARF parser might want to collect address ranges from .dwo files and
wrote a mail "Collecting address ranges in DWARFUnit::collectAddressRanges." to llvm-dev with question
about that. It seems excessive logic, at least it is not covered by any testcases I found.
In this patch I suggest to implement stub returning empty string for now. That way nothing
changes for LLD, we will return empty file name and DWARF parser will fail to parse .dwo file
for collecting address ranges. But at the same time we will not crash and so can land this patch.
Added testcase which crashed with llvm_unreachable at
https://github.com/llvm-mirror/llvm/blob/master/lib/DebugInfo/DWARF/DWARFUnit.cpp#L335
in previous iteration.