[PATCH] D115325: [DWARF] Fix PR51087 Extraneous enum record in DWARF with type units

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 4 09:09:11 PST 2022


Orlando added a comment.

Thanks very much for the reproducer and revert @dblaikie.

IIUC it looks like this comment in `addGlobalTypeUnitType` in llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp hints at the issue (which was adding in your patch a0e3c751874f):

  // Insert, allowing the entry to remain as-is if it's already present
  // This way the CU-level type DIE is preferred over the "can't describe this
  // type as a unit offset because it's not really in the CU at all, it's only
  // in a type unit"

Prior to my patch, the first call to `addGlobalTypeUnitType` would always be with the CU DIE. With my patch that is not always true (and sometimes there is no CU DIE at all).

I'm not particularly familiar with pubnames/types, so I'm not sure which of the options I think we have is better/more appropriate:

1. Always emit CU DIEs for unused type unit types when pubtypes will be emitted (i.e., if we are emitting a pubtypes section then this patch will have no effect).
2. Or, don't emit a pubtype entry for a type that doesn't have a CU DIE (for example, with this patch applied, an unused enum which is described by a type unit).

Or perhaps something else. What do you think?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115325



More information about the llvm-commits mailing list