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

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 6 09:13:11 PDT 2021


avl added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp:419
       }
 
       // Verify that ranges don't intersect and also build up the DieRangeInfo
----------------
clayborg wrote:
> 
> 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.
Yes, that should be done as a separate patch. Though, the question is do we want to make verifier silent on these cases? Or do we want that dwarf producer fixes the generated dwarf instead(removes debuginfo related to dead striped code)?


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