On Mon, Oct 16, 2023 at 9:12 AM David Blaikie <dblai...@gmail.com> wrote:
> > > On Mon, Oct 16, 2023 at 8:57 AM Alexander Yermolovich <ayerm...@meta.com> > wrote: > >> For background llvm discussion on how to implement it: >> >> https://discourse.llvm.org/t/debuginfo-dwarfv5-lld-debug-names-with-fdebug-type-sections/73445 >> >> Thanks for explaining the issue, and proposing spec change. 🙂 >> The question I have. Is non-bit identical TUs with the same hash a >> fundamental issue that needs to be addressed somehow in the next version of >> the spec? If we could have such guarantee that should simplify things quite >> a bit. The linker can just follow the same path as for functions. Compiler >> can generate symbol name unique for the type unit hash. So, when linker >> comdats TU sections entries in TU list will point to correct address and no >> special logic is needed for tombstone. I guess there is a hashing mechanism >> in DWARF spec, but LLVM is not using it. Should we go back to it, is it >> enough? >> > > The hashing mechanism in the spec doesn't guarantee bit-identicality, I > believe. It's structural equivalence (eg: if you produce the main type DIE > followed by an int DIE that the main type needs, or you emit the int DIE > first, followed by the main type DIE - these hash to the same value > (because you start from the type DIE and hash outwards/to what it can > reach, and has structural equivalence - int is int, no matter what offset > it's at)) not bit identical. For a bunch of reasons this is preferable. > > (yes, clang takes this further and hashes based on the C++ ODR - which is > off-spec, but workable in our experience) > > I was thinking another direction we could go is that, I think, the only > things in a type unit that can be referenced is the type (I think?) then > perhaps we could modify how types defined in type units are referenced. > > If only the type can be referenced in a type unit, we could emit a > .debug_names entry without a DW_IDX_die_offset - just the DW_IDX_type_unit > - and the consumer can use the header of the type unit to find the exact > type unit DIE. > > Are there any other things that could be referenced within a type unit? > Hmm - this doesn't really relate to the local TU tombstoning issue (since that's tombstoning the reference to the unit) but would help address the foreign TU situation - in the DWP case, a consumer could ignore the DW_IDX_compile_unit alongside the DW_IDx_type_unit and look up that type in the DWP - then use the type unit's header to find the type DIE.
-- Dwarf-discuss mailing list Dwarf-discuss@lists.dwarfstd.org https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss