[PATCH] D70350: [DWARF] Allow cross-CU references of subprogram definitions

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 09:39:23 PST 2019


vsk added a comment.

In D70350#1757600 <https://reviews.llvm.org/D70350#1757600>, @dblaikie wrote:

> In D70350#1757579 <https://reviews.llvm.org/D70350#1757579>, @vsk wrote:
>
> > This breaks the dwarf produced in an LTO build of xnu. With the patch applied I start seeing a lot of verification failures, mostly about the ranges in a DIE lying outside of the parent DIE's ranges.
>
>
> Given what's happening here, I would suspect the verification might be incorrect rather than the DWARF. Could you provide a small (or any sized, really) example of the DWARF that's being flagged as invalid?


Apologies for the rushed update. Fred and I took a look and believe that the DWARF forms used for cross-CU references are not right, e.g.:

  error: DW_FORM_ref4 CU offset 0x00006ecb is invalid (must be less than CU size of 0x00003c30):
  
  0x00001ebf: DW_TAG_inlined_subroutine
                DW_AT_abstract_origin     (0x00006ecb) // Should be DW_FORM_ref_addr.

Additionally, it looks like low/high PCs are not being set properly, e.g.:

  error: DIE address ranges are not contained in its parent's ranges:
  0x00006786: DW_TAG_subprogram
                DW_AT_low_pc      (0x0000000000000001)
                DW_AT_high_pc     (0x0000000000000081)
  
  0x000067a9:   DW_TAG_lexical_block
                  DW_AT_low_pc    (0x00000000000030f0)
                  DW_AT_high_pc   (0x0000000000003140)

With this patch applied, the following assertion in `addLocalLabelAddress` (used by `attachLowHighPC`) does fire:

  void DwarfCompileUnit::addLocalLabelAddress(DIE &Die,
                                              dwarf::Attribute Attribute,
                                              const MCSymbol *Label) {
    assert(!Die.getUnit() || Die.getUnit() == getUnitDie().getUnit());

I plan on digging into this today.


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

https://reviews.llvm.org/D70350





More information about the llvm-commits mailing list