[PATCH] D107554: [DWARF][Verifier] Do not add child DieRangeInfo with empty address range to the parent.

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 5 16:11:38 PDT 2021


clayborg added a comment.

This looks good to me but needs a test.



================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp:386
 
   DWARFAddressRangesVector Ranges = RangesOrError.get();
   // Build RI for this DIE and check that ranges within this DIE do not
----------------
As I was looking at this code and seeing as this patch wants to improve performance, can we change this to a const reference to avoid copying the ranges here? Compile units can have many ranges.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp:419
       }
 
       // Verify that ranges don't intersect and also build up the DieRangeInfo
----------------

On the other topic of dead stripping, I would suggest doing something like llvm-gsymutil does in llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp in the function handleObjectFile(...) where it iterates over all sections in a object file and comes up with .text address ranges for any sections that is a code section. This allows llvm-gsymutil to ignore any functions that should have been dead stripped by ignoring any functions with ranges that do not exist in any code ranges.

The code to find all text ranges looks like:

```
  AddressRanges TextRanges;
  for (const object::SectionRef &Sect : Obj.sections()) {
    if (!Sect.isText())
      continue;
    const uint64_t Size = Sect.getSize();
    if (Size == 0)
      continue;
    const uint64_t StartAddr = Sect.getAddress();
    TextRanges.insert(AddressRange(StartAddr, StartAddr + Size));
  }
```
We would store the "TextRanges" in the verifier itself and we would check any ranges we find and ignore any ranges that don't fall into any of the TextRanges. This will take care of all dead stripped functions and stop them from emitting extra errors. This can be done in a separate patch though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107554/new/

https://reviews.llvm.org/D107554



More information about the llvm-commits mailing list