summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@fb.com>2022-06-27 10:00:43 -0700
committerAlexander Yermolovich <ayermolo@fb.com>2022-06-27 10:01:03 -0700
commitbecbbb7e3c8141b3346211faf9359f629cbf4e4d (patch)
tree30da8f65ee195256060209cd38a7296d3cbab62e /lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
parenta2c1603206a49affafeba3d1b6b0ee0f4e1592e6 (diff)
Round up zero-sized symbols to 1 byte in `.debug_aranges` (without breaking other logic).
This commit modifies the AsmPrinter to avoid emitting any zero-sized symbols to the .debug_aranges table, by rounding their size up to 1. Entries with zero length violate the DWARF 5 spec, which states: > Each descriptor is a triple consisting of a segment selector, the beginning > address within that segment of a range of text or data covered by some entry > owned by the corresponding compilation unit, followed by the non-zero length > of that range. In practice, these zero-sized entries produce annoying warnings in lld and cause GNU binutils to truncate the table when parsing it. Other parts of LLVM, such as DWARFDebugARanges in the DebugInfo module (specifically the appendRange method), already avoid emitting zero-sized symbols to .debug_aranges, but not comprehensively in the AsmPrinter. In fact, the AsmPrinter does try to avoid emitting such zero-sized symbols when labels aren't involved, but doesn't when the symbol to emitted is a difference of two labels; this patch extends that logic to handle the case in which the symbol is defined via labels. Furthermore, this patch fixes a bug in which `available_externally` symbols would cause unpredictable values to be emitted into the `.debug_aranges` table under certain circumstances. In practice I don't believe that this caused issues up until now, but the root cause of this bug--an invalid DenseMap lookup--triggered failures in Chromium when combined with an earlier version of this patch. Therefore, this patch fixes that bug too. This is a revised version of diff D126257, which was reverted due to breaking tests. The now-reverted version of this patch didn't distinguish between symbols that didn't have their size reported to the DwarfDebug handler and those that had their size reported to be zero. This new version of the patch instead restricts the special handling only to the symbols whose size is definitively known to be zero. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D126835
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp')
0 files changed, 0 insertions, 0 deletions